ZHANGYUXUAN-zR commited on
Commit
15346ff
·
verified ·
1 Parent(s): aa67413

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. md/train/14nC8HNd4Ts/14nC8HNd4Ts.md +271 -0
  2. md/train/3AOj0RCNC2/3AOj0RCNC2.md +417 -0
  3. md/train/3RMnfrH_Fi8eU/3RMnfrH_Fi8eU.md +134 -0
  4. md/train/5Dl1378QutR/5Dl1378QutR.md +403 -0
  5. md/train/5nLibPckV2N/5nLibPckV2N.md +276 -0
  6. md/train/B1e3OlStPB/B1e3OlStPB.md +531 -0
  7. md/train/B1lfHhR9tm/B1lfHhR9tm.md +630 -0
  8. md/train/B1x8anVFPr/B1x8anVFPr.md +617 -0
  9. md/train/BJxbOlSKPr/BJxbOlSKPr.md +394 -0
  10. md/train/ByToKu9ll/ByToKu9ll.md +242 -0
  11. md/train/E3Ys6a1NTGT/E3Ys6a1NTGT.md +0 -0
  12. md/train/H1Xw62kRZ/H1Xw62kRZ.md +386 -0
  13. md/train/H1e572A5tQ/H1e572A5tQ.md +233 -0
  14. md/train/H1laeJrKDB/H1laeJrKDB.md +337 -0
  15. md/train/H1xFWgrFPS/H1xFWgrFPS.md +341 -0
  16. md/train/H1xQVn09FX/H1xQVn09FX.md +256 -0
  17. md/train/HHiiQKWsOcV/HHiiQKWsOcV.md +0 -0
  18. md/train/HJl6tC4KwB/HJl6tC4KwB.md +260 -0
  19. md/train/HJlmHoR5tQ/HJlmHoR5tQ.md +400 -0
  20. md/train/HJx9EhC9tQ/HJx9EhC9tQ.md +250 -0
  21. md/train/HkNKFiGex/HkNKFiGex.md +260 -0
  22. md/train/HkgH0TEYwH/HkgH0TEYwH.md +458 -0
  23. md/train/HyGh4sR9YQ/HyGh4sR9YQ.md +307 -0
  24. md/train/Hyl5V0EYvB/Hyl5V0EYvB.md +416 -0
  25. md/train/HyxzRsR9Y7/HyxzRsR9Y7.md +417 -0
  26. md/train/S1g2V3Cct7/S1g2V3Cct7.md +256 -0
  27. md/train/S1gBz2C9tX/S1gBz2C9tX.md +410 -0
  28. md/train/SkfhIo0qtQ/SkfhIo0qtQ.md +612 -0
  29. md/train/Skgvy64tvr/Skgvy64tvr.md +0 -0
  30. md/train/UEtNMTl6yN/UEtNMTl6yN.md +240 -0
  31. md/train/Z2vksUFuVst/Z2vksUFuVst.md +344 -0
  32. md/train/aJh-lFL2dFJ21/aJh-lFL2dFJ21.md +216 -0
  33. md/train/bM3L3I_853/bM3L3I_853.md +304 -0
  34. md/train/gwPPcc_M0lv/gwPPcc_M0lv.md +481 -0
  35. md/train/jNTeYscgSw8/jNTeYscgSw8.md +390 -0
  36. md/train/kN4mGdGWc92/kN4mGdGWc92.md +542 -0
  37. md/train/r1lIKlSYvH/r1lIKlSYvH.md +592 -0
  38. md/train/rJLS7qKel/rJLS7qKel.md +298 -0
  39. md/train/rJTutzbA-/rJTutzbA-.md +682 -0
  40. md/train/rJwelMbR-/rJwelMbR-.md +296 -0
  41. md/train/rJxDkvqee/rJxDkvqee.md +279 -0
  42. md/train/rkxaNjA9Ym/rkxaNjA9Ym.md +0 -0
  43. md/train/ry8dvM-R-/ry8dvM-R-.md +307 -0
  44. md/train/rylT0AVtwH/rylT0AVtwH.md +418 -0
  45. md/train/rywHCPkAW/rywHCPkAW.md +407 -0
  46. md/train/tkAtoZkcUnm/tkAtoZkcUnm.md +0 -0
  47. md/train/tyd9yxioXgO/tyd9yxioXgO.md +400 -0
  48. md/train/vlcVTDaufN/vlcVTDaufN.md +245 -0
  49. md/train/wTutcPE7zOC/wTutcPE7zOC.md +444 -0
  50. md/train/x8gM-4nFq9b/x8gM-4nFq9b.md +441 -0
md/train/14nC8HNd4Ts/14nC8HNd4Ts.md ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SYNTHESISING REALISTIC CALCIUM TRACES OF NEURONAL POPULATIONS USING GAN
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Calcium imaging has become a powerful and popular technique to monitor the activity of large populations of neurons in vivo. However, for ethical considerations and despite recent technical developments, recordings are still constrained to a limited number of trials and animals. This limits the amount of data available from individual experiments and hinders the development of analysis techniques and models for more realistic sizes of neuronal populations. The ability to artificially synthesize realistic neuronal calcium signals could greatly alleviate this problem by scaling up the number of trials. Here, we propose a Generative Adversarial Network (GAN) model to generate realistic calcium signals as seen in neuronal somata with calcium imaging. To this end, we propose CalciumGAN, a model based on the WaveGAN architecture and train it on calcium fluorescent signals with the Wasserstein distance. We test the model on artificial data with known ground-truth and show that the distribution of the generated signals closely resembles the underlying data distribution. Then, we train the model on real calcium traces recorded from the primary visual cortex of behaving mice and confirm that the deconvolved spike trains match the statistics of the recorded data. Together, these results demonstrate that our model can successfully generate realistic calcium traces, thereby providing the means to augment existing datasets of neuronal activity for enhanced data exploration and modelling.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ The ability to record accurate neuronal activities from behaving animals is essential for the study of information processing in the brain. Electrophysiological recording, which measures the rate of change in voltage by microelectrodes inserted in the cell membrane of a neuron, has high temporal resolution and is considered the most accurate method to measure spike activities (Dayan & Abbott, 2001). However, this method is not without shortcomings (Harris et al., 2016). For instance, a single microelectrode can only detect activity from few neurons in close proximity, and extensive pre-processing is required to infer single-unit activity from a multi-unit signal. Disentangling circuit computations in neuronal populations of a large scale remains a difficult task (Rey et al., 2015). On the other hand, calcium imaging monitors the calcium influx in the cell as a proxy of an action potential (Berridge et al., 2000). Contrary to electrophysiological recordings, this technique yields data with high spatial resolution and low temporal resolution (Grienberger & Konnerth, 2012), and has become a powerful imaging technique to monitor large neuronal populations. With the advancements in these recording technologies, it has become increasingly easier to obtain high-quality neuronal activity data in vivo from live animals. However, due to ethical considerations, the acquired datasets are often limited by the number of trials or the duration of each trial on a live animal. This poses a problem for assessing analysis techniques that take into account higher-order correlations (Brown et al., 2004; Staude et al., 2010; Stevenson & Kording, 2011; Saxena & Cunningham, 2019). Even for linear decoders, the number of trials can be more important for determining coding accuracy than the number of neurons (Stringer et al., 2019).
12
+
13
+ Generative models of neuronal activity hold the promise of alleviating the above problem by enabling the synthesis of an unlimited number of realistic samples for assessing advanced analysis methods. Popular modelling approaches such as the maximum entropy framework (Schneidman et al., 2006; Tkacik et al., 2014) and the latent variable model (Macke et al., 2009; Lyamzin et al., ˇ 2010) have shown ample success in modelling spiking activities, though many of these models require strong assumptions on the data and cannot generalize to different cortical areas. To this end, GANs have shown tremendous success in synthesizing data across a vast variety of domains and data-types (Karras et al., 2017; Gomez et al., 2018; Donahue et al., 2019), and are good candidates for modelling neuronal activities. Spike-GAN (Molano-Mazon et al., 2018) demonstrated that GANs can model neural spikes that accurately match the statistics of real recorded spiking behaviour from a small number of neurons. Moreover, the discriminator in Spike-GAN is able to learn to detect which population activity pattern is the relevant feature, and this can provide insights into how a population of neurons encodes information. Ramesh et al. (2019) trained a conditional GAN (Mirza & Osindero, 2014), conditioned on the stimulus, to generate multivariate binary spike trains. They fitted the generative model with data recorded in the V1 area of macaque visual cortex, and the GAN generated spike trains were able to capture the firing rate and pairwise correlation statistics better than the dichotomized Gaussian model (Macke et al., 2009) and a deep supervised convolution model.
14
+
15
+ Nevertheless, the aforementioned deep generative models operate on spike trains which are discrete in nature, and back-propagation on discrete data remains a difficult task (Caccia et al., 2018). For instance, Ramesh et al. (2019) used the REINFORCE gradient estimate (Williams, 1992) to train the generator in order to perform back-propagation on discrete data. Still, gradient estimation with the REINFORCE approach yields large variance, which is known to be challenging for optimization (Maddison et al., 2016; Zhang et al., 2017). In addition, generating and training on binary spike trains directly introduces uncertainty as the generator has to learn the deconvolution process as well, making it an even more difficult task.
16
+
17
+ In this work, we investigate the possibility of synthesising continuous calcium fluorescent signals using the GAN framework, as a method to scale-up or augment the amount of population activity data. In addition, modelling the calcium signals directly has several advantages (a) the generator needs to learn the deconvolution process when synthesising directly on binary spike trains, hence there is additional uncertainty, which is not present for calcium signals. (b) Calcium imaging signals have inherently more information about the neuronal activities than binary spike trains. (c) Based on calcium signals with known ground-truth, calcium deconvolution algorithms can be evaluated. Hence, We devised a workflow to synthesize and evaluate calcium imaging signals, then validate the method on artificial data with known ground-truth as well as mimicking real two-photon calcium $( \mathrm { C a ^ { 2 + } } )$ imaging data as recorded from the primary visual cortex of a behaving mouse (Pakan et al., 2018; Henschke et al., 2020).
18
+
19
+ # 2 METHODS
20
+
21
+ # 2.1 NETWORK ARCHITECTURE
22
+
23
+ The original GAN framework, introduced in Goodfellow et al. (2014), plays a min-max game where the generator $G$ attempts to generate convincing samples from the latent space $Z$ , and the discriminator $D$ learns to distinguish between generated samples and real samples $X$ . In this work, we use the WGAN-GP (Gulrajani et al., 2017) formulation of the loss function without the need of incorporating any information of the neural activities into the training objective:
24
+
25
+ $$
26
+ \mathcal { L } _ { D } = \underset { z \sim Z } { \mathbb { E } } [ D ( G ( z ) ) ] - \underset { x \sim X } { \mathbb { E } } [ D ( x ) ] + \lambda \underset { \tilde { x } \sim \tilde { X } } { \mathbb { E } } [ ( \| \nabla _ { \tilde { x } } D ( \tilde { x } ) \| _ { 2 } - 1 ) ^ { 2 } ]
27
+ $$
28
+
29
+ where $\lambda$ denotes the gradient penalty coefficient, $\tilde { x } = \epsilon x + ( 1 - \epsilon ) \hat { x }$ are samples taken between the real and generated data distribution.
30
+
31
+ For learning calcium signal generation, we adapted the WaveGAN architecture (Donahue et al., 2019), which has shown promising results in audio signal generation. In the generator, we used 1-dimensional transposed convolution layers to up-sample the input noise. We added Layer Normalization (Ioffe & Szegedy, 2015) in between each convolution and activation layer, in order to stabilize training as well as to make the operation compatible with the WGAN-GP framework. To improve the model learning performance and stability, the calcium signals were scaled to the range between 0 and 1 by normalizing with the maximum value of the calcium signal in the data. Correspondingly, we chose sigmoid activation in the output layer of the generator and then re-scaled the signals to their original range before inferring their spike trains.
32
+
33
+ The architecture of the discriminator in our model is largely a mirror of the generator, with the exception of the removal of Layer Normalization and instead of up-sampling the input with transposed convolution, we used a simple convolution layer. Samples generated using transposed convolution often exhibit the ”checkerboard” artifacts described by Odena et al. (2016), where the output exhibits repeated patterns (usually very subtle to the eye) due to a filter being applied unevenly to the receptive field. In the context of signal generation, the discrimination could exploit the periodic artifacts pattern and learn a naive policy to reject generated samples. Donahue et al. (2019) proposed the Phase Shuffle mechanism in the discriminator to address the aforementioned issue. The Phase Shuffle layer randomly shifts the activated units after each convolution layer within $[ - n , n ]$ , in order to distort the periodic pattern. Hence, the resulting samples constitute a more challenging task for the discriminator. Figure A.4 shows a simple illustration of the Phase Shuffle operation. In our network, we incorporated the Phase Shuffle operation, as well as using a kernel size that is divisible by the stride size, as suggested in Odena et al. (2016). We apply the Phase Shuffle operation after each convolution layer, which has led to a noticeable improvement in the generated samples. Table A.1 shows the exact architecture of our model.
34
+
35
+ # 2.2 MODEL PIPELINE
36
+
37
+ We devised a consistent model analysis pipeline to evaluate the quality of samples generated by the model, as well as its ability to generalize, in the context of neuronal population spiking activities. The complete model analysis pipeline is shown in Figure A.2.
38
+
39
+ As calcium imaging is largely being used as a proxy to monitor spiking activities, we have decided to evaluate and present the inferred spike trains instead of raw calcium signals. We used the Online Active Set method to Infer Spikes (OASIS) AR1 deconvolution algorithm (Friedrich et al., 2017) to infer spiking activities from calcium fluorescent signals. We apply OASIS to both the training data and generated data to ensure the potential bias in the deconvolution process applies to the two sets of data. We then trained both the generator and discriminator with the WGAN-GP framework (Gulrajani et al., 2017), with 5 discriminator update steps for each generator update step. We used the Adam optimizer (Kingma & Ba, 2014) to optimize both networks, with a learning rate of $\lambda = 1 0 ^ { - 4 }$ , $\beta _ { 1 } = 0 . 9$ and $\beta _ { 2 } = 0 . 9 9 9 9$ . To speed up the training process, we incorporated Mixed Precision training (Micikevicius et al., 2017) in our codebase. The exact hyper-parameters being used in this work can be found in Table A.2.
40
+
41
+ After inferring the spike trains from the generated calcium signals, we then measure the spike train statistics and similarities using the Electrophysiology Analysis Toolkit (Denker et al., 2018). Following some of the previous works in spike generation (Macke et al., 2009; Molano-Mazon et al., 2018; Ramesh et al., 2019), we evaluate the performance of our model with the following statistics and similarities: (a) mean firing rate for evaluating single neuron statistics; (b) pairwise Pearson correlation coefficient for evaluating pairwise statistics; (c) pairwise van-Rossum distance (Rossum, 2001) for evaluating general spike train similarity. Importantly, we evaluate these quantities across the whole population for each neuron or neuron pair and each short time interval $\mathrm { 1 0 0 m s ) }$ and compare the resulting distributions over these quantities obtained from training data as well as generated data. We therefore validate the whole spatiotemporal first- and second-order statistics as well as general spike train similarities.
42
+
43
+ # 2.3 DATA
44
+
45
+ # 2.3.1 DICHOTOMIZED GAUSSIAN ARTIFICIAL DATA
46
+
47
+ In order to verify that CalciumGAN is able to learn the underlying distribution and statistics of the training data, we generated our own ground-truth dataset with pre-defined mean and covariance using the dichotomized Gaussian (DG) model (Macke et al., 2009). The model uses a multivariate normal distribution to generate latent continuous random variables which are then thresholded to generate binary variables representing spike trains. The DG model has mean vector and covariance matrix as free parameters. To generate data from this model, we used the sample means and sample covariances obtained from real recorded data (see Section 2.3.2). In alignment with the recorded data, we generated correlated spike trains for $N = 1 0 2$ neurons with a duration of 899 seconds and at $2 4 \mathrm { H z }$ , hence a matrix with shape (21576, 102). In order to obtain calcium-like signals $c$ from spike trains $s$ with length $T$ , we convolved the generated spike trains with a calcium response kernel and added noise, as described in Friedrich et al. (2017):
48
+
49
+ $$
50
+ \begin{array} { r l } { s _ { t } = g s _ { t - 1 } + s _ { t } \quad } & { { } 1 \leq t \leq T } \\ { c = b + s + \sigma u \quad } & { { } u \sim \mathcal { N } ( 0 , 1 ) } \end{array}
51
+ $$
52
+
53
+ where $g$ denotes a finite impulse response filter, $b$ is the baseline value of the signal and $\sigma$ is the noise standard deviation. In our work, we set $g = 0 . 9 5$ , $\sigma = 0 . 3$ and $b = 0$ . We scale the signal range to the unit interval. The data is then segmented using a sliding window along the time dimension with a stride of 2 and a window size of $T = 2 0 4 8$ (around 85 seconds in experiment time). We apply the segmentation procedure to both the signal and spike data, hence resulting in two matrices with shape (9754, 2048, 102). Examples of signals and spikes generated from the DG model can be found in Figure A.1a.
54
+
55
+ # 2.3.2 TWO-PHOTON CALCIUM IMAGING RECORDED DATA
56
+
57
+ Next, we used two-photon calcium imaging data recorded in the primary visual cortex of behaving mice. The data were collected with the same setup as specified in Pakan et al. (2018) and Henschke et al. (2020). Head-fixed mice were placed on a cylindrical treadmill, and navigated a virtual corridor rendered on two monitors that covered the majority of their visual field. A lick spout was placed in front of the mice, where a water drop would be made available to the mice as a reward if it licked at the correct location within the virtual environment. Hence, the mice would learn to utilize both the visual information and the self-motion feedback in order to maximize the rewards. Neuronal activity was monitored from the same primary visual cortex populations over multiple consecutive behavioural sessions. The basic characteristics of the recorded data are shown in Table A.3. We first experiment with calcium imaging data recorded on the $4 ^ { \mathrm { t h } }$ day of the experiment, where the mice were familiar with the virtual environment and the given task. In this particular recording, neurons were labelled with GCamP6f, and $N = 1 0 2$ neurons were recorded at a sampling rate of $2 4 \mathrm { H z }$ , and the mouse performed 204 trials in 898.2 seconds (raw data shape (21556, 102)). Due to the fact that GAN models require a significant amount of training data, information about the trial and position of the mouse in the virtual environment were not used in this work.
58
+
59
+ # 3 RESULTS
60
+
61
+ We propose CalciumGAN as a generative model to synthesize realistic calcium traces as imaged from neuronal populations. To validate our model, we used artificial data with known groundtruth as well as real data recorded from the primary visual cortex of behaving mice. We used the WGAN-GP training objective (Section 2.1) to train both the generator and discrminator. We have also experimented with the objective function from the original GAN (Goodfellow et al., 2014) and LSGAN (Mao et al., 2017). From our experiments, the WGAN-GP formulation had the best training performance and stability.
62
+
63
+ # 3.1 SYNTHETIC DATA MIMICKING DICHOTOMIZED GAUSSIAN DATA
64
+
65
+ We first fit our model with the artificial dataset sampled from the DG distribution. We trained the model for 400 epochs with 8,754 samples and held out 1,000 samples for evaluation. Since we defined the model from which we generated the training dataset, we can validate the statistics of the dataset generated by CalciumGAN on the known ground-truth directly. Examples of generated signals and its inferred spikes can be found in Figure A.1b.
66
+
67
+ Here, we compare both the trend and variation of the generated data statistics with the DG data. We estimated the mean firing rates and the covariances of data generated by CalciumGAN and compared it to the DG ones (Figure 1). We plotted the values of 5 samples for each neuron and neuron-pair, and sorted them by their mean in ascending order. The variation of the firing rate across samples matched with those of the ground-truth data. The majority of the neuron pairs have low correlation, a characteristic which was also found in the generated data. The neuron pairs that have highly positive and highly negative covariance also have a greater variation across samples.
68
+
69
+ ![](images/24da61f8b3d8eb3a93537d5504b6f2f755b5ef3e4d26b4a816caf4f13e7d7283.jpg)
70
+ Figure 1: CalciumGAN trained on the dichotomized Gaussian dataset with known ground-truth. (a) Mean firing rate of each neuron. (b) Neuron pairwise covariance. Blue dots represent DG data and orange crosses present generated data. 5 randomly selected samples for each neuron and neuronpair were displayed in both graphs, where the order on the $\mathbf { X }$ -axis was sorted by the mean of the firing rate and covariance respectively. In (b), only every $1 0 ^ { \mathrm { t h } }$ pair is displayed for clarity.
71
+
72
+ ![](images/e4619ee7f16e052ba2ea77a38c7b9c92d8ec81b6e207ba245655f438b22d744c.jpg)
73
+ Figure 2: Calcium signals and inferred spike trains (in gray) of randomly selected neurons. (a) shows the recorded data (in blue) and (b) shows synthetic data (in orange) generated by CalciumGAN trained on recorded data. Note: the generated data should not be identical with the recorded data, because CalciumGAN should not replicate the signals.
74
+
75
+ # 3.2 SYNTHETIC DATA MIMICKING RECORDED DATA
76
+
77
+ After validating our model on data with known ground-truth, we applied CalciumGAN on twophoton calcium imaging data recorded in the primary visual cortex of mice performing a virtual reality task. We applied the OASIS deconvolution algorithm to infer the spike activities from the recorded calcium signals, and performed the same normalization and segmentation steps as mentioned in Section 2.3.1. Figure 2a shows examples of the recorded calcium signals and inferred spike trains. There are multiple challenges for both the generator and discriminator to learn from the calcium imaging signals. Since data were segmented with a sliding window and the information of the trial was not used, some samples might consist of abnormal signal activity, such as a peak being cropped off. Generated signals could have the same number of peaks or ranges, though might not preserve the peak and decay characteristics of calcium imaging data. Real and synthetic activity from less active neurons might be more difficult for the discriminator to distinguish due to the absence of prominent spiking characteristics.
78
+
79
+ Similar to the DG analysis, we trained the model for 400 epochs, with 8,754 training samples, and 1,000 samples were held out for evaluation. Note that since we are not taking the trial and position of the mice in the virtual environment into consideration when training the model, the generated data and the evaluation data do not have a one-to-one mapping.
80
+
81
+ ![](images/c2b9eacf6d7cc386d54f59f3553072139c9b2b9d602129c510a2be41712bd786.jpg)
82
+ Figure 3: Raster plot of inferred real and synthetic spike trains of a randomly selected sample generated by CalciumGAN trained on recorded data. Blue markers indicate recorded data and orange markers indicate generated data. The histograms on the $x$ and $y$ axis indicate number of spikes over the temporal dimension and neuron population respectively.
83
+
84
+ We first inspect the generated data and the deconvolved spike trains visually. The calcium signals and inferred spike trains of randomly selected neurons from a randomly selected sample are shown in Figure 2b. Both the synthetic raw traces as well as the inferred spikes visually match the characteristics of the recorded ones.
85
+
86
+ We then compared the spiking characteristics across the whole population. Figure 3 shows the inferred spike trains of the complete 102 neurons population from a randomly selected sample of the real and the synthetic data, with the distribution histogram plotted on the $x$ and $y$ axis. The synthetic data mimicks the firing patterns across neurons and across time remarkably well with occasional small deviations in the rates at particular temporal intervals. Notably, the samples are clearly not identical meaning that the network did not just replicate the training set data.
87
+
88
+ In order to examine if CalciumGAN is able to capture the first and second order statistics of the recorded data, we measured the mean firing rate, pairwise correlation, and van-Rossum distance (see Figure 4). The randomly selected neurons shown in Figure 4a have very distinct firing rate distributions, and CalciumGAN is able to model all of them relatively well, with KL divergence of
89
+
90
+ ![](images/d136b6bc6c9c5ec97dbb1906220e900fcf4a465b49a980e3b0a7feffe3764f76.jpg)
91
+ Figure 4: First and second order statistics of data generated from CalciumGAN trained on the recorded data. Shown neurons and samples were randomly selected. (a) Mean firing rate distribution over 1000 samples per neuron. (b) Pearson correlation coefficient distribution. (c) van-Rossum distance between recorded and generated spike trains over 45 samples. Heatmaps were sorted where the pair with the smallest distance value was placed at the top left corner, followed by the pair with the second smallest distance at the second row second column, and so on.
92
+
93
+ ![](images/52862ef1a368836b72596e3a87f7b23e4751f8775acb716171abbe40de5c8110.jpg)
94
+ Figure 5: KL divergence of the (a) mean firing rate, (b) pairwise correlation and (c) pairwise vanRossum distance between 1,000 recorded and generated samples.
95
+
96
+ 0.31 and 0.16 with respect to the recorded firing rate over 1000 samples. We show the pairwise van-Rossum distance of the same neuron between recorded and generated data across 45 samples in Figure 4c as sorted heatmaps. Less active neurons, such as neuron 75, have a low distance value across samples, mainly due to the scarcity of firing events. Conversely, a high frequency neuron, such as neuron 27, exhibits a clear trend of lower distance values in the diagonal of the heatmap, implying the existence of a pair of recorded and generated sample that are similar. In order to ensure that the data generated by our model capture the underlying distribution of the training data, we also compute the KL divergence between the distributions of the above-mentioned metrics (see Figure 5). Note that we measure the pairwise distance of the same neuron across 50 samples in Figure 4c, whereas in Figure 5c, we measure pairwise van-Rossum distance of each neuron with respect to other neurons within the same sample. We also fitted the DG model to the recorded data
97
+
98
+ and measure the same statistics on the DG generated spike trains as a baseline. Table 1 shows the mean KL divergence of the generated data from CalciumgGAN, CalciumGAN with Phase Shuffle disabled (see Appendix A.2) and the DG model.
99
+
100
+ <table><tr><td>Model</td><td>mean firing rate</td><td></td><td>丨pairwise correlation|van-Rossum distance</td></tr><tr><td>CalciumGAN</td><td>0.4533</td><td>0.0821</td><td>0.5757</td></tr><tr><td>- without Phase Shuffle</td><td>1.0170</td><td>0.1027</td><td>0.7787</td></tr><tr><td>DG</td><td>1.0592</td><td>0.3379</td><td>1.0287</td></tr></table>
101
+
102
+ Table 1: The mean KL divergence value in each metrics of different models.
103
+
104
+ The results we presented above were trained on recordings collected from a mouse that was already familiar with the specific task. However, we were also interested in our model’s capability to learn from neuronal activities that are more stochastic and potentially less correlated. To this end, we trained CalciumGAN on data recorded on the first day of the experiment (average firing rate of $5 8 . 0 7 \mathrm { H z }$ on day 1 versus $3 5 . 8 3 \mathrm { H z }$ on day 4, see Table A.3). Appendix A.3 shows the generated samples and the statistics of the inferred spike trains. The generated data were able to reflect the first and second-order statistics of the recorded data, with mean KL divergence of 0.32, 0.06 and 0.51 when comparing with the mean firing rate, pairwise correlation and van-Rossum distance, respectively. Overall, CalciumGAN was able to capture the statistics and underlying distribution of the real calcium imaging data acquired in the primary visual cortex of awake, behaving mice.
105
+
106
+ # 4 DISCUSSION
107
+
108
+ Despite the recent advancement and popularity of calcium imaging of neuronal activity in vivo, the number of trials and the duration of imaging sessions in animal experiments is limited due to ethical and practical considerations. This work provides a readily applicable tool to fit a GAN on calcium signals, enabling the generation of more data that matches the statistics of the provided data.
109
+
110
+ We demonstrated that the GAN framework is capable of synthesizing realistic calcium fluorescent signals similar to those imaged in the somata of neuronal populations of behaving animals. To achieve this, we adapted the WaveGAN (Donahue et al., 2019) architecture with the Wasserstein distance training objective. We generated artificial neuronal activities using a dichotomized Gaussian model, showing that CalciumGAN is able to learn the underlying distribution of the data. We then fitted our model to imaging data from the primary visual cortex of a behaving mouse. Importantly, we showed that the statistics of the synthetic spike trains match the statistics of the recorded data, without the need of incorporating any information of the neuronal activities into the model or the objective function.
111
+
112
+ We would like to highlight one potential bias in this work. To infer spike trains from the real and synthetic calcium traces, we used the OASIS deconvolution algorithm by Friedrich et al. (2017), a method which has great real-time deconvolution performance, as well as an existing Python implementation of the algorithm by the authors (Friedrich, 2017). Speed was a crucial characteristic for evaluating a large number of trials. Nonetheless, we found that this advantage often came at the cost of performance in the form of clearly missed spikes (c.f. Figure 2). However, we stress that these shortcomings apply to both the real data and the synthetic data in exactly the same way. In the end, we use the inferred spikes as a way to validate the plausibility of the synthesized traces. The comparison is fair as long as real and synthetic deconvolutions are subject to the same biases.
113
+
114
+ As the work in deep generative models continue to develop and expand, there is a limitless number of possibilities to explore at the intersection of the GAN framework and neural coding. One potential future direction for this work is to provide a meaningful interpretation for the latent generator representation. In many image generation tasks with GANs (Bojanowski et al., 2017; Karras et al., 2017) it has been shown that the output image can be modified or targeted by interpolating the latent variable that is fed to the generator. Similarly, one could potentially have final control of the generated calcium signals by exploring the synthetic calcium signals generated after interpolating samples in the latent space. Thereby, one could generate calcium imaging data that resemble the neuronal activities of an animal performing a particular novel task. Another interesting research direction would be using a GAN to learn the relationship between different neuronal populations, or to reveal changes in activity of the same neuronal population in different training phases of an animal learning a behavioral task. This could be achieved by using, for instance, CycleGAN (Zhu et al., 2017), an unsupervised learning model that can learn the mapping between two distributions without paired data, as a potential model architecture.
115
+
116
+ # REFERENCES
117
+
118
+ Michael J Berridge, Peter Lipp, and Martin D Bootman. The versatility and universality of calcium signalling. Nature reviews Molecular cell biology, 1(1):11–21, 2000.
119
+
120
+ Piotr Bojanowski, Armand Joulin, David Lopez-Paz, and Arthur Szlam. Optimizing the latent space of generative networks. arXiv preprint arXiv:1707.05776, 2017.
121
+
122
+ Emery N Brown, Robert E Kass, and Partha P Mitra. Multiple neural spike train data analysis: state-of-the-art and future challenges. Nature neuroscience, 7(5):456–461, 2004.
123
+
124
+ Massimo Caccia, Lucas Caccia, William Fedus, Hugo Larochelle, Joelle Pineau, and Laurent Charlin. Language gans falling short. arXiv preprint arXiv:1811.02549, 2018.
125
+
126
+ Peter Dayan and Laurence F Abbott. Theoretical neuroscience: computational and mathematical modeling of neural systems. 2001.
127
+
128
+ M. Denker, A. Yegenoglu, and S. Grun. Collaborative HPC-enabled workflows on the HBP Col- ¨ laboratory using the Elephant framework. In Neuroinformatics 2018, pp. P19, 2018. doi: 10.12751/incf.ni2018.0019. URL https://abstracts.g-node.org/conference/ NI2018/abstracts#/uuid/023bec4e-0c35-4563-81ce-2c6fac282abd.
129
+
130
+ Chris Donahue, Julian McAuley, and Miller Puckette. Adversarial audio synthesis. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum? id $=$ ByMVTsR5KQ.
131
+
132
+ Johannes Friedrich. Oasis. https://github.com/j-friedrich/OASIS, 2017.
133
+
134
+ Johannes Friedrich, Pengcheng Zhou, and Liam Paninski. Fast online deconvolution of calcium imaging data. PLoS computational biology, 13(3):e1005423, 2017.
135
+
136
+ Flavio Frohlich. Chapter 11 - optical measurements and perturbations. In Flavio Fr ¨ ohlich (ed.), ¨ Network Neuroscience, pp. 145 – 159. Academic Press, San Diego, 2016. ISBN 978-0-12- 801560-5. doi: https://doi.org/10.1016/B978-0-12-801560-5.00011-2. URL http://www. sciencedirect.com/science/article/pii/B9780128015605000112.
137
+
138
+ Aidan N Gomez, Sicong Huang, Ivan Zhang, Bryan M Li, Muhammad Osama, and Lukasz Kaiser. Unsupervised cipher cracking using discrete gans. arXiv preprint arXiv:1801.04883, 2018.
139
+
140
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Z. Ghahramani, M. Welling, C. Cortes, N. D. Lawrence, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 27, pp. 2672–2680. Curran Associates, Inc., 2014. URL http://papers. nips.cc/paper/5423-generative-adversarial-nets.pdf.
141
+
142
+ Christine Grienberger and Arthur Konnerth. Imaging calcium in neurons. Neuron, 73(5):862–885, 2012.
143
+
144
+ Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron C Courville. Improved training of wasserstein gans. In Advances in neural information processing systems, pp. 5767–5777, 2017.
145
+
146
+ Kenneth D Harris, Rodrigo Quian Quiroga, Jeremy Freeman, and Spencer L Smith. Improving data quality in neuronal population recordings. Nature neuroscience, 19(9):1165, 2016.
147
+
148
+ Julia U Henschke, Evelyn Dylda, Danai Katsanevaki, Nathalie Dupuy, Stephen P Currie, Theoklitos Amvrosiadis, Janelle MP Pakan, and Nathalie L Rochefort. Reward association enhances stimulus-specific representations in primary visual cortex. Current Biology, 2020.
149
+
150
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015.
151
+
152
+ Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. arXiv preprint arXiv:1710.10196, 2017.
153
+
154
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
155
+
156
+ Dmitry R Lyamzin, Jakob H Macke, and Nicholas A Lesica. Modeling population spike trains with specified time-varying spike rates, trial-to-trial variability, and pairwise signal and noise correlations. Frontiers in computational neuroscience, 4:144, 2010.
157
+
158
+ Jakob H Macke, Philipp Berens, Alexander S Ecker, Andreas S Tolias, and Matthias Bethge. Generating spike trains with specified correlation coefficients. Neural computation, 21(2):397–423, 2009.
159
+
160
+ Chris J. Maddison, Andriy Mnih, and Yee Whye Teh. The concrete distribution: A continuous relaxation of discrete random variables, 2016.
161
+
162
+ Xudong Mao, Qing Li, Haoran Xie, Raymond YK Lau, Zhen Wang, and Stephen Paul Smolley. Least squares generative adversarial networks. In Proceedings of the IEEE international conference on computer vision, pp. 2794–2802, 2017.
163
+
164
+ Paulius Micikevicius, Sharan Narang, Jonah Alben, Gregory Diamos, Erich Elsen, David Garcia, Boris Ginsburg, Michael Houston, Oleksii Kuchaiev, Ganesh Venkatesh, et al. Mixed precision training. arXiv preprint arXiv:1710.03740, 2017.
165
+
166
+ Mehdi Mirza and Simon Osindero. Conditional generative adversarial nets. arXiv preprint arXiv:1411.1784, 2014.
167
+
168
+ Manuel Molano-Mazon, Arno Onken, Eugenio Piasini\*, and Stefano Panzeri\*. Synthesizing realistic neural population activity patterns using generative adversarial networks. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum? id=r1VVsebAZ.
169
+
170
+ Augustus Odena, Vincent Dumoulin, and Chris Olah. Deconvolution and checkerboard artifacts. Distill, 2016. doi: 10.23915/distill.00003. URL http://distill.pub/2016/ deconv-checkerboard.
171
+
172
+ Janelle MP Pakan, Stephen P Currie, Lukas Fischer, and Nathalie L Rochefort. The impact of visual cues, reward, and motor feedback on the representation of behaviorally relevant spatial locations in primary visual cortex. Cell reports, 24(10):2521–2528, 2018.
173
+
174
+ Poornima Ramesh, Mohamad Atayi, and Jakob H Macke. Adversarial training of neural encoding models on population spike trains. 2019.
175
+
176
+ Hernan Gonzalo Rey, Carlos Pedreira, and Rodrigo Quian Quiroga. Past, present and future of spike sorting techniques. Brain research bulletin, 119:106–117, 2015.
177
+
178
+ MCW van Rossum. A novel spike distance. Neural computation, 13(4):751–763, 2001.
179
+
180
+ Shreya Saxena and John P. Cunningham. Towards the neural population doctrine, 2019. ISSN 18736882.
181
+
182
+ Elad Schneidman, Michael J Berry, Ronen Segev, and William Bialek. Weak pairwise correlations imply strongly correlated network states in a neural population. Nature, 440(7087):1007–1012, 2006.
183
+
184
+ Benjamin Staude, Stefan Rotter, and Sonja Grun. Cubic: cumulant based inference of higher-order ¨ correlations in massively parallel spike trains. Journal of computational neuroscience, 29(1-2): 327–350, 2010.
185
+
186
+ Ian H. Stevenson and Konrad P. Kording. How advances in neural recording affect data analysis. Nature Neuroscience, 14(2):139–142, feb 2011. ISSN 1097-6256. doi: 10.1038/nn.2731. URL http://www.nature.com/articles/nn.2731.
187
+
188
+ Carsen Stringer, Michalis Michaelos, and Marius Pachitariu. High precision coding in visual cortex. bioRxiv, 2019. doi: 10.1101/679324. URL https://www.biorxiv.org/content/ early/2019/11/04/679324.
189
+
190
+ Gasper Tka ˇ cik, Olivier Marre, Dario Amodei, Elad Schneidman, William Bialek, and Michael J ˇ Berry II. Searching for collective behavior in a large network of sensory neurons. PLoS Comput Biol, 10(1):e1003408, 2014.
191
+
192
+ Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
193
+
194
+ Yizhe Zhang, Zhe Gan, Kai Fan, Zhi Chen, Ricardo Henao, Dinghan Shen, and Lawrence Carin. Adversarial feature matching for text generation. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 4006–4015. JMLR. org, 2017.
195
+
196
+ Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In Proceedings of the IEEE international conference on computer vision, pp. 2223–2232, 2017.
197
+
198
+ # A APPENDIX
199
+
200
+ Table A.1: The generator (a) and discriminator (b) architecture of CalciumGAN. The generator consists of 4,375,740 parameters, and the discriminator consists of 4,110,273 parameters. Note bs denotes batch size.
201
+
202
+ <table><tr><td>Layer</td><td> Output shape</td></tr><tr><td>Input</td><td>(bs,32)</td></tr><tr><td>Dense</td><td>(bs,2048)</td></tr><tr><td>LeakyRelu</td><td>(bs,2048)</td></tr><tr><td>Reshape</td><td>(bs,64,32)</td></tr><tr><td>ConviDTransposed</td><td>(bs,128,320)</td></tr><tr><td>LayerNorm</td><td>(bs,128,320)</td></tr><tr><td>LeakyRelu</td><td>(bs,128,320)</td></tr><tr><td>Conv1DTransposed</td><td>(bs,256,256)</td></tr><tr><td>LayerNorm</td><td>(bs,256,256)</td></tr><tr><td>LeakyRelu</td><td>(bs,256,256)</td></tr><tr><td>Conv1DTransposed</td><td>(bs,512,192)</td></tr><tr><td>LayerNorm</td><td>(bs,512,192)</td></tr><tr><td>LeakyRelu</td><td>(bs,512,192)</td></tr><tr><td>Conv1DTransposed</td><td>(bs,1024, 128)</td></tr><tr><td>LayerNorm</td><td>(bs,1024, 128)</td></tr><tr><td>LeakyRelu</td><td>(bs,1024,128)</td></tr><tr><td>Conv1DTransposed</td><td>(bs,2048,102)</td></tr><tr><td>LayerNorm</td><td>(bs,2048,102)</td></tr><tr><td>LeakyRelu</td><td>(bs,2048,102)</td></tr><tr><td>Dense</td><td>(bs,2048,102)</td></tr><tr><td></td><td></td></tr><tr><td>Sigmoid</td><td>(bs,2048,102)</td></tr></table>
203
+
204
+ (a) Generator architecture
205
+
206
+ <table><tr><td>Layer Input</td><td>Output shape (bs,2048,102)</td></tr><tr><td>Conv1D LeakyRelu PhaseShuffle Conv1D LeakyRelu PhaseShuffle Conv1D LeakyRelu PhaseShuffle Conv1D LeakyRelu PhaseShuffle Conv1D LeakyRelu Flatten Dense</td><td>(bs,1024, 64) (bs,1024, 64) (bs,1024, 64) (bs,512, 128) (bs,512,128) (bs,512,128) (bs,256,192) (bs,256, 192) (bs,256,192) (bs,128,256) (bs, 128,256) (bs,128,256) (bs,64,320) (bs, 64,320) (bs,20480) (bs,1)</td></tr></table>
207
+
208
+ (b) Discriminator architecture
209
+
210
+ Table A.2: Hyperparamters of CalciumGAN.
211
+
212
+ <table><tr><td>Hyper-parameters</td><td>Value</td></tr><tr><td>Filters</td><td>64</td></tr><tr><td>Kernel size Stride</td><td>24 2</td></tr><tr><td>Noise dimension</td><td>32</td></tr><tr><td>Critic updates</td><td>5</td></tr><tr><td>Gradient penalty (入) Batch size (bs)</td><td>10</td></tr><tr><td></td><td>128</td></tr><tr><td>Epochs</td><td>400</td></tr><tr><td>Learning rate</td><td>0.0001</td></tr><tr><td>Phase shuffle (m)</td><td>10</td></tr></table>
213
+
214
+ <table><tr><td>Date</td><td>Duration</td><td></td><td>Num. trials|Avg. trial duration|Avg. firing rate</td><td></td></tr><tr><td>Day 1</td><td>894.73s</td><td>129</td><td>6.94s</td><td>58.07Hz</td></tr><tr><td>Day 4</td><td>898.45 s</td><td>203</td><td>4.43 s</td><td>35.83 Hz</td></tr></table>
215
+
216
+ Table A.3: Information about the neuron population of $N = 1 0 2$ neurons recorded at $2 4 \mathrm { H z }$ from the primary visual cortex of a behaving mouse on the $1 ^ { \mathrm { s t } }$ day and $4 ^ { \mathrm { t h } }$ day of the experiment.
217
+
218
+ ![](images/5b09d7388404fef7149bf2f9fa1725f7ec40b40248a7a362e9aabf2af54ff80e.jpg)
219
+ Figure A.1: Calcium signals and inferred spike trains (in gray) of randomly selected neurons. (a) shows the DG data (in blue) and (b) shows synthetic data (in orange) generated by CalciumGAN trained on the DG data. Notice that the artificial signal data transformed from DG spike data do not have the peak and decay characteristics of typical calcium imaging data. Note: the generated data do not incorporate the trial information, hence the generated traces do not correspond to the recorded signal in the plotted example.
220
+
221
+ # A.1 CALCIUMGAN PIPELINE
222
+
223
+ In order to train and evaluate our GAN model, we have to first pre-process the calcium signals so that they have a standardized format. For calcium imaging data of $N$ neurons with a recorded length of $L$ , we would receive a raw data shape of $( L , N )$ . We then used a slicing window of size $T$ to segment the data along the time dimension into $M$ segments (see Figure A.3), resulting in a matrix with shape $( M , T , N )$ . To improve the network training performance, we scale the raw calcium signals $x$ to the range $[ 0 , 1 ]$ before we train our generative model:
224
+
225
+ $$
226
+ x _ { [ 0 , 1 ] } = \frac { x - x _ { \operatorname* { m i n } } } { x _ { \operatorname* { m a x } } - x _ { \operatorname* { m i n } } }
227
+ $$
228
+
229
+ We use $a _ { [ 0 , 1 ] }$ to denote datum $a$ that has a range of $[ 0 , 1 ]$ .
230
+
231
+ After the above pre-processing step, we train CalciumGAN in mini-batches and store 1,000 samples for evaluation. Since we evaluate our model performance in terms of spike activities, we needed a deconvolution algorithm to infer the spike trains from calcium signals. In this work, we used the OASIS deconvolution algorithm (Friedrich et al., 2017) for its fast online deconvolution performance. Prior to inferring the spiking activities from the generated signals ${ \hat { x } } _ { [ 0 , 1 ] }$ , we first have to scale the signal back to the same range as the raw calcium signals:
232
+
233
+ $$
234
+ \hat { x } = \hat { x } _ { [ 0 , 1 ] } ( x _ { \mathrm { m a x } } - x _ { \mathrm { m i n } } ) + x _ { \mathrm { m i n } }
235
+ $$
236
+
237
+ We inferred the spike trains from the generated signals as well as the real recorded data with OASIS in order to ensure the possible biases of the deconvolution algorithm are the same for both data.
238
+
239
+ ![](images/98184a403dac0439a15f470d9223ba41099ff8faf323e9468b242d9567a90684.jpg)
240
+ Figure A.2: Pipeline diagram of a CalciumGAN analysis. White boxes illustrate data in different processing stages. Blue boxes illustrate analysis steps and techniques.
241
+
242
+ ![](images/0e3ffd565be4e4169c099e79f2f791dc141365eb691e6c1fc023d235314312ba.jpg)
243
+ Figure A.3: Illustration of the sliding window process. The light green and green boxes represent the window with sequence length $T$ along the temporal dimension of the calcium signals. We create our training and validation dataset using a window size of $T = 2 0 4 8$ and stride size of $s = 2$ .
244
+
245
+ # A.2 PHASE SHUFFLE
246
+
247
+ ![](images/e362c15c25f314024360e5a4e332519de1592d48445c51baec3b5ccd516f0bdb.jpg)
248
+ Figure A.4: Illustration of the 1-dimensional Phase Shuffle mechanism. Each box denotes an activated unit after a convolution layer, and the units are mirrored along the grey dash lines. The large box in light green represents the output of the Phase Shuffle layer with $n = - 2$ .
249
+
250
+ In order to reduce the effect of the ”checkerboard” artifact, we adapted the Phase Shuffle mechanism (see 2.1) in the discriminator. In this section we examine the effectiveness of Phase Shuffle in terms of the visual quality of the generated traces as well as the effect it had on the inferred spike trains. A common characteristic of the calcium indicators when an action potential occur is a sharp onset followed by a slow decay in the signal (Frohlich, 2016). In Figure A.5, we can see that ¨ such characteristic in the calcium traces were more prominent when Phase Shuffle was enabled. We believe that such differences in the generation quality exist mainly because of the repetitive patterns in the transposed convolution layer Odena et al. (2016), since the discriminator can simply distinguish generated samples from real samples by learning if such patterns exists. As the Phase Shuffle mechanism shifts the temporal dimension (by 10 units in our experiment) randomly, it forces the discriminator to learn from other features in the data instead of the ”shortcut” provided by the (undesired) nature of transposed convolution.
251
+
252
+ Moreover, not only did Phase Shuffle affect the visual quality of the generated samples, it also impacted the spike train statistics. The traces generated without Phase Shuffle lack the spiking characteristics, which made it more difficult for the deconvolution algorithm to register a spike in the data, thus increasing the inaccuracy of the inferred spike trains. When comparing the KL divergence of the spike train statistics, the samples generated without Phase Shuffle suffer worse results across the 3 statistics (see Table 1), especially with mean firing rate.
253
+
254
+ ![](images/0aefce070a3349cf29bba195ee69ff358dc86d37300119d1c150bf4b00072ee5.jpg)
255
+ Figure A.5: Generated traces of Neuron 6 from a randomly selected sample with (a) PhaseShuffle $=$ 10 and (b) PhaseShuffle $= 0$ . The sharp rise to peak followed by a tail of decaying signal is less observable in when Phase Shuffle is disabled.
256
+
257
+ # A.3 DAY 1 RECORDINGS
258
+
259
+ The following figures are the generated data and spike train statistics of CalciumGAN trained on the calcium imaging recordings collected on the first day of the mice experiment.
260
+
261
+ ![](images/2915c6489f07c550b03618d59709ac55a9455c6d24c0e3d6cb5f03b072b73722.jpg)
262
+ Figure A.6: Calcium signals and inferred spike trains (in gray) of randomly selected neurons. (a) shows the recorded data (in blue) and (b) shows synthetic data (in orange) generated by CalciumGAN trained on recorded data. Note: the generated data do not incorporate the trial information, hence the generated traces do not correspond to the recorded signal in the plotted example.
263
+
264
+ ![](images/2673aae1dc767eaae723a7e59d1ed5835007c5d5155887dd973435f36cbd85e1.jpg)
265
+ Figure A.7: Raster plot of inferred real and synthetic spike trains of a randomly selected sample generated by CalciumGAN trained on recorded data from the first day of the mice experiment.
266
+
267
+ ![](images/d13105eebd6103fab6520967ecbde86fa4b530eacf15e302ca0208c28518a729.jpg)
268
+ Figure A.8: First and second order statistics of data generated from CalciumGAN trained on the recorded data. Shown neurons and samples were randomly selected. (a) Mean firing rate distribution over 1000 samples per neuron. (b) Pearson correlation coefficient distribution. (c) van-Rossum distance between recorded and generated spike trains over 45 samples.
269
+
270
+ ![](images/6c491ebdcd2f0c76ee14eb7e472420fddfe18f8be96e2302b0c2304e93aba2b7.jpg)
271
+ Figure A.9: KL divergence of recorded data and generated data distributions. (a) mean firing rate of each neuron, (b) pairwise Pearson correlation coefficient and (c) pairwise van-Rossum distance. The mean KL divergence of each statistics are 0.3240, 0.0590 and 0.5106 respectively.
md/train/3AOj0RCNC2/3AOj0RCNC2.md ADDED
@@ -0,0 +1,417 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GRADIENT PROJECTION MEMORY FOR CONTINUAL LEARNING
2
+
3
+ Gobinda Saha, Isha Garg & Kaushik Roy School of Electrical and Computer Engineering, Purdue University gsaha@purdue.edu, gargi@purdue.edu, kaushik@purdue.edu
4
+
5
+ # ABSTRACT
6
+
7
+ The ability to learn continually without forgetting the past tasks is a desired attribute for artificial learning systems. Existing approaches to enable such learning in artificial neural networks usually rely on network growth, importance based weight update or replay of old data from the memory. In contrast, we propose a novel approach where a neural network learns new tasks by taking gradient steps in the orthogonal direction to the gradient subspaces deemed important for the past tasks. We find the bases of these subspaces by analyzing network representations (activations) after learning each task with Singular Value Decomposition (SVD) in a single shot manner and store them in the memory as Gradient Projection Memory (GPM). With qualitative and quantitative analyses, we show that such orthogonal gradient descent induces minimum to no interference with the past tasks, thereby mitigates forgetting. We evaluate our algorithm on diverse image classification datasets with short and long sequences of tasks and report better or on-par performance compared to the state-of-the-art approaches1.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Humans exhibit remarkable ability in continual adaptation and learning new tasks throughout their lifetime while maintaining the knowledge gained from past experiences. In stark contrast, Artificial Neural Networks (ANNs) under such Continual Learning (CL) paradigm (Ring, 1998; Thrun & Mitchell, 1995; Lange et al., 2021) forget the information learned in the past tasks upon learning new ones. This phenomenon is known as ‘Catastrophic Forgetting’ or ‘Catastrophic Interference’ (Mccloskey & Cohen, 1989; Ratcliff, 1990). The problem is rooted in the general optimization methods (Goodfellow et al., 2016) that are being used to encode input data distribution into the parametric representation of the network during training. Upon exposure to a new task, gradient-based optimization methods, without any constraint, change the learned encoding to minimize the objective function with respect to the current data distribution. Such parametric updates lead to forgetting.
12
+
13
+ Given a fixed capacity network, one way to address this problem is to put constraints on the gradient updates so that task specific knowledge can be preserved. To this end, Kirkpatrick et al. (2017), Zenke et al. (2017), Aljundi et al. (2018), Serra et al. (2018) add a penalty term to the objec- \` tive function while optimizing for new task. Such term acts as a structural regularizer and dictates the degree of stability-plasticity of individual weights. Though these methods provide resource efficient solution to the catastrophic forgetting problem, their performance suffer while learning longer task sequence and when task identity is unavailable during inference.
14
+
15
+ Approaches (Lopez-Paz & Ranzato, 2017; Chaudhry et al., 2019a) that store episodic memories of old data essentially solve an optimization problem with ‘explicit’ constraints on the new gradient directions so that losses for the old task do not increase. In Chaudhry et al. (2019b) the performance of old task is retained by taking gradient steps in the average gradient direction obtained from the new data and memory samples. To minimize interference, Farajtabar et al. (2020) store gradient directions (instead of data) of the old tasks and optimize the network in the orthogonal directions to these gradients for the new task, whereas Zeng et al. (2018) update gradients orthogonal to the old input directions using projector matrices calculated iteratively during training. However, these methods either compromise data privacy by storing raw data or utilize resources poorly, which limits their scalability.
16
+
17
+ In this paper, we address the problem of catastrophic forgetting in a fixed capacity network when data from the old tasks are not available. To mitigate forgetting, our approach puts explicit constraints on the gradient directions that the optimizer can take. However, unlike contemporary methods, we neither store old gradient directions nor store old examples for generating reference directions. Instead we propose an approach that, after learning each task, partitions the entire gradient space of the weights into two orthogonal subspaces: Core Gradient Space (CGS) and Residual Gradient Space (RGS) (Saha et al., 2020). Leveraging the relationship between the input and the gradient spaces, we show how learned representations (activations) form the bases of these gradient subspaces in both fully-connected and convolutional networks. Using Singular Value Decomposition (SVD) on these activations, we show how to obtain the minimum set of bases of the CGS by which past knowledge is preserved and learnability for the new tasks is ensured. We store these bases in the memory which we define as Gradient Projection Memory (GPM). In our method, we propose to learn any new task by taking gradient steps in the orthogonal direction to the space (CGS) spanned by the GPM. Our analysis shows that such orthogonal gradient descent induces minimum to no interference with the old learning, and thus effective in alleviating catastrophic forgetting. We evaluate our approach in the context of image classification with miniImageNet, CIFAR-100, PMNIST and sequence of 5-Datasets on a variety of network architectures including ResNet. We compare our method with related state-of-the-art approaches and report comparable or better classification performance. Overall, we show that our method is memory efficient and scalable to complex dataset with longer task sequence while preserving data privacy.
18
+
19
+ # 2 RELATED WORKS
20
+
21
+ Approaches to continual learning for ANNs can be broadly divided into three categories. In this section we present a detailed discussion on the representative works from each category, highlighting their contributions and differences with our approach.
22
+
23
+ Expansion-based methods: Methods in this category overcome catastrophic forgetting by dedicating different subsets of network parameters to each task. With no constraint on network architecture, Progressive Neural Network (PGN) (Rusu et al., 2016) preserves old knowledge by freezing the base model and adding new sub-networks with lateral connections for each new task. Dynamically Expandable Networks (DEN) (Yoon et al., 2018) either retrains or expands the network by splitting/duplicating important units on new tasks, whereas Sarwar et al. (2020) grow the network to learn new tasks while sharing part of the base network. Li et al. (2019) with neural architecture search (NAS) find optimal network structures for each sequential task. RCL (Xu & Zhu, 2018) adaptively expands the network at each layer using reinforcement learning, whereas APD (Yoon et al., 2020) additively decomposes the parameters into shared and task specific parameters to minimize the increase in the network complexity. In contrast, our method avoids network growth or expensive NAS operations and performs sequential learning within a fixed network architecture.
24
+
25
+ Regularization-based methods: These methods attempt to overcome forgetting in fixed capacity model through structural regularization which penalizes major changes in the parameters that were important for the previous tasks. Elastic Weight Consolidation (EWC) (Kirkpatrick et al., 2017) computes such importance from diagonal of Fisher information matrix after training, whereas Zenke et al. (2017) compute them during training based on loss sensitivity with respect to the parameters. Additionally, Aljundi et al. (2018) compute importance from sensitivity of model outputs to the inputs. Other methods, such as PackNet (Mallya & Lazebnik, 2018) uses iterative pruning to fully restrict gradient updates on important weights via binary mask, whereas HAT (Serra et al., 2018) \` identifies important neurons by learning attention masks that control gradient propagation in the individual parameters. Saha et al. (2020) using a PCA based pruning on activations (Garg et al., 2020) partition the parametric space of the weights (filters) into core and residual (filter) spaces after learning each task. The past knowledge is preserved in the frozen core space, whereas the residual space is updated when learning the next task. In contrast to these methods, we do not ascribe importance to or restrict the gradients of any individual parameters or filters. Rather we put constraints on the ‘direction’ of gradient descent.
26
+
27
+ Memory-based methods: Methods under this class mitigate forgetting by either storing a subset of (raw) examples from the past tasks in the memory for rehearsal (Robins, 1995; Rebuffi et al., 2017; Lopez-Paz & Ranzato, 2017; Chaudhry et al., 2019a;b; Riemer et al., 2019) or synthesizing old data from generative models to perform pseudo-rehearsal (Shin et al., 2017). For instance,
28
+
29
+ Gradient Episodic Memory (GEM) (Lopez-Paz & Ranzato, 2017) avoids interference with previous task by projecting the new gradients in the feasible region outlined by previous task gradients calculated from the samples of episodic memory. Averaged-GEM (A-GEM) (Chaudhry et al., 2019a) simplified this optimization problem to projection in one direction estimated by randomly selected samples from the memory. Guo et al. (2020) propose a unified view of episodic memory-based CL methods, that include GEM and A-GEM and improves performance over these methods utilizing loss-balancing update rule. Additionally, Experience Replay (ER) (Chaudhry et al., 2019b) and Meta-Experience Replay (MER) (Riemer et al., 2019) mitigate forgetting in online CL setup by jointly training on the samples from new tasks and episodic memory. All these methods, however, rely on the access to old data which might not be possible when users have concern over data privacy. Like all the memory-based methods we also use a storage unit which we call GPM. However, we do not save any raw data in GPM, thus satisfy data privacy criterion.
30
+
31
+ Our method is closely related to recently proposed Orthogonal Gradient Descent (OGD) (Farajtabar et al., 2020) and Orthogonal Weight Modulation (OWM) (Zeng et al., 2018). OGD stores a set of gradient directions in the memory for each task and minimizes catastrophic forgetting by taking gradient steps in the orthogonal directions for new tasks. In contrast to OGD, we compute and store the bases of core gradient space from network representations (activations) which reduces the memory requirement by orders of magnitude. Moreover, OGD is shown to work under locality assumption for small learning rates which limits its scalability in learning longer task sequences with complex dataset. Since our method does not use gradient directions (like OGD) to describe the core gradient spaces, we do not need to obey such assumptions, thus can use higher learning rates. On the other hand, OWM reduces forgetting by modifying the weights of the network in the orthogonal to the input directions of the past tasks. This is achieved by multiplying new gradients with projector matrices. These matrices are computed from the stored past projectors and the inputs with recursive least square (RLS) method at each training step. However, such an iterative method not only slows down the training process but also shows limited scalability in end-to-end task learning with modern network architectures. Like OWM, we aim to encode new learning in the orthogonal to the old input directions. In contrast to iterative projector computation in OWM, we identify a low-dimensional subspace in the gradient space analyzing the learned representations with SVD in one-shot manner at the end of each task. We store the bases of these subspaces in GPM and learn new tasks in the orthogonal to these spaces to protect old knowledge. We quantitatively show that our method is memory efficient, fast and scalable to deeper networks for complex long sequence of tasks.
32
+
33
+ # 3 NOTATIONS AND BACKGROUND
34
+
35
+ In this section, we introduce the notations used throughout the paper and give a brief overview of SVD for matrix approximation. In section 4, we establish the relationship between input and gradient spaces. In section 5 we show the steps of our algorithm that leverage such relationship.
36
+
37
+ Continual Learning: We consider supervised learning setup where $T$ tasks are learned sequentially. Each task has a task descriptor, $\tau \in \{ 1 , 2 . . . . , T \}$ with a corresponding dataset, $\begin{array} { r l } { \mathbb { D } _ { \tau } } & { { } = } \end{array}$ $\{ ( \stackrel { \cdot } { \mathbfit { x } _ { i , \tau } } , \pmb { y } _ { i , \tau } ) _ { i = 1 } ^ { n _ { \tau } } \}$ having $n _ { \tau }$ example pairs. Let’s consider an $L$ layer neural network where at each layer network computes the following function for task $\tau$ :
38
+
39
+ $$
40
+ \begin{array} { r } { \pmb { x } _ { i , \tau } ^ { l + 1 } = \sigma ( f ( \pmb { W } _ { \tau } ^ { l } , \pmb { x } _ { i , \tau } ^ { l } ) ) . } \end{array}
41
+ $$
42
+
43
+ Here, $l = 1 , . . . L , \sigma ( . )$ is a non-linear function and $f ( . , . )$ is a linear function. We will use vector notation for input $( { \pmb x } _ { i , \tau } )$ in fully connected layers and matrix notation for input $( X _ { i , \tau } )$ in convolutional layers. At the first layer, $\pmb { x } _ { i , \tau } ^ { 1 } = \pmb { x } _ { i , \tau }$ represents the raw input data from task $\tau$ , whereas in the subsequent layers we define $\mathbf { \Delta } \mathbf { x } _ { i , \tau } ^ { l }$ as the representation of input $\mathbf { \boldsymbol { x } } _ { i , \tau }$ at layer $l$ . Set of parameters of the network is defined by, $\mathbb { W } _ { \tau } = \{ ( \mathbf { W } _ { \tau } ^ { l } ) _ { l = 1 } ^ { L } \}$ , where $\mathbb { W } _ { 0 }$ denotes set of parameters at initialization.
44
+
45
+ Matrix approximation with SVD: SVD can be used to factorize a rectangular matrix, ${ \textbf { \em A } } =$ $U \Sigma V ^ { T } \ \in \mathbb { R } ^ { m \times n }$ into the product of three matrices, where $U \in \mathbb { R } ^ { m \times m }$ and $V \in \mathbb { R } ^ { n \times n }$ are orthogonal, and $\pmb { \Sigma }$ contains the sorted singular values along its main diagonal (Deisenroth et al., 2020). If the rank of the matrix is $r$ , $( r \leq \operatorname* { m i n } ( m , n ) )$ ), $\pmb { A }$ can be expressed as $\begin{array} { r } { \pmb { A } = \sum _ { i = 1 } ^ { r } \sigma _ { i } \pmb { u } _ { i } \pmb { v } _ { i } ^ { T } } \end{array}$ where $\mathbf { } u _ { i } \in U$ and $\mathbf { } v _ { i } \in V$ are left and right singular vectors and $\sigma _ { i } \in d i a g ( \Sigma )$ are singular values. Also, $k$ -rank approximation to this matrix can be expressed as, $\begin{array} { r } { { \pmb { A } } _ { k } = \sum _ { i = 1 } ^ { k } \sigma _ { i } { \pmb { u } } _ { i } { \pmb { v } } _ { i } ^ { T } } \end{array}$ , where $k \leq r$ and its value can be chosen by the smallest $k$ that satisfies $| | A _ { k } | | _ { F } ^ { 2 } \geq \epsilon _ { t h } | | A | | _ { F } ^ { 2 }$ . Here, $| | . | | _ { F }$ is the Frobenius norm of the matrix and $\epsilon _ { t h }$ $0 < \epsilon _ { t h } \le 1 _ { \AA }$ ) is the threshold hyperparameter.
46
+
47
+ ![](images/21158e43543f6c506d240b9ccf92fef6c44af6f597788f98d51da9162e9924a6.jpg)
48
+ Figure 1: Illustration of convolution operation in matrix multiplication format during (a) Forward Pass and (b) Backward Pass.
49
+
50
+ # 4 INPUT AND GRADIENT SPACES
51
+
52
+ Our algorithm leverages the fact that stochastic gradient descent (SGD) updates lie in the span of input data points (Zhang et al., 2017). In the following subsections we will establish this relationship for both fully connected and convolutional layers. The analysis presented in this section is generally applicable to any layer of the network for any task, and hence we drop the task and layer identifiers.
53
+
54
+ # 4.1 FULLY CONNECTED LAYER
55
+
56
+ Let’s consider a single layer linear neural network in supervised learning setup where each (input, label) training data pair comes from a training dataset, $\mathbb { D }$ . Let, $\pmb { x } \in \mathbb { R } ^ { n }$ is the input vector, $\pmb { y } \in \mathbb { R } ^ { m }$ is the label vector in the dataset and $\pmb { W } \in \mathbb { R } ^ { \bar { m } \times n }$ are the parameters (weights) of the network. The network is trained by minimizing the following mean-squared error loss function
57
+
58
+ $$
59
+ L = \frac { 1 } { 2 } | | \boldsymbol { W } \boldsymbol { x } - \boldsymbol { y } | | _ { 2 } ^ { 2 } .
60
+ $$
61
+
62
+ We can express gradient of this loss with respect to weights as
63
+
64
+ $$
65
+ \nabla _ { W } L = ( W x - y ) \mathbf { { x } } ^ { T } = \delta \mathbf { { x } } ^ { T } ,
66
+ $$
67
+
68
+ where $\pmb { \delta } \in \mathbb { R } ^ { m }$ is the error vector. Thus, the gradient update will lie in the span of input $( { \pmb x } )$ , where elements in $\pmb { \delta }$ scale the magnitude of $_ { \textbf { \em x } }$ by different factors. Here, we have considered perexample loss (batch size of 1) for simplicity. However, this relation also holds for mini-batch setting (see appendix B.1). The input-gradient relation in equation 3 is generically applicable to any fully connected layer of a neural network where $_ { \textbf { \em x } }$ is the input to that layer and $\delta$ is the error coming from the next layer. Moreover, this equation also holds for network with non-linear units (e.g. ReLU) and cross-entropy losses except the calculation of $\delta$ will be different.
69
+
70
+ # 4.2 CONVOLUTIONAL LAYER
71
+
72
+ Filters in a convolutional (Conv) layer operate in a different way on the inputs than the weights in a fully connected (FC) layer. Let’s consider a Conv layer with the input tensor $\mathcal { X } \in \mathbb { R } ^ { C _ { i } \times \smile h _ { i } \times w _ { i } }$ and filters $\mathcal { W } \in \bar { \mathbb { R } } ^ { C _ { o } \times C _ { i } \times k \times k }$ . Their convolution $\langle \mathcal { X } , \mathcal { W } , \ast \rangle$ produces output feature map, $\mathcal { O } \in$ $\mathbb { R } ^ { C _ { o } \times h _ { o } \times w _ { o } }$ (Liu et al., 2018). Here, $C _ { i }$ $\left( C _ { o } \right)$ denotes the number of input (output) channels of the Conv layer, $h _ { i } , w _ { i } \ ( h _ { o } , w _ { o } )$ denote the height and width of the input (output) feature maps and $k$ is the kernel size of the filters. As shown in Figure 1(a), if $\mathcal { X }$ is reshaped into a $( h _ { o } \times w _ { o } ) \times ( C _ { i } \times k \times k )$ matrix, $\boldsymbol { X }$ and $\mathcal { W }$ is reshaped into a $( C _ { i } \times k \times k ) \times C _ { o }$ matrix, $W$ , then the convolution can be expressed as matrix multiplication between $\boldsymbol { X }$ and $W$ as $O { = } X W$ , where ${ \cal O } \in \mathbb { R } ^ { ( h _ { 0 } \times w _ { 0 } ) \times C _ { o } }$ . Each row of $\boldsymbol { X }$ contains an input patch vector, $\pmb { p } _ { j } \in \mathbb { R } ^ { ( C _ { i } \times k \times k ) \times 1 }$ , where $j = 1 , 2 . . . , n$ ${ ' n = h _ { o } * w _ { o } }$ ).
73
+
74
+ Formulation of convolution in terms of matrix multiplication provides an intuitive picture of the gradient computation during backpropagation. Similar to the FC layer case, in Conv layer, during backward pass an error matrix $\pmb { \Delta }$ of size $\left( h _ { 0 } \times w _ { 0 } \right) \times C _ { o }$ (same size as $o$ ) is obtained from the next layer. As shown in Figure 1(b), the gradient of loss with respect to filter weights is calculated by
75
+
76
+ $$
77
+ \nabla _ { W } L = X ^ { T } \Delta ,
78
+ $$
79
+
80
+ where, $\nabla _ { W } L$ is of shape $( C _ { i } \times k \times k ) \times C _ { o }$ (same size as $W$ ). Since, columns of $X ^ { T }$ are the input patch vectors $( p )$ , the gradient updates of the convolutional filters will lie in the space spanned by these patch vectors.
81
+
82
+ # 5 CONTINUAL LEARNING WITH GRADIENT PROJECTION MEMORY (GPM)
83
+
84
+ In this section, we describe our continual learning algorithm which leverages the relationship between gradient and input spaces to identify the core gradient spaces of the past tasks. We show how gradient descent orthogonal to these spaces enable us to learn continually without forgetting.
85
+
86
+ Learning Task 1: We learn the first task $\mathit { \check { \tau } } = 1$ ) using dataset, $\mathbb { D } _ { 1 }$ without imposing any constraint on parameter updates. At the end of Task 1, we obtain a learned set of parameters $\mathbb { W } _ { 1 }$ . To preserve the knowledge of the learned task, we impose constraints on the direction of gradient updates for the next tasks. To do so, we partition the entire gradient space into two (orthogonal) subspaces: Core Gradient Space (CGS) and Residual Gradient Space (RGS), such that gradient steps along CGS induce high interference on the learned tasks whereas gradient steps along RGS have minimum to no interference. We aim to find and store the bases of the CGS and take gradient steps orthogonal to the CGS for the next task. In our formulation, each layer has its own CGS.
87
+
88
+ To find the bases, after learning Task 1 , for each layer we construct a representation matrix, $[ \pmb { x } _ { 1 , 1 } ^ { l } , \pmb { x } _ { 2 , 1 } ^ { l } , . . . , \pmb { x } _ { n _ { s } , 1 } ^ { l } ]$ (for Conv layers $\pmb { R } _ { 1 } ^ { l } = [ ( \pmb { X } _ { 1 , 1 } ^ { \bar { l } } ) ^ { T } , ( \pmb { X } _ { 2 , 1 } ^ { l } ) ^ { T } , . . . , ( \hat { \pmb { X } } _ { n _ { s } , 1 } ^ { l } ) ^ { T } ]$ 1) concatenating $R _ { 1 } ^ { l } =$ $n _ { s }$ representations along the column obtained from forward pass of $n _ { s }$ random samples from the current training dataset through the network. Next, we perform SVD on $R _ { 1 } ^ { l } = U _ { 1 } ^ { l } \Sigma _ { 1 } ^ { l } ( \dot { V } _ { 1 } ^ { l } ) ^ { T }$ followed by its $k$ -rank approximation $( R _ { 1 } ^ { l } ) _ { k }$ according to the following criteria for the given threshold, $\epsilon _ { t h } ^ { l }$ :
89
+
90
+ $$
91
+ | | ( { \pmb R } _ { 1 } ^ { l } ) _ { k } | | _ { F } ^ { 2 } \geq \epsilon _ { t h } ^ { l } | | { \pmb R } _ { 1 } ^ { l } | | _ { F } ^ { 2 } .
92
+ $$
93
+
94
+ We define the space, $S ^ { l } = s p a n \{ \pmb { u } _ { 1 , 1 } ^ { l } , \pmb { u } _ { 2 , 1 } ^ { l } , . . . , \pmb { u } _ { k , 1 } ^ { l } \}$ , spanned by the first $k$ vectors in $U _ { 1 } ^ { l }$ as the space of significant representation for task 1 at layer $l$ since it contains all the directions with highest singular values in the representation. For the next task, we aim to take gradient steps in a way that the correlation between this task specific significant representation and the weights in each layer is preserved. Since, inputs span the space of gradient descent (section 4), the bases of $S ^ { l }$ will span a subspace in the gradient space which we define as the Core Gradient space (CGS). Thus gradient descent along CGS will cause maximum change in the input-weight correlation whereas gradient steps in the orthogonal directions to CGS (space of low representational significance) will induce very small to no interference to the old tasks. We define this subspace orthogonal to CGS as Residual Gradient space (RGS). We save the bases of the CGS in the memory, $\mathcal { M } = \{ ( M ^ { l } ) _ { l = 1 } ^ { L } \}$ , where $M ^ { l } = [ \pmb { u } _ { 1 , 1 } ^ { l } , \pmb { u } _ { 2 , 1 } ^ { l } , . . . , \pmb { u } _ { k , 1 } ^ { l } ]$ . We define this memory as Gradient Projection Memory (GPM).
95
+
96
+ Learning Task 2 to T: We learn task 2 with the examples from dataset $\mathbb { D } _ { 2 }$ only. Before taking gradient step, bases of the CGS are retrieved from GPM. New gradients $( \nabla _ { W _ { 2 } ^ { l } } L _ { 2 } )$ are first projected onto the CGS and then projected components are subtracted out from the new gradient so that remaining gradient components lie in the space orthogonal to CGS. Gradients are updated as
97
+
98
+ $$
99
+ \begin{array} { r l } { : } & { { } \nabla _ { W _ { 2 } ^ { l } } L _ { 2 } = \nabla _ { W _ { 2 } ^ { l } } L _ { 2 } - ( \nabla _ { W _ { 2 } ^ { l } } L _ { 2 } ) M ^ { l } ( M ^ { l } ) ^ { T } , } \end{array}
100
+ $$
101
+
102
+ At the end of the task 2 training, we update the GPM with new task-specific bases (of CGS). To obtain such bases, we construct $\mathbf { \bar { \mathbf { R } } } _ { 2 } ^ { l } = [ \mathbf { \dot { x } } _ { 1 , 2 } ^ { l } , \mathbf { x } _ { 2 , 2 } ^ { l } , . . . , \mathbf { x } _ { n _ { s } , 2 } ^ { l } ]$ using data from task 2 only. However, before performing SVD and subsequent $k$ -rank approximation, from $R _ { 2 } ^ { l }$ we eliminate the common directions (bases) that are already present in the GPM so that newly added bases are unique and orthogonal to the existing bases in the memory. To do so, we perform the following step :
103
+
104
+ $$
105
+ \hat { \pmb { R } } _ { 2 } ^ { l } = \pmb { R } _ { 2 } ^ { l } - \pmb { M } ^ { l } ( \pmb { M } ^ { l } ) ^ { T } ( \pmb { R } _ { 2 } ^ { l } ) = \pmb { R } _ { 2 } ^ { l } - \pmb { R } _ { 2 , P r o j } ^ { l } .
106
+ $$
107
+
108
+ Afterwards, SVD is performed on $\hat { \pmb { R } } _ { 2 } ^ { l } ( = \hat { U } _ { 2 } ^ { l } \hat { \pmb { \Sigma } } _ { 2 } ^ { l } ( \hat { V } _ { 2 } ^ { l } ) ^ { T } )$ and $k$ new orthogonal bases are chosen for minimum value of $k$ satisfying the following criteria for the given threshold, $\epsilon _ { t h } ^ { l }$ :
109
+
110
+ $$
111
+ | | R _ { 2 , p r o j } ^ { l } | | _ { F } ^ { 2 } + | | ( \hat { R } _ { 2 } ^ { l } ) _ { k } | | _ { F } ^ { 2 } \geq \epsilon _ { t h } ^ { l } | | R _ { 2 } ^ { l } | | _ { F } ^ { 2 } .
112
+ $$
113
+
114
+ GPM is updated by adding new bases as $M ^ { l } = [ M ^ { l } , \hat { \boldsymbol { u } } _ { 1 , 2 } ^ { l } , . . . , \hat { \boldsymbol { u } } _ { k , 2 } ^ { l } ]$ . Thus after learning each new task, CGS grows and RGS becomes smaller, where maximum size of $M ^ { l }$ (hence the dimension of the gradient bases) is fixed by the choice of initial network architecture. Once the GPM update is complete we move on to the next task and repeat the same procedure that we followed for task 2. The pseudo-code of the algorithm is given in Algorithm 1 in the appendix.
115
+
116
+ # 6 EXPERIMENTAL SETUP
117
+
118
+ Datasets: We evaluate our continual learning algorithm on Permuted MNIST (PMNIST) (Lecun et al., 1998), 10-Split CIFAR-100 (Krizhevsky, 2009), 20-Spilt miniImageNet (Vinyals et al., 2016) and sequence of 5-Datasets (Ebrahimi et al., 2020b). The PMNIST dataset is a variant of MNIST dataset where each task is considered as a random permutation of the original MNIST pixels. For PMNIST, we create 10 sequential tasks using different permutations where each task has 10 classes (Ebrahimi et al., 2020a). The 10-Split CIFAR-100 is constructed by splitting 100 classes of CIFAR-100 into 10 tasks with 10 classes per task. Whereas, 20-Spilt miniImageNet, used in (Chaudhry et al., 2019a), is constructed by splitting 100 classes of miniImageNet into 20 sequential tasks where each task has 5 classes. Finally, we use a sequence of 5-Datasets including CIFAR10, MNIST, SVHN (Netzer et al., 2011), notMNIST (Bulatov, 2011) and Fashion MNIST (Xiao et al., 2017), where classification on each dataset is considered as a task. In our experiments we do not use any data augmentation. The dataset statistics are given in Table 4 & 5 in the appendix.
119
+
120
+ Network Architecture: We use fully-connected network with two hidden layer of 100 units each for PMNIST following Lopez-Paz & Ranzato (2017). For experiments with split CIFAR-100 we use a 5-layer AlexNet similar to Serra et al. (2018). For split miniImageNet and 5-Datasets, similar \` to Chaudhry et al. (2019b), we use a reduced ResNet18 architecture. No bias units are used and batch normalization parameters are learned for the first task and shared with all the other tasks (following Mallya & Lazebnik (2018)). Details on architectures are given in the appendix section C.2. For permuted MNIST, we evaluate and compare our algorithm in ‘single-head’ setting (Hsu et al., 2018; Farquhar & Gal, 2018) where all tasks share the final classifier layer and inference is performed without task hint. For all other experiments, we evaluate our algorithm in ‘muti-head’ setting, where each task has a separate classifier on which no gradient constraint is imposed during learning.
121
+
122
+ Baselines: We compare our method with state-of-the art approaches from both memory based and regularization based methods that consider sequential task learning in fixed network architecture. From memory based approach, we compare with Experience Replay with reservoir sampling (ER Res) (Chaudhry et al., 2019b), Gradient Episodic Memory (GEM) (Lopez-Paz & Ranzato, 2017), Averaged GEM (A-GEM) (Chaudhry et al., 2019a), Orthogonal Gradient Descent (OGD) (Farajtabar et al., 2020) and Orthogonal Weight Modulation (OWM) (Zeng et al., 2018). Moreover, we compare with sate-of-the-art HAT (Serra et al., 2018) baseline and Elastic Weight \` Consolidation (EWC) (Kirkpatrick et al., 2017) from regularization based methods. Additionally, we add ‘multitask’ baseline where all the tasks are learned jointly using the entire dataset at once in a single network. Multitask is not a continual learning strategy but will serve as upper bound on average accuracy on all tasks. Details on the implementation along with the hyperparameters considered for each of these baselines are provided in section C.4 and Table 6 in the appendix.
123
+
124
+ Training Details: We train all the models with plain stochastic gradient descent (SGD). For each task in PMNIST and split miniImageNet we train the network for 5 and 10 epochs respectively with batch size of 10. In Split CIFAR-100 and 5-Datasets experiments, we train each task for maximum of 200 and 100 epochs respectively with the early termination strategy based on the validation loss as proposed in Serra et al. (2018). For both datasets, batch size is set to 64. For GEM, A-GEM \` and ER Res the episodic memory size is chosen to be approximately the same size as the maximum GPM size (GPM Max). Calculation of GPM size is given in Table 7 in the appendix. Moreover, selection of the threshold values $( \epsilon _ { t h } )$ in our method is discussed in section C.5 in the appendix.
125
+
126
+ Performance Metrics: To evaluate the classification performance, we use the ACC metric, which is the average test classification accuracy of all tasks. To measure the forgetting we report backward transfer, BWT which indicates the influence of new learning on the past knowledge. For instance, negative BWT indicates (catastrophic) forgetting. Formally, ACC and BWT are defined as:
127
+
128
+ $$
129
+ \mathsf { A C C } = \frac { 1 } { T } \sum _ { i = 1 } ^ { T } R _ { T , i } , \quad \mathsf { B W T } = \frac { 1 } { T - 1 } \sum _ { i = 1 } ^ { T - 1 } R _ { T , i } - R _ { i , i } .
130
+ $$
131
+
132
+ Here, $T$ is the total number of sequential tasks and $R _ { T , i }$ is the accuracy of the model on $i ^ { t h }$ task after learning the $T ^ { t h }$ task sequentially (Lopez-Paz & Ranzato, 2017).
133
+
134
+ # 7 RESULTS AND DISCUSSIONS
135
+
136
+ Single-head inference with PMNIST: First, we evaluate our algorithm in single-head setup for 10 sequential PMNIST tasks. In this setup task hint is not necessary. As HAT cannot perform inference without task hint, it is not included in the comparison. Since network size is very small (0.1M parameters) with $8 7 \%$ parameters in the first layer, we choose threshold value $( \epsilon _ { t h } )$ of 0.95 for that layer and 0.99 for the other layers to ensure better learnability. From the results, shown in Table 1(a), we observe that our method (GPM) achieves best average accuracy $( 9 3 . 9 1 \pm 0 . 1 6 \% )$ . In addition, we achieve least amount of forgetting, except OWM, which essentially trades off accuracy to minimize forgetting. Figure 2(a) compares the memory utilization of all the memory-based approaches. While OWM, GEM, A-GEM and ER Res use memory of size of GPM Max, we obtain better performance by using only $6 9 \%$ of the GPM Max. Moreover, compared to OGD, we use about 400 times lower memory and achieve $\sim 1 0 \%$ better accuracy. In Figure 2(b), we compare the per epoch training time of different memory based methods and found our method to be the fastest primarily due to the precomputation of the reference gradient bases (of CGS). Additionally, in single-epoch setting (Lopez-Paz & Ranzato, 2017), as shown in Table 8 in the appendix, we obtain best average accuracy $( 9 1 . 7 4 \pm 0 . 1 5 \%$ ), which demonstrates the potential for our algorithm in online CL setup.
137
+
138
+ ![](images/27388211152f60f2b5b14b7fc2f49cd64cddab83d26928a2e937504761256f79.jpg)
139
+ Figure 2: (a) Memory utilization and (b) per epoch training time for PMNIST tasks for different methods. Memory utilization for different approaches for (c) CIFAR-100, (d) miniImageNet and (e) 5-Datasets tasks. For memory, size of GPM Max and for time, method with highest complexity is used as references (value of 1). All the other methods are reported relative to these references.
140
+
141
+ Table 1: Continual learning on different datasets. Methods that do not adhere to CL setup is indicated by $( ^ { * } )$ . All the results are (re) produced by us and averaged over 5 runs. Standard deviations are reported in Table 8 and 9 in the appendix.
142
+
143
+ <table><tr><td colspan="3">(a)</td></tr><tr><td rowspan="2">Methods</td><td>PMNIST</td><td></td></tr><tr><td>ACC (%)</td><td>BWT</td></tr><tr><td>OGD</td><td>82.56</td><td>- 0.14</td></tr><tr><td>OWM</td><td>90.71</td><td>- 0.01</td></tr><tr><td>GEM</td><td>83.38</td><td>- 0.15</td></tr><tr><td>A-GEM</td><td>83.56</td><td>- 0.14</td></tr><tr><td>ER_Res</td><td>87.24</td><td>- 0.11</td></tr><tr><td>EWC</td><td>89.97</td><td>-0.04</td></tr><tr><td>GPM (ours)</td><td>93.91</td><td>-0.03</td></tr><tr><td>Multitask*</td><td>96.70</td><td>-</td></tr></table>
144
+
145
+ <table><tr><td colspan="7">(b)</td></tr><tr><td></td><td colspan="2">CIFAR-100</td><td colspan="2">miniImageNet</td><td colspan="2">5-Datasets</td></tr><tr><td>Methods</td><td>ACC (%)</td><td>BWT</td><td>ACC (%)</td><td>BWT</td><td>ACC (%)</td><td>BWT</td></tr><tr><td>OWM</td><td>50.94</td><td>- 0.30</td><td>=</td><td>=</td><td>=</td><td>=</td></tr><tr><td>EWC</td><td>68.80</td><td>-0.02</td><td>52.01</td><td>-0.12</td><td>88.64</td><td>-0.04</td></tr><tr><td>HAT</td><td>72.06</td><td>- 0.00</td><td>59.78</td><td>-0.03</td><td>91.32</td><td>-0.01</td></tr><tr><td>A-GEM</td><td>63.98</td><td>- 0.15</td><td>57.24</td><td>-0.12</td><td>84.04</td><td>-0.12</td></tr><tr><td>ER_Res</td><td>71.73</td><td>- 0.06</td><td>58.94</td><td>-0.07</td><td>88.31</td><td>- 0.04</td></tr><tr><td>GPM (ours)</td><td>72.48</td><td>-0.00</td><td>60.41</td><td>-0.00</td><td>91.22</td><td>- 0.01</td></tr><tr><td>Multitask*</td><td>79.58</td><td>-</td><td>69.46</td><td>-</td><td>91.54</td><td>-</td></tr></table>
146
+
147
+ Split CIFAR-100: Next, we switch to multi-head setup which enables us to compare with strong baselines such as HAT. For ten split CIFAR-100 tasks, as shown in Table 1(b), we outperform all the memory based approaches while using $4 5 \%$ less memory (Figure 2(c)). We also outperform EWC and our accuracy is marginally better than HAT while achieving zero forgetting. Also, we obtain $\sim 2 0 \%$ better accuracy than OWM, which have high forgetting $( \mathbf { B } \mathbf { W } \mathbf { T } { = } { - } 0 . 3 0 )$ thus demonstrating its limited scalability to convolutional architectures.
148
+
149
+ Split miniImageNet: With this experiment, we test the scalability of our algorithm to deeper network (ResNet18) for long task sequence from miniImageNet dataset. The average accuracies for different methods after learning 20 sequential tasks are given in Table 1(b). Again, in this case we outperform A-GEM, ER Res and EWC using $7 6 \%$ of the GPM Max (Figure 2(d)). Also, we achieve marginally better accuracy than HAT, however unlike HAT (and other methods) we completely avoid forgetting $( \mathbf { B } \mathbf { W } \mathbf { T } { = } 0 . 0 0 ) ,$ . Moreover, compared other methods sequential learning in our method is more stable, which means accuracy of the past tasks have minimum to no degradation over the course of learning (shown for task 1 accuracy in Figure 4 in the appendix).
150
+
151
+ 5-Datasets: Next, we validate our approach on learning across diverse datasets, where classification on each dataset is treated as one task. Even in this challenging setting, as shown in in Table 1(b), we achieve better accuracy $( 9 1 . 2 2 \pm 0 . 2 0 \% )$ ) then A-GEM, ER Res and EWC utilizing $7 8 \%$ of the GPM Max (Figure 2(e)). Though, HAT performs marginally better than our method, both HAT and we achieve the lowest BWT (-0.01). In this experiment, we have used tasks that are less related to each other. After learning 5 such tasks $78 \%$ of the gradient space is already constrained. Which implies, if the tasks are less or non-similar, GPM will get populated faster and reach to its maximum capacity after which no new learning will be possible. Since, we use a fixed capacity network and the size of GPM is determined by the network architecture, the ability of learning sequences of hundreds of such tasks with our method will be limited by the chosen network capacity.
152
+
153
+ Table 2: Total wall-clock training time measured on a single GPU after learning all the tasks. (a) (b)
154
+
155
+ <table><tr><td rowspan=1 colspan=1>(a)</td></tr><tr><td rowspan=1 colspan=1>Training Time [s]Methods PMNIST</td></tr><tr><td rowspan=1 colspan=1>OGD 1658</td></tr><tr><td rowspan=1 colspan=1>OWM 396</td></tr><tr><td rowspan=1 colspan=1>GEM 1639</td></tr><tr><td rowspan=1 colspan=1>A-GEM 445</td></tr><tr><td rowspan=1 colspan=1>ER_Res 259</td></tr><tr><td rowspan=1 colspan=1>EWC 645</td></tr><tr><td rowspan=1 colspan=1>GPM (ours) 245</td></tr></table>
156
+
157
+ <table><tr><td></td><td colspan="3">Training Time [s]</td></tr><tr><td>Methods</td><td>CIFAR-100</td><td>miniImageNet</td><td>5-Datasets</td></tr><tr><td>OWM</td><td>1856</td><td>1</td><td>1</td></tr><tr><td>EWC</td><td>1352</td><td>4138</td><td>7613</td></tr><tr><td>HAT</td><td>1248</td><td>3077</td><td>7246</td></tr><tr><td>A-GEM</td><td>2678</td><td>6069</td><td>12077</td></tr><tr><td>ER_Res</td><td>1147</td><td>2775</td><td>7015</td></tr><tr><td>GPM (ours)</td><td>770</td><td>3387</td><td>5008</td></tr></table>
158
+
159
+ Table 3: Continual learning of 20-task from CIFAR-100 Superclass dataset. (†) denotes the result reported from APD. $( ^ { * } )$ indicates the methods that do not adhere to CL setup. Single-task learning (STL), where a separate network in trained for each task, serves as an upper bound on accuracy.
160
+
161
+ <table><tr><td></td><td colspan="6">Methods</td></tr><tr><td>Metric</td><td>STL+*</td><td>PGNt</td><td>DEN†</td><td>RCL†</td><td>APDt</td><td>GPM (ours)</td></tr><tr><td>ACC (%)</td><td>61.00</td><td>50.76</td><td>51.10</td><td>51.99</td><td>56.81</td><td>57.72</td></tr><tr><td>Capacity (%)</td><td>2000</td><td>271</td><td>191</td><td>184</td><td>130</td><td>100</td></tr></table>
162
+
163
+ Training Time. Table 2 shows the total training time for all the sequential tasks for different algorithms. This includes time spent for memory management for the memory-based methods, fisher importance calculation for EWC and learning activation masks for HAT. Details of time measurement are given in appendix section C.6. For PMNIST, CIFAR-100, and 5-dataset tasks our algorithm trains faster than all the other baselines while spending only $0 . 2 \%$ , $3 \%$ and $6 \%$ of its total training time in GPM update (using SVD) respectively. Since each miniImageNet tasks are trained for only 10 epochs, our method have relatively higher overhead $3 0 \%$ of the total time) due to GPM update, thus runs a bit slower than the fastest ER Res. Overall, our formulation uses GPM bases and projection matrices of reasonable dimensions (see appendix section C.8); precomputation of which at the start of each task leads to fast per-epoch training. This gain in time essentially compensates for the extra time required for the GPM update, which is done only once per task, enabling fast training.
164
+
165
+ Comparison with Expansion-based methods. To compare our method with the state-of-the-art expansion based methods we perform experiment with 20-task CIFAR-100 Superclass dataset (Yoon et al., 2020). In this experiment, each task contains 5 different but semantically related classes from CIFAR-100 dataset. Similar to APD, here we use the LeNet-5 architecture. Details of architecture and training setup are given in appendix section C.3. Results are shown in Table 3 where ACC represents average accuracy over 5 different task sequences (used in APD) and Capacity denotes percentage of network capacity used with respect to the original network. We outperform all the CL methods achieving best average accuracy $( 5 7 . 7 2 \pm 0 . 3 7 \% )$ with BWT of -0.01 using the smallest network. For instance, we outperform RCL and APD utilizing $8 4 \%$ and $3 0 \%$ fewer network parameters respectively, which shows that our method induces more sharing between tasks.
166
+
167
+ Overall, we outperform the memory-based methods with less memory utilization, achieve better accuracy than expansion-based methods using smaller network, and obtain better or on-par performance compared to HAT in the given experimental setups. However, in the class-incremental learning setup (Rebuffi et al., 2017), method (Kamra et al., 2017) that uses data replay achieves better performance than GPM (see experiment in appendix section D.3). In this setup, we believe a subset of old data replay either from storage or via generation is inevitable for attaining better performance with minimal forgetting (Rajasegaran et al., 2019). In that quest, a hybrid approach such as combining GPM with small data replay would be an interesting direction for future exploration.
168
+
169
+ ![](images/2597dc15cb689d2d5bcad1b7874ccb3bd52709bbd6432a27cfea3e8c69e122a7.jpg)
170
+ Figure 3: Histograms of interference activations as a function of threshold, $( \epsilon _ { t h } )$ at (a) Conv layer 2 (b) FC layer 2 for split CIFAR-100 tasks. (c) Impact of $\epsilon _ { t h }$ on ACC $( \% )$ and $B W \mathrm { T } ( \% )$ . With increasing value of $\epsilon _ { t h }$ , spread of interference reduces, which improves accuracy and reduces forgetting.
171
+
172
+ Controlling Forgetting: Finally, we discuss the factors that implicitly or explicitly control the amount of forgetting in our algorithm. As discussed in section 5, we propose to minimize interference by taking gradient steps orthogonal to the CGS, where CGS bases are computed such that space of significant representations of the past tasks can be well approximated by these bases. The degree of this approximation is controlled by the threshold hyperparameter, $\epsilon _ { t h }$ (through equation 5, 9). For instance, a low value of $\epsilon _ { t h }$ (closer to 0) would allow the optimizer to change the weights along the directions where past data has higher representational significance, thereby significantly altering the past input-weight correlation inducing (catastrophic) interference. On the other hand, a high value of $\epsilon _ { t h }$ (closer to 1) would preserve such correlation, however learnability of the new task might suffer due to high volume of constraints in the gradient space. Therefore, in our continual learning algorithm, $\epsilon _ { t h }$ mediates the stability-plasticity dilemma. To show this analytically, let’s consider a network after learning $T$ sequential tasks with weights of the network at any layer, $l$ expressed as :
173
+
174
+ $$
175
+ \mathbf { \Delta } W _ { T } ^ { l } = W _ { 1 } ^ { l } + \sum _ { i = 1 } ^ { T - 1 } \Delta W _ { i i + 1 } ^ { l } = W _ { 1 } ^ { l } + \Delta W _ { 1 T } ^ { l } .
176
+ $$
177
+
178
+ Here, $\pmb { W } _ { 1 } ^ { l }$ is the weights after task 1 and $\Delta W _ { 1 T } ^ { l }$ is the change of weights from task 1 to $\mathrm { T }$ . Weight update with our method ensures that $\Delta { W _ { 1 T } ^ { l } }$ lie in the orthogonal space of the data (representations) of task 1. Linear operation at layer $l$ with data from task 1 $( { \pmb x } _ { 1 } )$ would produce: $\pmb { W } _ { T } ^ { l } \pmb { x } _ { 1 } ^ { l } = \pmb { W } _ { 1 } ^ { l } \pmb { x } _ { 1 } ^ { l } + \Delta \pmb { W } _ { 1 T } ^ { l } \pmb { x } _ { 1 } ^ { l }$ . If $\Delta { W } _ { 1 T } ^ { l } \pmb { x } _ { 1 } ^ { l ^ { \prime } } = 0$ , then the output of the network for task 1 data after learning task $T$ will be the same as the output after learning task 1 (i.e. $\pmb { W } _ { T } ^ { l } \pmb { x } _ { 1 } ^ { l } = \pmb { W } _ { 1 } ^ { l } \pmb { x } _ { 1 } ^ { l } )$ , that means no interference for task 1. We define $\Delta W _ { 1 T } ^ { l } \pmb { x } _ { 1 } ^ { l }$ as the interference activation for task 1 at layer $l$ (for any task, $\tau < T$ : $\Delta W _ { \tau T } ^ { l } \mathbf { x } _ { \tau } ^ { l } )$ . As discussed above, degree of such interference is dictated by $\epsilon _ { t h }$ . Figure 3(a)-(b) (and Figure 5 in appendix) show histograms (distributions) of interference activations at each layer of the network for split CIFAR-100 experiment. For lower value of $\epsilon _ { t h }$ , these distributions have higher variance (spread) implying high interference, whereas with increasing value of $\epsilon _ { t h }$ , the variance reduces around the (zero) mean value. As a direct consequence, as shown in Figure 3(c), backward transfer reduces for increasing $\epsilon _ { t h }$ with improvement in accuracy.
179
+
180
+ # 8 CONCLUSION
181
+
182
+ In this paper we propose a novel continual learning algorithm that finds important gradient subspaces for the past tasks and minimizes catastrophic forgetting by taking gradient steps orthogonal to these subspaces when learning a new task. We show how to analyse the network representations to obtain minimum number of bases of these subspaces by which past information is preserved and learnability for the new tasks is ensured. Evaluation on diverse image classification tasks with different network architectures and comparisons with state-of-the-art algorithms show the effectiveness of our approach in achieving high classification performance while mitigating forgetting. We also show our algorithm is fast, makes efficient use of memory and is capable of learning long sequence of tasks in deeper networks preserving data privacy.
183
+
184
+ # ACKNOWLEDGMENTS
185
+
186
+ This work was supported in part by the National Science Foundation, Vannevar Bush Faculty Fellowship, Army Research Office, MURI, and by Center for Brain Inspired Computing (C-BRIC), one of six centers in JUMP, a Semiconductor Research Corporation program sponsored by DARPA.
187
+
188
+ # REFERENCES
189
+
190
+ Rahaf Aljundi, Francesca Babiloni, Mohamed Elhoseiny, Marcus Rohrbach, and Tinne Tuytelaars. Memory aware synapses: Learning what (not) to forget. In The European Conference on Computer Vision (ECCV), pp. 139–154, 2018.
191
+
192
+ Mehdi Abbana Bennani, Thang Doan, and Masashi Sugiyama. Generalisation guarantees for continual learning with orthogonal gradient descent. ArXiv, abs/2006.11942, 2020.
193
+
194
+ Yaroslav Bulatov. Notmnist dataset. Google (Books/OCR), Tech. Rep.[Online], 2011. URL http: //yaroslavvb.blogspot.it/2011/09/notmnist-dataset.html.
195
+
196
+ Arslan Chaudhry, Marc’Aurelio Ranzato, Marcus Rohrbach, and Mohamed Elhoseiny. Efficient lifelong learning with A-GEM. In International Conference on Learning Representations, 2019a.
197
+
198
+ Arslan Chaudhry, Marcus Rohrbach, Mohamed Elhoseiny, Thalaiyasingam Ajanthan, Puneet K. Dokania, Philip H. S. Torr, and Marc’Aurelio Ranzato. Continual learning with tiny episodic memories. ArXiv, abs/1902.10486, 2019b.
199
+
200
+ Marc Peter Deisenroth, A. Aldo Faisal, and Cheng Soon Ong. Mathematics for Machine Learning. Cambridge University Press, 2020.
201
+
202
+ Sayna Ebrahimi, Mohamed Elhoseiny, Trevor Darrell, and Marcus Rohrbach. Uncertainty-guided continual learning with bayesian neural networks. In International Conference on Learning Representations, 2020a.
203
+
204
+ Sayna Ebrahimi, Franziska Meier, Roberto Calandra, Trevor Darrell, and Marcus Rohrbach. Adversarial continual learning. In The European Conference on Computer Vision (ECCV), 2020b.
205
+
206
+ Mehrdad Farajtabar, Navid Azizan, Alex Mott, and Ang Li. Orthogonal gradient descent for continual learning. ArXiv, abs/1910.07104, 2020.
207
+
208
+ Sebastian Farquhar and Yarin Gal. Towards robust evaluations of continual learning. ArXiv, abs/1805.09733, 2018.
209
+
210
+ Isha Garg, Priyadarshini Panda, and Kaushik Roy. A low effort approach to structured cnn design using pca. IEEE Access, 8:1347–1360, 2020.
211
+
212
+ Ian Goodfellow, Yoshua Bengio, Aaron Courville, and Yoshua Bengio. Deep learning, volume 1. MIT Press, 2016.
213
+
214
+ Yunhui Guo, Mingrui Liu, Tianbao Yang, and Tajana Rosing. Improved schemes for episodic memory-based lifelong learning. In Advances in Neural Information Processing Systems 33, 2020.
215
+
216
+ Yen-Chang Hsu, Yen-Cheng Liu, Anita Ramasamy, and Zsolt Kira. Re-evaluating continual learning scenarios: A categorization and case for strong baselines. In NeurIPS Continual learning Workshop, 2018. URL https://arxiv.org/abs/1810.12488.
217
+
218
+ Nitin Kamra, Umang Gupta, and Yan Liu. Deep generative dual memory network for continual learning. ArXiv, abs/1710.10368, 2017.
219
+
220
+ James Kirkpatrick, Razvan Pascanu, Neil C. Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A. Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, Demis Hassabis, Claudia Clopath, Dharshan Kumaran, and Raia Hadsell. Overcoming catastrophic forgetting in neural networks. Proceedings of the National Academy of Sciences, 114:3521 – 3526, 2017.
221
+
222
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, 2009.
223
+
224
+ Matthias De Lange, Rahaf Aljundi, Marc Masana, Sarah Parisot, Xu Jia, Ales Leonardis, Gregory Slabaugh, and Tinne Tuytelaars. A continual learning survey: Defying forgetting in classification tasks. IEEE Transactions on Pattern Analysis and Machine Intelligence, pp. 1–1, 2021.
225
+
226
+ Yann Lecun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. In Proceedings of the IEEE, pp. 2278–2324, 1998.
227
+
228
+ Xilai Li, Yingbo Zhou, Tianfu Wu, Richard Socher, and Caiming Xiong. Learn to grow: A continual structure learning framework for overcoming catastrophic forgetting. In Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 3925–3934. PMLR, 09–15 Jun 2019.
229
+
230
+ Zhenhua Liu, Jizheng Xu, Xiulian Peng, and Ruiqin Xiong. Frequency-domain dynamic pruning for convolutional neural networks. In Advances in Neural Information Processing Systems 31, pp. 1043–1053. 2018.
231
+
232
+ David Lopez-Paz and Marc' Aurelio Ranzato. Gradient episodic memory for continual learning. In Advances in Neural Information Processing Systems, volume 30, 2017.
233
+
234
+ Arun Mallya and Svetlana Lazebnik. Packnet: Adding multiple tasks to a single network by iterative pruning. 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7765– 7773, 2018.
235
+
236
+ Michael Mccloskey and Neil J. Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. The Psychology of Learning and Motivation, 24:104–169, 1989.
237
+
238
+ Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y. Ng. Reading digits in natural images with unsupervised feature learning. 2011.
239
+
240
+ Jathushan Rajasegaran, Munawar Hayat, Salman H Khan, Fahad Shahbaz Khan, and Ling Shao. Random path selection for continual learning. In Advances in Neural Information Processing Systems, volume 32, pp. 12669–12679, 2019.
241
+
242
+ Roger Ratcliff. Connectionist models of recognition memory: constraints imposed by learning and forgetting functions. Psychological review, 97 2:285–308, 1990.
243
+
244
+ Sylvestre-Alvise Rebuffi, Alexander Kolesnikov, Georg Sperl, and Christoph H. Lampert. iCaRL: Incremental classifier and representation learning. 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5533–5542, 2017.
245
+
246
+ Matthew Riemer, Ignacio Cases, Robert Ajemian, Miao Liu, Irina Rish, Yuhai Tu, and Gerald Tesauro. Learning to learn without forgetting by maximizing transfer and minimizing interference. In International Conference on Learning Representations, 2019.
247
+
248
+ Mark B. Ring. Child: A first step towards continual learning. In Learning to Learn, 1998.
249
+
250
+ Anthony V. Robins. Catastrophic forgetting, rehearsal and pseudorehearsal. Connect. Sci., 7:123– 146, 1995.
251
+
252
+ Andrei A. Rusu, Neil C. Rabinowitz, Guillaume Desjardins, Hubert Soyer, James Kirkpatrick, Koray Kavukcuoglu, Razvan Pascanu, and Raia Hadsell. Progressive neural networks. ArXiv, abs/1606.04671, 2016.
253
+
254
+ Gobinda Saha, Isha Garg, Aayush Ankit, and Kaushik Roy. Space: Structured compression and sharing of representational space for continual learning. ArXiv, abs/2001.08650, 2020.
255
+
256
+ Syed Shakib Sarwar, Aayush Ankit, and Kaushik Roy. Incremental learning in deep convolutional neural networks using partial network sharing. IEEE Access, 8:4615–4628, 2020.
257
+
258
+ Joan Serra, D \` ´ıdac Sur´ıs, Marius Miron, and Alexandros Karatzoglou. Overcoming catastrophic forgetting with hard attention to the task. In Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 4548–4557. PMLR, 10–15 Jul 2018.
259
+
260
+ Hanul Shin, Jung Kwon Lee, Jaehong Kim, and Jiwon Kim. Continual learning with deep generative replay. In Advances in Neural Information Processing Systems, volume 30, 2017.
261
+
262
+ Sebastian Thrun and Tom M. Mitchell. Lifelong robot learning. Robotics Auton. Syst., 15:25–46, 1995.
263
+
264
+ Oriol Vinyals, Charles Blundell, Timothy Lillicrap, Koray Kavukcuoglu, and Daan Wierstra. Matching networks for one shot learning. In Advances in Neural Information Processing Systems, volume 29, 2016.
265
+
266
+ Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms. ArXiv, abs/1708.07747, 2017.
267
+
268
+ Ju Xu and Zhanxing Zhu. Reinforced continual learning. In Advances in Neural Information Processing Systems, volume 31, pp. 899–908, 2018.
269
+
270
+ Jaehong Yoon, Eunho Yang, Jeongtae Lee, and Sung Ju Hwang. Lifelong learning with dynamically expandable networks. In 6th International Conference on Learning Representations, 2018.
271
+
272
+ Jaehong Yoon, Saehoon Kim, Eunho Yang, and Sung Ju Hwang. Scalable and order-robust continual learning with additive parameter decomposition. In International Conference on Learning Representations, 2020.
273
+
274
+ Guanxiong Zeng, Yang Chen, Bo Cui, and Shan Yu. Continuous learning of context-dependent processing in neural networks. ArXiv, abs/1810.01256, 2018.
275
+
276
+ Friedemann Zenke, Ben Poole, and Surya Ganguli. Continual learning through synaptic intelligence. In Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pp. 3987–3995. PMLR, 06–11 Aug 2017.
277
+
278
+ Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. In International Conference on Learning Representations, 2017.
279
+
280
+ A APPENDIX B ALGORITHM
281
+
282
+ B.1 INPUT AND GRADIENT SPACES (CONT.)
283
+
284
+ Since, the batch loss is the summation of the losses due to individual examples, the total batch loss for $n$ samples can be expressed as
285
+
286
+ $$
287
+ L _ { b a t c h } = \sum _ { i = 1 } ^ { n } L _ { i } = \sum _ { i = 1 } ^ { n } \frac { 1 } { 2 } | | W \pmb { x } _ { i } - \pmb { y } _ { i } | | _ { 2 } ^ { 2 } .
288
+ $$
289
+
290
+ The gradient of this loss with respect to weights can be expressed as
291
+
292
+ $$
293
+ \nabla _ { W } L _ { b a t c h } = \delta _ { 1 } \pmb { x } _ { 1 } ^ { T } + \delta _ { 2 } \pmb { x } _ { 2 } ^ { T } + . . . + \delta _ { n } \pmb { x } _ { n } ^ { T } .
294
+ $$
295
+
296
+ The gradient update will remain in the subspace spanned by the $n$ input examples.
297
+
298
+ # B.2 ALGORITHM PSEUDO CODE
299
+
300
+ # Algorithm 1 Algorithm for Continual Learning with GPM
301
+
302
+ 1: function TRAIN $( f _ { W } , { \mathcal { D } } ^ { t r a i n } , \alpha , \epsilon _ { t h } )$
303
+ 2: Initialize, $M ^ { l } \gets [ ]$ , for all $l = 1 , 2 , . . . . L$ // till L-1 if multi-head setting
304
+ 3: $\mathcal { M } \{ ( M ^ { l } ) _ { l = 1 } ^ { L } \}$
305
+ 4: $W W _ { 0 }$
306
+ 5: for $\tau \in { 1 , 2 , . . . . . , T }$ do
307
+ 6: repeat
308
+ 7: $\mathbf { \bar { \boldsymbol { B } } } _ { n } \sim \mathcal { D } _ { \tau } ^ { t r a i n }$ // sample a mini-batch of size $n$ from task $\tau$
309
+ 8: gradient, $\nabla _ { W } L _ { \tau } \gets \mathrm { S G D } ( B _ { n } , f _ { W } )$
310
+ 9: $\nabla _ { W } L _ { \tau } \gets \mathrm { P R O J E C T } ( \nabla _ { W } L _ { \tau } , \mathcal { M } )$ // see equation (6, 7)
311
+ 10: $\pmb { W } \pmb { W } - \alpha \nabla _ { \pmb { W } } L _ { \tau }$
312
+ 11: until convergence
313
+ 12:
314
+ 13: // Update Memory (GPM)
315
+ 14: $\bar { B _ { n _ { s } } } \sim \mathcal { D } _ { \tau } ^ { t r a i n }$ $/ /$ sample a mini-batch of size $n _ { s }$ from task $\tau$
316
+ 15: // construct representation matrices for each layer by forward pass (section 5)
317
+ 16: $\mathscr { R } _ { \tau } \gets \mathrm { f o r w a r } \mathbf { \bar { d } } ( B _ { n _ { s } } , f _ { W } )$ , where $\mathcal { R } _ { \tau } = \{ ( { \bf R } _ { \tau } ^ { l } ) _ { l = 1 } ^ { L } \}$
318
+ 17: for layer, $l = 1 , 2 , . . . L$ do
319
+ 18: $\hat { R } _ { \tau } ^ { l } \gets \mathrm { P R O J E C T } ( R _ { \tau } ^ { l } , M ^ { l } )$ // see equation (8)
320
+ 19: $\hat { U } _ { \tau } ^ { l } \gets \mathrm { S V D } ( \hat { R } _ { \tau } ^ { l } )$
321
+ 20: k ← criteria $( \hat { R } _ { \tau } ^ { l } , R _ { \tau } ^ { l } , \epsilon _ { t h } ^ { l } )$ // see equation (9)
322
+ 21: $M ^ { l } \gets [ M ^ { l } , \hat { { \boldsymbol { U } } } _ { \tau } ^ { l } [ 0 : k ] ]$
323
+ 22: end for
324
+ 23: end for
325
+ 24: return $f _ { W } , { \mathcal { M } }$
326
+ 25: end function
327
+
328
+ # C EXPERIMENTAL DETAILS
329
+
330
+ # C.1 DATASET STATISTICS
331
+
332
+ Table 4 and Table 5 show the summary of the datasets used in the experiments.
333
+
334
+ Table 4: Dataset Statistics.
335
+
336
+ <table><tr><td></td><td>PMNIST</td><td>Split CIFAR-100</td><td>Split-miniImageNet</td></tr><tr><td>num.of tasks</td><td>10</td><td>10</td><td>20</td></tr><tr><td>input size</td><td>1×28×28</td><td>3 × 32 × 32</td><td>3 × 84×84</td></tr><tr><td># Classes/task</td><td>10</td><td>10</td><td>5</td></tr><tr><td># Training samples/tasks</td><td>54,000</td><td>4,750</td><td>2,375</td></tr><tr><td># Validation Samples/tasks</td><td>6.,000</td><td>250</td><td>125</td></tr><tr><td># Test samples/tasks</td><td>10,000</td><td>1,000</td><td>500</td></tr></table>
337
+
338
+ Table 5: 5-Datasets Statistics. For the datasets with monochromatic images, we replicate the image across all RGB channels so that size of each image becomes $3 \times 3 2 \times 3 2$ .
339
+
340
+ <table><tr><td></td><td>CIFAR-10</td><td>MNIST</td><td>SVHN</td><td>Fashion MNIST</td><td>notMNIST</td></tr><tr><td># Classes</td><td>10</td><td>10</td><td>10</td><td>10</td><td>10</td></tr><tr><td># Training samples</td><td>47,500</td><td>57,000</td><td>69,595</td><td>57,000</td><td>16,011</td></tr><tr><td># Validation Samples</td><td>2,500</td><td>3.000</td><td>3,662</td><td>3,000</td><td>842</td></tr><tr><td># Test samples</td><td>10,000</td><td>10,000</td><td>26,032</td><td>10,000</td><td>1,873</td></tr></table>
341
+
342
+ # C.2 ARCHITECTURE DETAILS
343
+
344
+ AlexNet-like architecture: This is the same architecture used by Serra et al. (2018) with batch \` normalization added in each layer except the classifier layer. The network consists of 3 convolutional layers of 64, 128, and 256 filters with $4 \times 4$ , $3 \times 3$ , and $2 \times 2$ kernel sizes, respectively, plus two fully connected layers of 2048 units each. Rectified linear units is used as activations, and $2 \times 2$ max-pooling after the convolutional layers. Dropout of 0.2 is used for the first two layers and 0.5 for the rest.
345
+
346
+ Reduced ResNet18 architecture: This is the similar architecture used by Lopez-Paz & Ranzato (2017). For miniImageNet experiment, we use convolution with stride 2 in the first layer. For both miniImageNet and 5-Datasets experiments we replace the $4 \times 4$ average-pooling before classifier layer with $2 \times 2$ average-pooling.
347
+
348
+ All the networks use ReLU in the hidden units and softmax with cross entropy loss in the final layer.
349
+
350
+ # C.3 CIFAR-100 SUPERCLASS EXPERIMENT
351
+
352
+ For this experiment, similar to APD (Yoon et al., 2020), we use a modified LeNet-5 architecture with 20-50-800-500 neurons. All the baseline results are reported from APD. Like APD, we do not use any data augmentation or preprocessing. We keep $5 \%$ of training data from each task for validation. We train the network with our algorithm with batch size of 64 and initial learning rate of 0.01. We Train each task for a maximum of 50 epochs with decay schedule and early termination strategy similar to Serra et al. (2018). We use \` $\epsilon _ { t h } = 0 . 9 8$ for all the layers and increasing the value of $\epsilon _ { t h }$ by 0.001 for each new tasks.
353
+
354
+ # C.4 BASELINE IMPLEMENTATIONS
355
+
356
+ GEM (Lopez-Paz & Ranzato, 2017), A-GEM (Chaudhry et al., 2019a), ER Res (Chaudhry et al., 2019b) and OWM (Zeng et al., 2018) are implemented from their respective official implementations. EWC and HAT are implemented from the official implementation provided by Serra et al. \` (2018). While, OGD is implemented from adapting the code provided by Bennani et al. (2020).
357
+
358
+ # C.5 THRESHOLD HYPERPARAMETER
359
+
360
+ As discussed in section 5 and section 7, the threshold hyperparameter, $\epsilon _ { t h }$ controls the degree of interference through the approximation of space of significant representations of the past tasks. Since in neural network, characteristics of learned representations vary for different architectures and different dataset, using the same value of $\epsilon _ { t h }$ may not be useful in capturing the similar space of significance. In our experiments we use $\epsilon _ { t h }$ in the range of 0.95 to 1. For PMNIST experiment, as discussed in section 7, we use $\epsilon _ { t h } = 0 . 9 5$ in the first layer and 0.99 in the other layers. For split CIFAR-100 experiment, we use $\epsilon _ { t h } = 0 . 9 7$ for all the layers and increasing the value of $\epsilon _ { t h }$ by 0.003 for each new tasks. For split miniImageNet experiment, we use $\epsilon _ { t h } = 0 . 9 8 5$ for all the layers and increasing the value of $\epsilon _ { t h }$ by 0.0003 for each new tasks. For experiment with 5-Datasets, we use $\epsilon _ { t h } = 0 . 9 6 5$ for all the layers across all the tasks.
361
+
362
+ # C.6 TRAINING TIME MEASUREMENT
363
+
364
+ We measured per epoch training times (in Figure 2(b)) for computation in NVIDIA GeForce GTX 1060 GPU. For ten sequential tasks in PMNIST experiment, we computed per epoch training time for each task and reported the average value over all the tasks.
365
+
366
+ Training time for different algorithms reported in Table 2(a) for PMNIST tasks were measured on a Single NVIDIA GeForce GTX 1060 GPU. For all the other datasets, training time for different algorithms reported in Table 2(b) were measured on a Single NVIDIA GeForce GTX 1080 Ti GPU.
367
+
368
+ # C.7 LIST OF HYPERPARAMETERS
369
+
370
+ Table 6: List of hyperparameters for the baselines and our approach. Here, ‘lr’ represents (initial) learning rate. In the table we represent PMNIST as ‘perm’, 10-Split CIFAR-100 as ‘cifar’, Split miniImageNet as ‘minImg’ and 5-Datasets as ‘5data’.
371
+
372
+ <table><tr><td>Methods</td><td>Hyperparameters</td></tr><tr><td rowspan="2">OGD</td><td>lr : 0.001 (perm)</td></tr><tr><td># stored gradients :200/task (perm)</td></tr><tr><td>OWM</td><td>lr : 0.01 (cifar), 0.3 (perm)</td></tr><tr><td rowspan="3">GEM</td><td>lr : 0.1 (perm)</td></tr><tr><td>memory size (samples) :100o (perm)</td></tr><tr><td>memory strength, y : 0.5 (perm)</td></tr><tr><td rowspan="2">A-GEM</td><td>lr : 0.05 (cifar), 0.1 (perm, minImg, 5data)</td></tr><tr><td>memory size (samples) : 1000 (perm),2000 (cifar), 500 (minImg), 3000 (5data)</td></tr><tr><td rowspan="2">ER_Res</td><td>lr : 0.05 (cifar), 0.1 (perm, minImg, 5data)</td></tr><tr><td>memory size (samples) :1000 (perm),2000 (cifar), 500 (minImg),3000 (5data)</td></tr><tr><td rowspan="2">EWC</td><td>lr : 0.03 (perm, minImg, 5data), 0.05 (cifar)</td></tr><tr><td>regularization coeficient : 100o (perm), 50oo (cifar, minImg, 5data)</td></tr><tr><td rowspan="3">HAT</td><td>lr : 0.03 (minImg), 0.05 (cifar), 0.1 (5data)</td></tr><tr><td>Smax : 400 (cifar, minImg,5data)</td></tr><tr><td>c : 0.75 (cifar, minImg,5data)</td></tr><tr><td>Multitask</td><td>lr : 0.05 (cifar), 0.1 (perm, minImg,5data)</td></tr><tr><td rowspan="2">GPM (ours)</td><td>lr : 0.01 (perm, cifar), O0.1 (minImg, 5data)</td></tr><tr><td>ns : 100 (minImg,5data),125 (cifar), 300 (perm)</td></tr></table>
373
+
374
+ # C.8 GPM SIZE
375
+
376
+ As discussed in section 4, the gradient update will lie in the span of input vectors $( { \pmb x } )$ in fully connected layers, whereas the gradient updates of the convolutional filters will lie in the space spanned by the input patch vectors $( p )$ . Therefore, each basis stored in the GPM for a particular layer, $l$ will have the same dimension as $\mathbf { \Delta } _ { \mathbf { x } } l$ or $p ^ { l }$ . Thus, for any particular layer, GPM matrix, $M ^ { l }$ can have a maximum size of : $\mathrm { s i z e } ( { \pmb x } ^ { l } ) \times \mathrm { s i z e } ( { \pmb x } ^ { l } )$ or $\mathrm { s i z e } ( p ^ { l } ) \ \times \ \mathrm { s i z e } ( p ^ { l } )$ . Maximum size of the GPM, which we refer as GPM Max, is computed by including GPM matrices $( M ^ { l } )$ from all the layers. Thus the size of GPM Max is fixed by the choice of network architecture. In Table 7, we show the maximum size of GPM matrix $( M ^ { l } )$ for each layers for the architectures that we have used in our experiments along with the size of GPM Max.
377
+
378
+ Table 7: Size of GPM matrices for each layer for the architectures used in our experiments. Maximum sizes of the GPM in terms of number of parameters are also given.
379
+
380
+ <table><tr><td>Network</td><td>Size of maximum Ml</td><td>GPM_Max (parameters)</td></tr><tr><td>MLP (3 layers)</td><td>784 × 784,100 × 100,100 × 100</td><td>0.63M</td></tr><tr><td>AlexNet (5 layers)</td><td>48 × 48,576 × 576,512 × 512, 1024 × 1024,2048 × 2048</td><td>5.84M</td></tr><tr><td>ResNet18 (17 layers+ 3 short-cut connections)</td><td>27 × 27,180 × 180,180 × 180,180 × 180,180 × 180, 180 × 180,360 × 360,20 × 20,360 × 360,360 × 360, 360 × 360,720 × 720,40 × 40,720 × 720,720 × 720, 720 × 720,1440 × 1440,80 × 80,1440 × 1440,</td><td>8.98M</td></tr></table>
381
+
382
+ # D ADDITIONAL RESULTS
383
+
384
+ # D.1 RESULT TABLES
385
+
386
+ Table 8 contains the additional results for PMNIST experiment in single-epoch setting along with the standard deviation values for the results shown in Table 1(a) for multi-epoch (5 epoch) setting. Method that does not adhere to CL setup is indicated by $( ^ { * } )$ in the table. Results are reported from 5 different runs.
387
+
388
+ Table 8: Continual learning on PMNIST in single-epoch and multi-epoch setting.
389
+
390
+ <table><tr><td></td><td colspan="2">1 Epoch</td><td colspan="2">5 Epochs</td></tr><tr><td>Methods</td><td>ACC (%)</td><td>BWT</td><td>ACC (%)</td><td>BWT</td></tr><tr><td>OGD</td><td>85.18 ± 0.29</td><td>- 0.06 ± 0.00</td><td>82.56 ± 0.66</td><td>- 0.14 ± 0.01</td></tr><tr><td>OWM</td><td>90.55 ± 0.15</td><td>- 0.01± 0.00</td><td>90.71 ± 0.11</td><td>- 0.01± 0.00</td></tr><tr><td>GEM</td><td>88.65 ± 0.27</td><td>-0.07±0.00</td><td>83.38 ± 0.56</td><td>- 0.15 ± 0.01</td></tr><tr><td>A-GEM</td><td>87.80 ± 0.16</td><td>- 0.08 ±0.00</td><td>83.56± 0.16</td><td>- 0.14 ±0.00</td></tr><tr><td>ER_Res</td><td>90.63 ± 0.27</td><td>- 0.05 ±0.00</td><td>87.24 ± 0.53</td><td>- 0.11 ± 0.01</td></tr><tr><td>EWC</td><td>88.27 ± 0.39</td><td>- 0.04 ± 0.01</td><td>89.97 ± 0.57</td><td>- 0.04 ± 0.01</td></tr><tr><td>GPM (ours)</td><td>91.74 ± 0.15</td><td>- 0.03 ±0.00</td><td>93.91 ± 0.16</td><td>-0.03 ±0.00</td></tr><tr><td>Multitask*</td><td>95.21 ± 0.01</td><td></td><td>96.70 ± 0.02</td><td></td></tr></table>
391
+
392
+ Table 9: Continual learning on different datasets along with the standard deviation values for the results shown in Table 1(b).
393
+
394
+ <table><tr><td></td><td colspan="2">CIFAR-100</td><td colspan="2">miniImageNet</td><td colspan="2">5-Datasets</td></tr><tr><td>Methods</td><td>ACC (%)</td><td>BWT</td><td>ACC (%)</td><td>BWT</td><td>ACC (%)</td><td>BWT</td></tr><tr><td>OWM</td><td>50.94 ± 0.60</td><td>- 0.30± 0.01</td><td></td><td></td><td></td><td></td></tr><tr><td>EWC</td><td>68.80 ± 0.88</td><td>- 0.02 ± 0.01</td><td>52.01 ± 2.53</td><td>- 0.12 ±0.03</td><td>88.64 ± 0.26</td><td>- 0.04 ± 0.01</td></tr><tr><td>HAT</td><td>72.06 ± 0.50</td><td>-0.00±0.00</td><td>59.78 ± 0.57</td><td>- 0.03 ± 0.00</td><td>91.32 ± 0.18</td><td>-0.01± 0.00</td></tr><tr><td>A-GEM</td><td>63.98 ± 1.22</td><td>- 0.15 ± 0.02</td><td>57.24 ± 0.72</td><td>- 0.12 ± 0.01</td><td>84.04 ±0.33</td><td>-0.12 ± 0.01</td></tr><tr><td>ER_Res</td><td>71.73 ± 0.63</td><td>-0.06 ± 0.01</td><td>58.94 ± 0.85</td><td>- 0.07 ± 0.01</td><td>88.31 ± 0.22</td><td>-0.04 ±0.00</td></tr><tr><td>GPM (ours)</td><td>72.48 ± 0.40</td><td>-0.00 ±0.00</td><td>60.41 ± 0.61</td><td>- 0.00 ±0.00</td><td>91.22 ± 0.20</td><td>- 0.01 ± 0.00</td></tr><tr><td>Multitask*</td><td>79.58± 0.54</td><td>-</td><td>69.46 ± 0.62</td><td>-</td><td>91.54 ± 0.28</td><td>-</td></tr></table>
395
+
396
+ # D.2 k VALUES
397
+
398
+ Table 10 (a) and (b) show the number of new bases added at each layer per PMNIST and 10-split CIFAR-100 task respectively. Total number of bases in the GPM after learning all the tasks is also given.
399
+
400
+ Table 10: Number of new bases $( k )$ added to the GPM at different layers after each (a) PMNIST task and (b) 10-split CIFAR-100 task (for a random seed configuration).
401
+
402
+ <table><tr><td colspan="4">(a)</td><td colspan="7">(b)</td></tr><tr><td></td><td colspan="3">k</td><td></td><td></td><td colspan="4">k</td><td></td></tr><tr><td>Task ID</td><td>FC1</td><td>FC2</td><td>FC3</td><td>Task ID</td><td>Eth</td><td>Conv1</td><td>Conv2</td><td>Conv3</td><td>FC1</td><td>FC2</td></tr><tr><td>1</td><td>81</td><td>60</td><td>41</td><td>1</td><td>0.970</td><td>7</td><td>125</td><td>197</td><td>80</td><td>98</td></tr><tr><td>2</td><td>71</td><td>22</td><td>19</td><td>2</td><td>0.973</td><td>3</td><td>44</td><td>74</td><td>81</td><td>101</td></tr><tr><td>3</td><td>70</td><td>11</td><td>11</td><td>3</td><td>0.976</td><td>0</td><td>20</td><td>29</td><td>71</td><td>93</td></tr><tr><td>4</td><td>61</td><td>4</td><td>7</td><td>4</td><td>0.979</td><td>1</td><td>21</td><td>26</td><td>76</td><td>99</td></tr><tr><td>5</td><td>57</td><td>2</td><td>4</td><td>5</td><td>0.982</td><td>2</td><td>33</td><td>28</td><td>73</td><td>98</td></tr><tr><td>6</td><td>50</td><td>1</td><td>2</td><td>6</td><td>0.985</td><td>0</td><td>16</td><td>19</td><td>71</td><td>98</td></tr><tr><td>7</td><td>46</td><td>0</td><td>2</td><td>7</td><td>0.988</td><td>0</td><td>16</td><td>14</td><td>71</td><td>99</td></tr><tr><td>8</td><td>41</td><td>0</td><td>1</td><td>8</td><td>0.991</td><td>2</td><td>41</td><td>26</td><td>76</td><td>104</td></tr><tr><td>9</td><td>35</td><td>0</td><td>1</td><td>9</td><td>0.994</td><td>6</td><td>56</td><td>34</td><td>84</td><td>109</td></tr><tr><td>10</td><td>31</td><td>0</td><td>0</td><td>10</td><td>0.997</td><td>1</td><td>45</td><td>26</td><td>86</td><td>113</td></tr><tr><td>Total</td><td>543</td><td>100</td><td>88</td><td></td><td>Total</td><td>22</td><td>417</td><td>473</td><td>769</td><td>1012</td></tr></table>
403
+
404
+ Table 11: Continual learning of Digit dataset tasks in class-incremental learning setup (Kamra et al., 2017). (†) denotes the result reported from DGDMN.
405
+
406
+ <table><tr><td></td><td colspan="4">Methods</td></tr><tr><td>Metric</td><td>EWCt</td><td>DGR†</td><td>DGDMNt</td><td>GPM (ours)</td></tr><tr><td>ACC (%)</td><td>10.00</td><td>59.60</td><td>81.80</td><td>70.67</td></tr><tr><td>BWT</td><td>- 1.00</td><td>- 0.43</td><td>- 0.15</td><td>- 0.26</td></tr></table>
407
+
408
+ # D.3 CLASS-INCREMENTAL LEARNING
409
+
410
+ In this section, we evaluate our algorithm in a class-incremental learning setup (Rebuffi et al., 2017), where disjoint classes are learned one by one and classification is performed within all the learned classes without task hint (Kamra et al., 2017). This setup is different (Hsu et al., 2018) from the (single-head/multi-head) evaluation setups used throughout this paper. Also, this scenario is very challenging and often infeasible for the regularization (HAT, EWC etc.) and expansion-based (DEN, APD etc.) methods which do not use old data replay. Using the experimental setting similar to DGDMN (Kamra et al., 2017), we implemented the ‘Digit dataset’ experiment where a single class of MNIST digit is learned per task. Results are listed in Table 11, where the baselines are reported from DGDMN. While EWC forgets catastrophically, we perform better than DGR (Shin et al., 2017), which employs data replay through old data generation. DGDMN, an improved data replay method, outperforms all. In this setup, we believe a subset of old data replay either from storage or via generation is inevitable for attaining better performance with minimal forgetting (Rebuffi et al., 2017; Rajasegaran et al., 2019).
411
+
412
+ ![](images/12cdb7b5bb51fd82f1bf6821cb5bdae6db164acebec9c2fee70f1e9aa51a2d39.jpg)
413
+ D.4 ADDITIONAL PLOTS
414
+
415
+ ![](images/b8f1c4581d31ea50485b5231a4e767789388318baa317ef8904fce4e9bec19c5.jpg)
416
+ Figure 4: Evolution of task 1 accuracy over the course of incremental learning of 20 sequential tasks from miniImageNet dataset. Learned accuracy in our method remains stable throughout learning.
417
+ Figure 5: Illustration of how threshold hyperparameter controls the degree of interference at (a) Conv layer 1 (b) Conv layer 3 (c) FC layer 1 with the histogram plots of interference activations from Split CIFAR-100 experiment. With increasing $\epsilon _ { t h }$ , spread of the inference activation decreases resulting in minimization of forgetting.
md/train/3RMnfrH_Fi8eU/3RMnfrH_Fi8eU.md ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Fast Training of Convolutional Networks through FFTs
2
+
3
+ Michael Mathieu Courant Institute of Mathematical Sciences New York University mathieu@cs.nyu.edu
4
+
5
+ Mikael Henaff Courant Institute of Mathematical Sciences New York University mbh305@nyu.edu
6
+
7
+ Yann LeCun Courant Institute of Mathematical Sciences New York University yann@cs.nyu.edu
8
+
9
+ # Abstract
10
+
11
+ Convolutional networks are one of the most widely employed architectures in computer vision and machine learning. In order to leverage their ability to learn complex functions, large amounts of data are required for training. Training a large convolutional network to produce state-of-the-art results can take weeks, even when using modern GPUs. Producing labels using a trained network can also be costly when dealing with web-scale datasets. In this work, we present a simple algorithm which accelerates training and inference by a significant factor, and can yield improvements of over an order of magnitude compared to existing state-of-the-art implementations. This is done by computing convolutions as pointwise products in the Fourier domain while reusing the same transformed feature map many times. The algorithm is implemented on a GPU architecture and addresses a number of related challenges.
12
+
13
+ # 1 Introduction
14
+
15
+ As computer vision and machine learning aim to solve increasingly challenging tasks, models of greater complexity are required. This in turn requires orders of magnitude more data to take advantage of these powerful models while avoiding overfitting. While early benchmark datasets in machine learning contained thousands or tens of thousands of samples [7, 3, 10], current datasets are of the order of millions [6, 2]. This brings about new challenges as to how to train networks in a feasible amount of time. Even using parallel computing environments, training a network on ImageNet can take weeks [8]. In addition, although inference of labels using a trained network is comparatively fast, real-world applications such as producing labels for all images on the internet can represent a significant cost in terms of time and resources. Therefore, there is an important need to develop fast algorithms for training and inference.
16
+
17
+ In this work, we present a simple algorithm which accelerates training and inference using convolutional networks. The idea is based on performing convolutions as products in the Fourier domain, and reusing transformed feature maps many times. The significant operations in training convolutional networks can all be viewed as convolutions between pairs of 2-D matrices, which can represent input and output feature maps, gradients of the loss with respect to feature maps, or weight kernels. Typically, convolutions are performed for all pairings between two sets of 2-D matrices. By computing the Fourier transforms of the matrices in each set once, we can efficiently perform all convolutions as pairwise products.
18
+
19
+ Although it has long been known that convolutions can be computed as products in the Fourier domain, until recently the number of feature maps used in convolutional networks has been too small to make a method like ours effective. Previous work in the 90’s [1] explored the possibility of using FFTs to accelerate inference at the first layer of a trained network, where the Fourier transforms of the filters could be precomputed offline. However, this was not used during training, possibly because the number of feature maps used at the time was too small to make the overhead of computing FFTs at every iteration worthwhile. When the number of feature maps is large, as is the case for modern convolutional networks, using FFTs accelerates training and inference by a significant factor and can lead to a speedup of over an order of magnitude.
20
+
21
+ # 2 Theory
22
+
23
+ # 2.1 Backpropagation
24
+
25
+ The backpropagation algorithm [9] is the standard method to compute the gradient when training a convolutional network. During training, each layer performs three tasks, which we now describe. First we fix some notation: for a given layer, we have a set of input feature maps $x _ { f }$ indexed by $f$ , each one being a 2-D image of dimensions $n \times n$ . The output is a set of feature maps $y _ { f ^ { \prime } }$ indexed by $f ^ { \prime }$ , which are also 2-D images whose dimension depends on the convolutional kernel and its stride. The layer’s trainable parameters consist of a set of weights $w _ { f ^ { \prime } f }$ , each of which is a small kernel of dimensions $k \times k$ .
26
+
27
+ In the forward pass, each output feature map is computed as a sum of the input feature maps convolved with the corresponding trainable weight kernel:
28
+
29
+ $$
30
+ y _ { f ^ { \prime } } = \sum _ { f } x _ { f } * w _ { f ^ { \prime } f }
31
+ $$
32
+
33
+ During the backward pass, the gradients with respect to the inputs are computed by convolving the transposed weight kernel with the gradients with respect to the outputs:
34
+
35
+ $$
36
+ \frac { \partial L } { \partial x _ { f } } = \frac { \partial L } { \partial y _ { f ^ { \prime } } } * w _ { f ^ { \prime } f } ^ { T }
37
+ $$
38
+
39
+ This step is necessary for computing the gradients in (3) for the previous layer. Finally, the gradients of the loss with respect to the weight are computed by convolving each input feature map with the gradients with respect to the outputs:
40
+
41
+ $$
42
+ \frac { \partial L } { w _ { f ^ { \prime } f } } = \frac { \partial L } { \partial y _ { f ^ { \prime } } } * x _ { f }
43
+ $$
44
+
45
+ Note that $\frac { \partial L } { \partial y _ { f ^ { \prime } } }$ is a 2-D matrix with the same dimensions as the output feature map $y _ { f ^ { \prime } }$ , and that all operations consist of convolutions between various sets of 2-D matrices.
46
+
47
+ # 2.2 Algorithm
48
+
49
+ The well-known Convolution Theorem states that circular convolutions in the spatial domain are equivalent to pointwise products in the Fourier domain. Letting $\mathcal { F }$ denote the Fourier transform and $\bar { \mathcal { F } } ^ { - 1 }$ its inverse, we can compute convolutions between functions $f$ and $g$ as follows:
50
+
51
+ $$
52
+ f * g = { \mathcal { F } } ^ { - 1 } ( { \mathcal { F } } ( f ) \cdot { \mathcal { F } } ( g ) )
53
+ $$
54
+
55
+ Typically, this method is used when the size of the convolution kernel is close to that of the input image. Note that a convolution of an image of size $n \times n$ with a kernel of size $k \times k$ using the direct method requires $( n - k + 1 ) ^ { 2 } k ^ { 2 }$ operations. The complexity of the FFT-based method requires $6 C n ^ { 2 } \log { \dot { n } } + 4 n ^ { 2 }$ operations: each FFT requires $\mathcal { O } ( n ^ { 2 } \log \bar { n _ { . } } ^ { 2 } ) = \mathcal { O } ( 2 n ^ { 2 } \log n ) = 2 C n ^ { 2 } \mathrm { \dot { l o g } } n ,$ , and the pointwise product in the frequency domain requires $4 n ^ { 2 }$ (note that the products are between two complex numbers). Here $C$ represents the hidden constant in the $\mathcal { O }$ notation.
56
+
57
+ ![](images/7b9f6d6a60fd76d648e50a98f5ca673dd787e305ad5a78aa8037c3d2f0ff380c.jpg)
58
+ Figure 1: Illustration of the algorithm. Note that the matrix-multiplication involves multiplying all input feature maps by all corresponding kernels.
59
+
60
+ Our algorithm is based on the observation that in all of the operations (1), (2) and (3), each of the matrices indexed by $f$ is convolved with each of the matrices indexed by $f ^ { \prime }$ . We can therefore compute the FFT of each matrix once, and all pairwise convolutions can be performed as products in the frequency domain. Even though using the FFT-based method may be less efficient for a given convolution, we can effectively reuse our FFTs many times which more than compensates for the overhead.
61
+
62
+ The following analysis makes this idea precise. Assume we have $f$ input feature maps, $f ^ { \prime }$ output feature maps, images consisting of $n \times n$ pixels and kernels of $k \times k$ pixels. Also assume we are performing updates over minibatches of size $S$ , and that $C$ represents the hidden constant in the FFT complexity. As an example, using the direct approach (1) will take a total of $S \cdot f ^ { \prime } \cdot f \cdot ( n - k + 1 ) ^ { 2 } \cdot k ^ { 2 }$ operations. Our approach requires $( 2 C \cdot n ^ { 2 } \bar { \log { n } } ) ( S \cdot f + f ^ { \prime } \cdot f )$ operations to transform the input feature maps and kernels to the Fourier domain, a total of $4 S \cdot f ^ { \prime } \cdot \dot { f } \cdot n ^ { 2 }$ additions and multiplications in the Fourier domain, and $S \cdot f ^ { \prime } \cdot ( 2 C \cdot n ^ { 2 } \log n )$ operations to transform the output feature maps back to the spatial domain. The same analysis yields similar complexity estimates for the other operations:
63
+
64
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Direct Convolution</td><td rowspan=1 colspan=1>Our Method</td></tr><tr><td rowspan=1 colspan=1>∑fxf*wf&#x27;f</td><td rowspan=1 colspan=1>S.f&#x27;·f.n&#x27;² .k²</td><td rowspan=1 colspan=1>2Cn² logn[f&#x27; ·S+ f ·S+f&#x27; : f]+4S ·f&#x27; · f ·n²</td></tr><tr><td rowspan=1 colspan=1>aL*Tayf</td><td rowspan=1 colspan=1>S.f&#x27; · f ·n² .k²</td><td rowspan=1 colspan=1> 2Cn&#x27;² logn&#x27;[f&#x27; ·S+ f·S+f&#x27; · f]+4S·f&#x27; · f ·n&#x27;²</td></tr><tr><td rowspan=1 colspan=1>aL*xfyf</td><td rowspan=1 colspan=1>S.f&#x27; · f .k² .n&#x27;²</td><td rowspan=1 colspan=1> 2Cnlogn2[f&#x27; ·S+ f ·S+ f&#x27; · f]+4S ·f&#x27; · f ·n²</td></tr></table>
65
+
66
+ Here $n ^ { \prime } = ( n - k + 1 )$ represents the size of the output feature map. Note that the high complexity of the direct method for convolution comes from the product of five terms, whereas our method has a sum of products with at most four terms. Figure 2 shows the theoretical number of operations for direct convolution and our FFT method for various input sizes.
67
+
68
+ # 2.3 Implementation and Memory Considerations
69
+
70
+ Although conceptually straighforward, a number of challenges relating to GPU implementation needed to be addressed. First, current GPU implementations of the FFT such as cuFFT are designed to parallelize over individual transforms. This can be useful for computing a limited number of transforms on large inputs, but is not suitable for our task since we are performing many FFTs over relatively small inputs. Therefore, we developed a custom CUDA implementation of the CooleyTukey FFT algorithm [5] which enabled us to parallelize over feature maps, minibatches and within each 2-D transform. Note that 2-D FFTs lend themselves naturally to parallelization since they can be decomposed into two sets of 1-D FFTs (one over rows and the other over columns), and each set can be done in parallel.
71
+
72
+ ![](images/29190556506f8dc0e97c772a7d6e855a33a422b19f4e6b7dba3e4a361e590469.jpg)
73
+ Figure 2: Number of operations required for computing (1) with different input image sizes and $S = 1 2 8$ , $f = 9 6$ , $f ^ { \prime } = \bar { 2 } 5 6 , k = 7$ .
74
+
75
+ Second, additional memory is required to store the feature maps in the Fourier domain. Note that by keeping the Fourier representations in memory for all layers after the forward pass, we could avoid recomputing several of the FFTs during the backward pass. However, this might become prohibitively expensive in terms of memory for large networks. Therefore we reuse the same memory for all the different convolutions in the network, so that the necessary amount of memory is determined only by the largest convolution layer. All of the analysis in the previous section and all experiments in the remainder of the paper assume we are using this memory-efficient approach.
76
+
77
+ For a convolution layer taking an input of size $n \times n$ , with $f$ input features, $f ^ { \prime }$ output features and a minibatch of size $S$ , we need to store a total of $S \cdot f + S \cdot f ^ { \prime } + f \cdot f ^ { \prime }$ frequency representations of size $n \times n$ . As another means to save memory, we can use symmetry properties of FFTs of real inputs to store only half the data, i.e. $n ( n + 1 ) / 2$ complex numbers. Assuming float representations, the necessary memory in bytes is:
78
+
79
+ $$
80
+ 4 n ( n + 1 ) ( S \cdot f + S \cdot f ^ { \prime } + f \cdot f ^ { \prime } )
81
+ $$
82
+
83
+ The following table shows the amount of RAM used for typical sizes of convolutions:
84
+
85
+ <table><tr><td>S</td><td>n</td><td>f</td><td>f</td><td>RAMused</td></tr><tr><td>128</td><td>16</td><td>96</td><td>256</td><td>76MB</td></tr><tr><td>128</td><td>32</td><td>96</td><td>256</td><td>294MB</td></tr><tr><td>64</td><td>64</td><td>9</td><td>256</td><td>784MB</td></tr><tr><td>128</td><td>64</td><td>96</td><td>256</td><td>1159MB</td></tr><tr><td>128</td><td>16</td><td>256</td><td>384</td><td>151MB</td></tr><tr><td>128</td><td>32</td><td>256</td><td>384</td><td>588MB</td></tr><tr><td>128</td><td></td><td>384</td><td>384</td><td>214MB</td></tr><tr><td>128</td><td>32</td><td>384</td><td>384</td><td>830MB</td></tr></table>
86
+
87
+ Note that this is a relatively small additional memory requirement compared to the total amount of memory used by large networks.
88
+
89
+ # 3 Experiments
90
+
91
+ To test our analysis, we ran a series of experiments comparing our method to the CudaConv GPU implementation of [8] and a custom implementation using the Torch 7 machine learning environment [4]. Both of these implementations compute convolutions using the direct method in the spatial domain. All experiments were performed on the same GeForce GTX Titan GPU. We began by performing unit tests comparing the results of convolutions computed by our method to those computed by the Torch implementation for each of the three operations. We found that the differences in results for operations (1) and (2) to be of the order of $1 0 ^ { - 5 }$ and for operation (3) to be of the order $1 0 ^ { - 4 }$ . The differences are likely due to rounding errors in floating-point operations and are within an acceptable range.
92
+
93
+ We then compared how each method performed in terms of speed with varying kernel sizes, input sizes and minibatch sizes. The results are shown in Figure 3. For all experiments, we chose 96 input feature maps and 256 output feature maps, which represents a typical configuration of a deep network’s second layer. The functions updateOutput, updateGradInput and accGradParameters correspond to the operations in (1), (2) and (3) respectively. All times are measured in seconds.
94
+
95
+ We see that our method significantly outperforms the other two in nearly all cases. The improvement is especially pronounced for the accGradParameters operation, which is the most computationally expensive. This is likely due to the fact that the convolution we are computing has a large kernel, for which FFTs are better suited in any case. Also note that our method performs the same regardless of kernel size, since we pad the kernel to be the same size as the input image before applying the FFT. This enables the use of much larger kernels, which we intend to explore in future work.
96
+
97
+ ![](images/134eaaa4b5fbdd071df8f60b4e320dcb8c1d7dd039cf1d1237f5fb76aa788dc9.jpg)
98
+
99
+ ![](images/28ea8908bc1ea044fc80942d93bc29b2cc82bdbf3c33aa97fd86095eaef7791f.jpg)
100
+ !&#"&-)%&(&%" \* '\* $^ { \prime = 1 2 8 }$ "\$('\* $: = 3 2$ ""\$(' "& $_ { ; = 9 6 }$ "('\$(' " $_ { : = 2 5 6 }$
101
+
102
+ ![](images/149f8e0328907b567859084864c2be98638b893cea5769fefb16f134df06533a.jpg)
103
+ !&#"&-)%&(&'\* %" \* $^ { - 7 }$ "\$('\* $\mathtt { \Gamma } _ { \mathtt { = } } 3 2$ ""\$(' "& $_ { ; = 9 6 }$ "('\$(' " $_ { : = 2 5 6 }$
104
+ Figure 3: Speed comparison with respect to size of input image (top), kernel size (middle) and minibatch size (bottom)
105
+
106
+ We next ran experiments with parameter configurations typical of those used in different layers of a large convolutional network. The time taken by the different methods are given in milliseconds. The top row is a 4-tuple $( k , n , f , f ^ { \prime } )$ indicating the width of the kernel, width of the input image, number of input feature maps and number of output feature maps. All kernels and input images are square, of size $k \times k$ and $n \times n$ respectively. All configurations have minibatches of size 128. The first configuration represents the first layer, which is why we did not report times for the updateGradInput operation. For each configuration, the best-performing method is highlighted in bold.
107
+
108
+ <table><tr><td>(k,n,f,f&#x27;)</td><td>(11,32,3,96)</td><td>(7,32,96,256)</td><td>(5,16,256,384)</td><td>(5,16,384,384)</td><td>(3,16,384,384)</td></tr><tr><td colspan="6">updateOutput</td></tr><tr><td rowspan="3">Torch7 (custom) CudaConv</td><td>5</td><td>178</td><td>74</td><td>111</td><td>57</td></tr><tr><td>16</td><td>221</td><td>98</td><td>146</td><td>86</td></tr><tr><td>3</td><td>34</td><td>34</td><td>49</td><td>49</td></tr><tr><td colspan="6">FFT updateGradInput</td></tr><tr><td>Torch7 (custom)</td><td></td><td>197</td><td>76</td><td>116</td><td>62</td></tr><tr><td>CudaConv</td><td></td><td>261</td><td>108</td><td>161</td><td>77</td></tr><tr><td>FFT</td><td>=</td><td>92</td><td>76</td><td>116</td><td>116</td></tr><tr><td colspan="6">accGradParameters</td></tr><tr><td>Torch7 (custom) 39</td><td></td><td>285</td><td>116</td><td>174</td><td>96</td></tr><tr><td>CudaConv</td><td>32</td><td>403</td><td>195</td><td>280</td><td>178</td></tr><tr><td>FFT</td><td>2</td><td>33</td><td>32</td><td>48</td><td>47</td></tr><tr><td colspan="6">Total</td></tr><tr><td>Torch7 (custom)</td><td>44</td><td>660</td><td>266</td><td>401</td><td>215</td></tr><tr><td>CudaConv</td><td>48</td><td>885</td><td>401</td><td>587</td><td>341</td></tr><tr><td>FFT</td><td>5</td><td>159</td><td>142</td><td>213</td><td>212</td></tr></table>
109
+
110
+ We see that our FFT-based method performs faster in total for all configurations, sometimes to a substantial degree. The improvement is very significant on the forward pass, which makes the method especially well suited for inference on very large datasets using a trained network.
111
+
112
+ Finally, we tested times taken to perform a training iteration for a network obtained by composing the above layers, inserting max-pooling and rectified linear units between them, and adding a fully connected layer for prediction with 1000 outputs. This was to account for possible changes in performance due to implementation details such as padding, accessing memory and so on. The following table shows the results in milliseconds:
113
+
114
+ <table><tr><td></td><td>updateOutput</td><td>updateGradInput</td><td>accGradParameters</td><td>Total</td></tr><tr><td>Torch7 (custom)</td><td>489</td><td>577</td><td>690</td><td>1756</td></tr><tr><td>CudaConv</td><td>717</td><td>685</td><td>1093</td><td>2495</td></tr><tr><td>FFT</td><td>235</td><td>471</td><td>161</td><td>867</td></tr></table>
115
+
116
+ Our FFT-based method still significantly outperforms the other two implementations.
117
+
118
+ # 4 Discussion and Future Work
119
+
120
+ We have presented a simple and fast algorithm for training and inference using convolutional networks. It outperforms known state-of-the-art implementations in terms of speed, as verified by numerical experiments. In the future we plan to explore the possibility of learning kernels directly in the Fourier domain. Another interesting direction would be to investigate the use of non-linearities in the Fourier domain rather than in the spatial domain, since this would remove the need for inverse transforms and accelerate training and inference further.
121
+
122
+ It is worth mentioning that in our current implementation of the FFT algorithm, input images which are not a power of 2 must be padded to the next highest power. For example, using input images of size $3 4 \times 3 4$ will be suboptimal in terms of speed since they must be padded to be $6 4 \times 6 4$ . This limitation is not intrinsic to the FFT and we intend to extend our implementation to accept other sizes in the future. On the other hand, the fact that our method’s speed is invariant to kernel size enables us to use larger kernels at different layers of the network. In future work we intend to thoroughly explore the effect of input image and kernel sizes on performance.
123
+
124
+ # References
125
+
126
+ [1] S. Ben-Yacoub, B. Fasel, and J. Luttin. Fast face detection using mlp and fft. In Proceedings of the Second International Conference on Audio and Video-based Biometric Person Authentification (AVBPA 1999), 1999.
127
+ [2] Thierry Bertin-Mahieux, Daniel P.W. Ellis, Brian Whitman, and Paul Lamere. The million song dataset. In Proceedings of the 12th International Conference on Music Information Retrieval (ISMIR 2011), 2011.
128
+ [3] A. Bosch, A. Zisserman, and X. Munoz. Representing shape with a spatial pyramid kernel. In Proceedings of the ACM International Conference on Image and Video Retrieval, 2007.
129
+ [4] Ronan Collobert, Koray Kavukcuoglu, and Clement Farabet. Torch7: A matlab-like environment for machine learning. In NIPS, 2011. [5] James Cooley and John Tukey. An algorithm for the machine calculation of complex fourier series. Mathematics of Computation, (19):297–301, 1965.
130
+ [6] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. 2009.
131
+ [7] L. Fei-Fei, R. Fergus, and Pietro Perona. Learning generative visual models from few training examples: An incremental bayesian approach tested on 101 object categories. 2004.
132
+ [8] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E. Hinton. Imagenet classification with deep convolutional neural networks. In NIPS, pages 1106–1114, 2012.
133
+ [9] Y. LeCun, L. Bottou, G. Orr, and K. Muller. Efficient backprop. In G. Orr and Muller K., editors, Neural Networks: Tricks of the trade. Springer, 1998.
134
+ [10] G. Tzanetakis and P. Cook. Musical genre classification of audio signals. IEEE Transactions on Speech and Audio Processing, 10(5):293–302, July 2002.
md/train/5Dl1378QutR/5Dl1378QutR.md ADDED
@@ -0,0 +1,403 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Diversity Policy Gradient for Sample Efficient Quality-Diversity Optimization
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 A fascinating aspect of nature lies in its ability to produce a large and diverse
11
+ 2 collection of organisms that are all high-performing in their niche. By contrast,
12
+ 3 most AI algorithms focus on finding a single efficient solution to a given problem.
13
+ 4 Aiming for diversity in addition to performance is a convenient way to deal with the
14
+ 5 exploration-exploitation trade-off that plays a central role in learning. It also allows
15
+ 6 for increased robustness when the returned collection contains several working
16
+ 7 solutions to the considered problem, making it well-suited for real applications such
17
+ 8 as robotics. Quality-Diversity (QD) methods are evolutionary algorithms designed
18
+ 9 for this purpose. This paper proposes a novel algorithm, QD-PG, which combines
19
+ 10 the strength of Policy Gradient algorithms and Quality Diversity approaches to
20
+ 11 produce a collection of diverse and high-performing neural policies in continuous
21
+ 12 control environments. The main contribution of this work is the introduction of a
22
+ 13 Diversity Policy Gradient (DPG) that exploits information at the time-step level to
23
+ 14 thrive policies towards more diversity in a sample-efficient manner. Specifically,
24
+ 15 QD-PG selects neural controllers from a MAP-Elites grid and uses two gradient
25
+ 16 based mutation operators to improve both quality and diversity, resulting in stable
26
+ 17 population updates. Our results demonstrate that QD-PG generates collections of di
27
+ 18 verse solutions that solve challenging exploration and control problems while being
28
+ 19 two orders of magnitude more sample-efficient than its evolutionary competitors.
29
+
30
+ # 20 1 Introduction
31
+
32
+ 21 Natural evolution has the fascinating ability to produce diverse organisms that are all well adapted to
33
+ 22 their respective niche. Inspired by this ability to produce a tremendous diversity of living systems,
34
+ 23 Quality-Diversity (QD) is a new family of optimization algorithms that aims at searching for a
35
+ 24 collection of both diverse and high-performing solutions (Pugh et al., 2016; Cully & Demiris, 2017).
36
+ 25 While classic optimization methods focus on finding a single efficient solution, QD optimization aims
37
+ 26 to cover the range of possible solution types and to return the best solution for each type. This process
38
+ 27 is sometimes referred to as “illumination" in opposition to optimization, as it reveals (or illuminates)
39
+ 28 a search space of interest often called the behavior descriptor space (Mouret & Clune, 2015).
40
+ 29 The principal advantage of QD approaches resides in their intrinsic capacity to deliver a large and
41
+ 30 diverse set of working alternatives when a single solution fails (Cully et al., 2015). By producing a
42
+ 31 collection of solutions instead of a unique one, QD algorithms allow to obtain different ways to solve
43
+ 32 a single problem, leading to greater robustness, which can help to reduce the reality gap when applied
44
+ 33 to robotics (Koos et al., 2012). Diversity seeking is the core component that allows QD algorithms to
45
+ 34 generate large collections of diverse solutions. By encouraging the emergence of novel behaviors in
46
+ 35 the population without focusing on performance alone, diversity seeking algorithms explore regions
47
+ 36 of the behavior descriptor space that are unreachable for conventional algorithms (Doncieux et al.,
48
+ 37 2019). Another benefit of QD is its ability to solve hard exploration problems where the reward signal
49
+ 38 is sparse or deceptive, and on which standard optimization techniques are ineffective (Colas et al.,
50
+ 39 2020). This ability can be interpreted as a direct consequence of the structured search for diversity in
51
+ 40 the behavior descriptor space.
52
+ 41 Quality-Diversity algorithms build on black-box optimization methods such as evolutionary algo
53
+ 42 rithms to evolve a population of solutions (Cully & Demiris, 2017). Historically, they rely on random
54
+ 43 mutations to explore small search spaces but struggle when facing higher-dimensional problems. As
55
+ 44 a result, they often scale poorly to problems where neural networks with many parameters provide
56
+ 45 state-of-the-art results (Colas et al., 2020).
57
+ 46 Building large and efficient controllers that work with continuous actions has been a long-standing
58
+ 47 goal in Artificial Intelligence and in particular in robotics. Deep reinforcement learning (RL), and
59
+ 48 especially Policy Gradient (PG) methods have proven efficient at training such large controllers
60
+ 49 (Schulman et al., 2017; Lillicrap et al., 2015; Fujimoto et al., 2018; Haarnoja et al., 2018). One of the
61
+ 50 keys to this success lies in the fact that PG methods exploit the structure of the objective function
62
+ 51 when the problem can be formalized as a Markov Decision Process (MDP), leading to substantial
63
+ 52 gains in sample efficiency. Moreover, they also exploit the analytical structure of the controller when
64
+ 53 known, which allows the sample complexity of these methods to be independent of parameter space
65
+ 54 dimensionality (Vemula et al., 2019). In real-world applications, these gains turn out to be critical
66
+ 55 when interacting with the environment is expensive. PG methods usually rely on simple exploration
67
+ 56 mechanisms, like adding Gaussian noise (Fujimoto et al., 2018) or maximizing entropy (Haarnoja
68
+ 57 et al., 2018) to explore the action space, which happens to be insufficient in hard exploration tasks
69
+ 58 where the reward signal is sparse or deceptive (Colas et al., 2018; Nasiriany et al., 2019).
70
+ 59 Successful attempts have been made to combine evolutionary methods and reinforcement learning
71
+ 60 (Khadka et al., 2019; Khadka & Tumer, 2018; Pourchot & Sigaud, 2018; Shi et al., 2020). However,
72
+ 61 all these techniques only focus on building high-performing solutions and do not explicitly encourage
73
+ 62 diversity within the population. In this regard, they fail when confronted with hard exploration
74
+ 63 problems. To address these problems, one needs to seek both high-performing solutions and diversity
75
+ 64 within them.
76
+
77
+ ![](images/aac911aec790ff4d63477d00c31877af492e268d6cc3f1cc95ddcb90f190c436.jpg)
78
+ Figure 1: The agent robot is rewarded for running forward as fast as possible. Following the reward signal without further exploration leads the agent into the trap, which corresponds to a poor local minimum. QD-PG produces a collection of solutions that are diverse and high-performing, allowing to find several working alternatives to solve a deceptive control problem.
79
+
80
+ # 65 Contributions
81
+
82
+ 66 In this work, we introduce the idea of a diversity policy gradient (DPG) that thrives solutions towards
83
+ 67 more diversity. We show that the DPG can be used in combination with the standard policy gradient,
84
+ 68 dubbed quality policy gradient (QPG), to produce high-performing and diverse solutions. Our
85
+ 69 algorithm, called QD-PG, builds on MAP-Elites (Mouret & Clune, 2015), demonstrates remarkable
86
+ 70 sample efficiency brought by off-policy PG methods, and produces collections of good solutions
87
+ 71 in a single run (see Figure 1). We compare QD-PG to state-of-the-art RL algorithms and to several
88
+ 72 evolutionary methods known as Evolution Strategies (ESs) augmented with a diversity objective,
89
+ 73 namely the NS-ES family (Conti et al., 2018) and the ME-ES algorithm (Colas et al., 2020). We
90
+ 74 show that QD-PG generates collections of robust solutions in hard exploration problems while RL
91
+ 75 algorithms struggle to produce a single one, and that QD-PG is two orders of magnitude more sample
92
+ 76 efficient than the best of its evolutionary competitors.
93
+
94
+ # 77 2 Background
95
+
96
+ # 78 Problem statement
97
+
98
+ 79 We consider an MDP $( S , { \mathcal { A } } , { \mathcal { R } } , { \mathcal { T } } , \gamma )$ where $s$ is the state space, $\mathcal { A }$ the action space, $\mathcal { R } : \mathcal { S } \times \mathcal { A } \mathbb { R }$
99
+ 80 the reward function, $\mathcal { T } : \mathcal { S } \times \mathcal { A } \mathcal { S }$ the dynamics transition function and $\gamma$ a discount factor.
100
+ 81 We assume that both $s$ and $\mathcal { A }$ are continuous and consider a controller, or policy, $\pi _ { \theta } : { \mathcal { S } } A$
101
+ 82 parameterized by $\theta \in \Theta$ , which is called a solution to the problem. We say that a solution $\theta$ is
102
+ 83 highy-performing if the expectation over the sum of rewards is high when using $\pi _ { \theta }$ . The fitness of a
103
+ 84 solution measures its performance $F : \Theta \to \mathbb { R }$ where $F ( \theta ) = \mathbb { E } _ { \pi _ { \theta } } \sum _ { t } \gamma ^ { t } r _ { t }$ .
104
+ 85 To characterize the novelty of a solution w.r.t. $J$ other solutions, as in QD methods, we introduce a
105
+ 86 behavior descriptor (BD) space $\boldsymbol { B }$ , a behavior descriptor extraction function $\xi : \Theta \to B$ , and define a
106
+ 87 distance metric $| | . | | _ { B }$ over $\boldsymbol { B }$ . The novelty $n : \Theta \times \dot { \Theta } ^ { J } \mathbb { R } ^ { + }$ of a solution $\theta$ w.r.t. a list of solutions
107
+ 88 $( \theta _ { j } ) _ { j = 1 , \ldots , J }$ is defined as $\begin{array} { r } { n \left( \theta , ( \theta _ { j } ) _ { j = 1 , \dots , J } \right) = \sum _ { j } | | \xi ( \theta ) , \xi ( \theta _ { j } ) | | _ { \mathcal { B } } . } \end{array}$ . In other words, we quantify the
108
+ 89 novelty of a solution w.r.t. a list of $J$ solutions as the sum of distances between its behavior descriptor
109
+ 90 and the behavior descriptors of all solutions of the list. We also use the distance $| | . | | _ { B }$ to characterize
110
+ 91 the diversity of a set of $K$ solutions $\{ \theta _ { k } \} _ { k = 1 , \dots , K }$ . We formally define diversity $d : \Theta ^ { K } \to \mathbb { R } ^ { + }$ as
111
+
112
+ $$
113
+ d \left( \{ \theta _ { k } \} _ { k = 1 , \ldots , K } \right) = \sum _ { i = 1 } ^ { K } \operatorname* { m i n } _ { k \neq i } | | { \xi } ( \theta _ { i } ) , { \xi } ( \theta _ { k } ) | | _ { \cal B } ,
114
+ $$
115
+
116
+ meaning that a set of solutions is diverse if the solutions are distant with respect to each other in the sense of $| | . | | _ { B }$ .
117
+
118
+ # 94 The MAP-Elites algorithm
119
+
120
+ 95 MAP-Elites (Mouret & Clune, 2015) is a simple yet state-of-the-art QD algorithm that has been
121
+ 96 successfully applied to a wide range of challenging problems such as robot damage recovery (Cully
122
+ 97 et al., 2015), molecular robotic control (Cazenille et al., 2019) and game design (Alvarez et al., 2019).
123
+ 98 In MAP-Elites, the behavior descriptor space $\boldsymbol { B }$ is discretized into a grid of cells, also called niches,
124
+ 99 with the aim of filling each cell with a high-performing solution. The algorithm starts with an empty
125
+ 100 grid and an initial random set of $K$ solutions that are evaluated and added to the grid by following
126
+ 101 simple insertion rules. If the cell corresponding to the behavior descriptors of a solution is empty, then
127
+ 102 the solution is added to this cell. If there is already a solution in the cell, the new solution replaces it
128
+ 103 only if it has greater fitness. At each iteration, $P$ existing solutions are sampled uniformly from the
129
+ 104 grid and randomly mutated to create $P$ new solutions. These new solutions are then evaluated and
130
+ 105 added to the grid following the same insertion rules. This cycle is repeated until convergence or for a
131
+ 106 given budget of iterations.
132
+ 107 Though MAP-Elites is a compelling and efficient method, it suffers from a low sample efficiency
133
+ 108 as it relies on random mutations. Recently, Colas et al. (2020) tackled this problem by updating
134
+ 109 the solutions through an Evolution Strategy known as the Cross-Entropy method. Notably, they
135
+ 110 showed that MAP-Elites could be scaled with their method to address complex MUJOCO control
136
+ 111 environments at the cost of very large computational resources. In this study, we propose to harness
137
+ 112 policy gradients (QPG and DPG) to build a more sample-efficient MAP-Elites approach.
138
+
139
+ # 113 3 Key Principle: Diversity Policy Gradient
140
+
141
+ 114 Let us assume that we have a MAP-Elites grid containing $K$ solutions $( \theta _ { 1 } , \ldots , \theta _ { K } )$ . To increase
142
+ 115 diversity in the grid using the DPG, we need to update one sampled solution $\theta$ from the grid using
143
+ 116 gradient ascent. To do so, we aim to compute the gradient of the population diversity w.r.t. $\theta$ , where
144
+ 117 diversity is defined in Equation (1). As the $K$ solutions are independent, order does not matter and
145
+ 118 we can consider optimizing arbitrarily $\theta = \theta _ { 1 }$ . To compute the gradient of $d$ w.r.t. $\theta _ { 1 }$ , we need
146
+ 119 to separate the terms that depend on $\theta _ { 1 }$ from the others. The terms that depend on $\theta _ { 1 }$ correspond
147
+ 120 to the distance of $\theta _ { 1 }$ to its nearest neighbor, which we define as $\theta _ { 2 }$ , and to the distances of $\theta _ { 1 }$ to
148
+ 121 122 $\begin{array} { r } { d ( \{ \theta _ { k } \} _ { k = 1 , \ldots , K } ) = \sum _ { j = 2 } ^ { J } | | \xi ( \theta _ { 1 } ) , \xi ( \theta _ { j } ) | | _ { \mathcal { B } } + M } \end{array}$ $\theta \mathrm { s }$ $\theta _ { 1 }$ can ar, where $\begin{array} { r } { M = \sum _ { i \notin \{ 1 , . . . , J \} } \underset { k \neq i } { \operatorname* { m i n } } | | \xi ( \theta _ { i } ) , \xi ( \theta _ { k } ) | | _ { B } . } \end{array}$ $J ^ { 1 }$ .
149
+ 123 Only the first term of the sum depends on $\theta = \theta _ { 1 }$ . Furthermore, we observe that this term equals the
150
+ 124 novelty of solution $\theta _ { 1 }$ w.r.t. the list $( \theta _ { j } ) _ { 2 \leq j \leq J }$ . Therefore, the gradient of diversity w.r.t. $\theta _ { 1 }$ is
151
+ 125 $\nabla _ { \theta _ { 1 } } d \bigl ( \{ \theta _ { k } \} _ { k = 1 , \ldots , K } \bigr ) = \nabla _ { \theta _ { 1 } } n \bigl ( \theta _ { 1 } , \bigl ( \theta _ { j } \bigr ) _ { 2 \leq j \leq J } \bigr ) .$ . That is, we can increase the diversity of the population
152
+ 126 by increasing the novelty of $\theta _ { 1 }$ w.r.t. the list $( \theta _ { j } ) _ { 2 \leq j \leq J } .$ . In practice, we replace this list by a list of
153
+ 127 nearest neighbors of $\theta _ { 1 }$ , as this is easier to compute and the elements of $( \theta _ { j } ) _ { 2 \leq j \leq J }$ tend to be among
154
+ 128 the nearest neighbors of $\theta _ { 1 }$ .
155
+ 129 Under this form, the diversity gradient cannot benefit from the variance reduction methods in the RL
156
+ 130 literature to efficiently compute policy gradients Sutton et al. (1999). To this end, we need to express
157
+ 131 it as a gradient over the expectation of a sum of scalar quantities obtained by policy $\pi _ { \theta _ { 1 } }$ at each step
158
+ 132 when interacting with the environment. Therefore, to build a DPG, we need information about the
159
+ 133 novelty of a solution at the time step level. To do so, we introduce a novel space $\mathcal { D }$ , dubbed state
160
+ 134 descriptor space and a state descriptor extraction function $\psi : { \mathcal { S } } { \mathcal { D } }$ . We assume $\mathcal { D }$ and $\boldsymbol { B }$ have the
161
+ 135 same dimension. Similarly to the novelty of a solution, we now define the novelty of a state $s$ w.r.t. $J$
162
+ 136 other states $\left( s _ { j } \right) _ { j = 1 , \ldots , J }$ as $n : S \times S ^ { J } \to \mathbb { R }$ such that $\begin{array} { r } { n ( s , ( s _ { j } ) _ { j = 1 , \dots , J } ) = \sum _ { j = 1 } ^ { \tilde { J } } | | \psi ( s ) , \psi ( s _ { j } ) | | _ { \mathcal { D } } } \end{array}$
163
+ 137 where $| | . | | _ { \mathcal { D } }$ is a distance metric over $\mathcal { D }$ .
164
+ 138 Now, we need to link novelty defined at the time step level to novelty defined at the solution level. We
165
+ 139 define the novelty of a state w.r.t. a set of solutions. We say that a state is novel w.r.t. some solutions
166
+ 140 if the state is novel w.r.t. to the states visited by these solutions. More formally:
167
+
168
+ $$
169
+ n ( s , ( \theta _ { j } ) _ { j = 1 , \dots , J } ) = \sum _ { j = 1 } ^ { J } \mathbb { E } _ { \pi _ { \theta _ { j } } } \sum _ { t } | | \psi ( s ) , \psi ( s _ { t } ) | | _ { \mathcal { D } } .
170
+ $$
171
+
172
+ 141 While we adopt this definition in this paper, one might as well consider other definitions where, for
173
+ 142 instance, a state is compared to states that have been visited at the same time step during another
174
+ 143 episode. In this context, if the following relation is satisfied:
175
+
176
+ $$
177
+ \mathbb { E } _ { \pi _ { \theta _ { 1 } } } \sum _ { t } n ( s _ { t } , ( \theta _ { j } ) _ { 2 \leq j \leq J } ) = n ( \theta _ { 1 } , ( \theta _ { j } ) _ { 2 \leq j \leq J } ) ,
178
+ $$
179
+
180
+ 144 then we can compute the DPG of $d$ w.r.t. $\theta _ { 1 }$ as
181
+
182
+ $$
183
+ \nabla _ { \theta _ { 1 } } ^ { D P G } = \nabla _ { \theta _ { 1 } } \mathbb { E } _ { \pi _ { \theta _ { 1 } } } \sum _ { t } n ( s _ { t } , ( \theta _ { j } ) _ { 2 \leq j \leq J } ) .
184
+ $$
185
+
186
+ 145 146 This expression corresponds to the classical policy gradient setting whecorresponding reward signal, here dubbed diversity reward, is computed as $r _ { t } ^ { D } = n ( s _ { t } , ( \theta _ { j } ) _ { \ 2 \leq j \leq J } )$ $\gamma = 1$ .
187
+ 147 148 Therefore, this gradient can be comment reward by the diversity reward $r _ { t } ^ { D }$ d using any PG estimation technique replacing the environ-.
188
+ 149 Equation (3) enforces a relation between $\boldsymbol { B }$ and $\mathcal { D }$ and between extraction functions $\psi$ and $\xi$ . In
189
+ 150 practice, it may be hard to define the behavior descriptor and state descriptor of a solution that satisfy
190
+ 151 this relation while being meaningful to the problem at hand and tractable. But a strict equality is not
191
+ 152 necessary. It suffices that an increase on the left-hand side implies an increase on the right-hand side
192
+ 153 so that we can still update $\theta _ { 1 }$ using (4). Furthermore, when this is not the case, the diversity gradient
193
+ 154 update might not result in an increase of diversity in the behavior descriptor space, but in that case the
194
+ 155 MAP-Elites insertion rule will remove the corresponding solution. We show in Section 6 that we can
195
+ 156 define descriptors that do not satisfy the above relation all the time, but still give satisfactory results.
196
+
197
+ A distinguishing feature of our approach is that we combine diversity seeking at the level of trajectories using behavior descriptors and diversity seeking in the state space using state descriptors. The former is used by MAP-Elites to select solutions from the grid and contributes structural bias towards diversity, whereas the latter is used during policy gradient steps in the RL part, see Figure 2b. We organize the literature review below according to this split between two types of diversity seeking mechanisms.
198
+
199
+ # QD search in the solution space
200
+
201
+ 164 Simultaneously maximizing diversity and performance is the central goal of QD methods (Pugh
202
+ 165 et al., 2016; Cully & Demiris, 2017). Among the various possible combinations offered by the
203
+ 166 QD framework, Novelty Search with Local Competition (NSLC) (Lehman & Stanley, 2011b) and
204
+ 167 MAP-Elites (Mouret & Clune, 2015) are the two most popular algorithms. NSLC builds on the Novelty
205
+ 168 Search (NS) algorithm (Lehman & Stanley, 2011a) and maintains an unstructured archive of solutions
206
+ 169 selected for their local performance while MAP-Elites uniformly samples individuals from a structured
207
+ 170 grid that discretizes the BD space. Not clear in its current form. I suggest: "QD-PG uses the standard
208
+ 171 grid of MAP-Elites. However, we also show in Appendix F that QD-PG can be used with alternative
209
+ 172 archive structures.
210
+ 173 With the objective of improving their data-efficiency, QD-ES algorithms that combine QD and ESs,
211
+ 174 such as NSR-ES and NSRA-ES, have been applied to challenging continuous control environments in
212
+ 175 Conti et al. (2018). But, as outlined in Colas et al. (2020), they suffer from poor sample efficiency
213
+ 176 and the diversity and environment reward functions could be mixed in a more efficient way. In that
214
+ 177 respect, the most closely related work w.r.t. ours is ME-ES (Colas et al., 2020). The ME-ES algorithm
215
+ 178 also optimizes quality and diversity using MAP-Elites and two ES populations. Using these methods
216
+ 179 was shown to be critically more efficient than population-based GA algorithms (Salimans et al., 2017),
217
+ 180 but our results show that they are still less sample efficient than off-policy deep RL methods, as they
218
+ 181 do not leverage the analytical computation of the policy gradient at the time step level. To the best
219
+ 182 of our knowledge, no QD or ES algorithm use an explicit critic for both performance and diversity,
220
+ 183 resulting in even higher data-efficiency.
221
+
222
+ # QD search in the state or action spaces
223
+
224
+ 185 Seeking for diversity in the space of states or actions is generally framed into the RL framework. This
225
+ 186 is the case of algorithms maintaining a population of RL agents for exploration without an explicit
226
+ 187 diversity criterion (Jaderberg et al., 2017) or algorithms explicitly looking for diversity but in the
227
+ 188 action space rather than in the state space like ARAC (Doan et al., 2019), P3S-TD3 (Jung et al., 2020)
228
+ 189 and DvD (Parker-Holder et al., 2020).
229
+ 190 An exception is Stanton & Clune (2016) who define a notion of intra-life novelty that is similar to
230
+ 191 our state novelty defined in Section 3. However, their novelty relies on skills rather than states. Our
231
+ 192 work is also related to algorithms using RL mechanisms to search for diversity only (Eysenbach et al.,
232
+ 193 2018; Pong et al., 2019; Lee et al., 2019; Islam et al., 2019). These methods have proven useful in
233
+ 194 sparse reward situations, but they are inherently limited when the reward signal can orient exploration,
234
+ 195 as they ignore it. Other works sequentially combine diversity seeking and RL. The GEP-PG algorithm
235
+ 196 Colas et al. (2018) combines a diversity seeking component, namely Goal Exploration Processes
236
+ 197 (Forestier et al., 2017) and the DDPG deep RL algorithm (Lillicrap et al., 2015). This sequential
237
+ 198 combination of exploration-then-exploitation is also present in GO-EXPLORE (Ecoffet et al., 2019).
238
+ 199 Again, this approach is limited when the reward signal can help driving the exploration process to
239
+ 200 efficient solutions. These sequential approaches first look for diversity in the behavior descriptor
240
+ 201 space, then optimize performance in the state action space, whereas we do so simultaneously in the
241
+ 202 behavior descriptor space and in the state space.
242
+
243
+ To the best of our knowledge, QD-PG is the first algorithm optimizing both diversity and performance in the solution and in the state space, using a sample-efficient policy gradient computation method for the latter.
244
+
245
+ # 5 Methods
246
+
247
+ 07 Our full algorithm is called QD-PG, its pseudo code is given in Appendix A and its architecture is
248
+ 08 depicted in Figure 2. QD-PG is an iterative algorithm based on MAP-Elites that replaces random
249
+ 209 mutations with policy gradient updates. As we consider a continuous action space and want to
250
+ 210 improve sample efficiency by using an off-policy policy gradient method, we rely on the Twin
251
+ 211 Delayed Deterministic Policy Gradient (TD3) algorithm (Fujimoto et al., 2018). See Appendix B for
252
+ 212 a detailed description of TD3.
253
+
254
+ ![](images/c6cf0c77b8bf561d3c8c8a67cf66aa4bec121a2d1e41c96dfa94ada872ba1aa6.jpg)
255
+ Figure 2: (a): The RL part of QD-PG operates at the time step level while the QD part operates at the controller level, considering the MDP as a black box. (b) One QD-PG iteration consists of three phases: 1) A new population of solutions is sampled from the MAP-Elites grid. 2) These solutions are updated by an off-policy RL agent: half of the solutions are optimized for quality and the other half for diversity. The RL agent leverages one shared critic for each objective. 3) The newly obtained solutions are evaluated in the environment. Transitions are stored in a replay buffer while the updated solutions, their final scores and behavior descriptors are stored in the MAP-Elites grid.
256
+
257
+ QD-PG maintains three permanent structures. In the QD part, a MAP-Elites grid stores the most novel and performing solutions. In the RL part, a replay buffer contains all transitions collected when evaluating solutions and an archive A stores all state descriptors obtained so far. QD-PG starts with an initial population of random solutions, evaluates them and inserts them into the MAP-Elites grid. At each iteration, solutions are sampled from the grid, copied, and updated. The updated solutions are then evaluated through one rollout in the environment and inserted into the grid according to insertion rules. Transitions collected during evaluation are stored in the replay buffer, and state descriptors are stored in the archive A. Note that these state descriptors are first filtered to avoid insertion in the archive of multiple state descriptors that are too close to each other.
258
+
259
+ During the update step, half the population is updated with QPG ascent and the other half with DPG ascent. The choice of whether an agent is updated for quality or diversity is random, meaning that it can be updated for quality and later for diversity if selected again. To justify this design, we show in Section 6 that updating consecutively for quality and diversity outperforms updating based on joint criteria. Both gradients are computed from batches of transitions sampled from the replay buffer. The QPG is computed as usual from rewards whereas for DPG, we get fresh novelty rewards as
260
+
261
+ $$
262
+ r _ { t } ^ { D } = \sum _ { j = 1 } ^ { J } | | \psi ( s _ { t } ) , \psi ( s _ { j } ) | | _ { \mathcal { D } } ,
263
+ $$
264
+
265
+ 228 where $\left( s _ { j } \right) _ { j = 1 , \ldots , J }$ are the $J$ nearest neighbors of state $s _ { t }$ in the archive A. Diversity rewards
266
+ 229 must be recomputed at each update because A changes during training. Following Equation (2),
267
+ 230 diversity rewards should be computed as the sum of the distances between the descriptor of $s _ { t }$ and
268
+ 231 the descriptors of all the states visited by a list of $J$ solutions. In practice, we consider the $J$ nearest
269
+ 232 neighbors of $s _ { t }$ . This choice simplifies the algorithm and is faster and works well in practice.
270
+ 233 TD3 relies on a parameterized critic to reduce the variance of its policy gradient estimate. In QD-PG,
271
+ 234 we maintain two parameterized critics $Q _ { w } ^ { D }$ and $Q _ { v } ^ { Q }$ , respectively dubbed diversity and quality critics,
272
+ 235 every time a policy gradient is computed, QD-PG also updates the corresponding critic. In fact, as
273
+ 236 in TD3, we use pairs of critics and target critics to fight the overestimation bias. We share the critic
274
+ 237 parameters among the population as in Pourchot $\&$ Sigaud (2018). Reasons for doing so come from
275
+ 238 the fact that diversity is not stationary, as it depends on the current population. If each agent had
276
+ 239 its own diversity critic, since an agent may not be selected for a large number of generations before
277
+ 240 being selected again, its critic would convey an outdated picture of the evolving diversity. We tried
278
+ 241 this solution, and it failed. A side benefit of critic sharing is that both critics become accurate faster as
279
+ 242 they combine experience from all agents. Additional details on QD-PG implementation are available
280
+ 243 in Appendix C.
281
+
282
+ # 244 6 Experiments
283
+
284
+ In this section, we intend to answer the following matters: 1. Can QD-PG produce collections of diverse and high-performing neural policies and what are the advantages to do so? 2. Is QD-PG more sample efficient than its QD competitors? 3. To what extent are the considered benchmarks difficult for classical policy gradients methods? 4. What is the usefulness of the different components of QD-PG?
285
+
286
+ # Environments
287
+
288
+ We asses QD-PG capabilities in continuous control environments that exhibit high dimensional observation and action spaces as well as strong exploration difficulties. Two types of reward signals, dubbed sparse and deceptive, are known to be particularly difficult for classical RL methods. These rewards appear in many applications such as robotics or combinatorial optimization. Sparse rewards are obtained if a given condition is specified, leading to a majority of null rewards and to credit assignment difficulties. Deceptive rewards are dense signals, i.e., they are non-zero at each time step but can mislead the search process to some local optimum. In such problems, a good approach to the exploration-exploitation trade-off is essential. The agent should learn when to ignore the reward signal and explore to avoid local minima and when to follow it to increase its return. Deceptive environments constitute a natural choice to highlight QD efficiency to balance exploration and exploitation. In this study, we consider three OpenAI Gym environments based on the MUJOCO physics engine that all exhibit strong deceptive rewards (illustrated in Appendix 5). Such environments have been widely used in previous works (Parker-Holder et al., 2020; Colas et al., 2020; Frans et al., 2018; Shi et al., 2020) for their deceptive nature, a characteristic that is absent of more widespread continuous control environments like HALFCHEETAH-V2, HOPPER-V2 or still ANT-V2.
289
+
290
+ In the POINT-MAZE environment, an agent represented as a green sphere must find the exit of the maze depicted in Figure 4a, represented as a red sphere. An observation contains the agent position at time $t$ , and an action corresponds to position increments along the $x$ and $y$ axes. The reward is expressed as the negative Euclidean distance between the center of gravity of the agent and the exit center. The trajectory length cannot exceed 200 steps.
291
+
292
+ The ANT-MAZE environment is modified from OpenAI Gym ANT-V2 (Brockman et al., 2016) and also used in (Colas et al., 2020; Frans et al., 2018). In ANT-MAZE, a four-legged ant has to reach a goal zone located in the lower right part of the maze (colored in green in Figure 4b). Its initial position is sampled in a small circle located in the maze’s extreme bottom left. As in POINT-MAZE, the reward is expressed as the negative Euclidean distance between the ant and the center of the goal zone. Maze walls are organized so that following the gradient of the reward function drives the ant into a dead-end. In ANT-MAZE, the final performance is defined as the maximum reward received during an episode. The environment is considered solved when an agent obtains a score superior to $- 1 0$ , corresponding to reaching the goal zone. An episode consists of 3000 time steps, this horizon is three times larger than in usual MUJOCO environments, making this environment particularly challenging for RL based methods (Vemula et al., 2019).
293
+
294
+ Finally, the ANT-TRAP environment also derives from ANT-V2 and is inspired from (Colas et al., 2020; Parker-Holder et al., 2020). In ANT-TRAP, the four-legged ant initially appears in front of a trap and must bypass it to run as fast as possible in the forward direction (see Figure 4c), as in ANT-V2, the reward is computed as the ant velocity on the x-axis. The trap consists of three walls forming a dead-end directly in front of the ant, leading to a strong deceptive reward. In this environment, the trajectory length cannot exceed 1000 steps. As opposed to POINT-MAZE and ANT-MAZE, where the objective is to reach the exit area, there is no unique way to solve ANT-TRAP and we expect a QD algorithm to generate various effective solutions as depicted in Figure 1.
295
+
296
+ QD-PG is compared to three types of methods. First, to answer question 2, we compare QD-PG to a family of QD baselines, namely ME-ES, NSR-ES, and NSRA-ES (Colas et al., 2020). Appendix E.1 recaps the properties of all these methods. Second, to answer question 3, we compare QD-PG to a family of policy gradient baselines. Soft Actor Critic (SAC) (Haarnoja et al., 2018) and the Twin Delayed Deep Deterministic policy gradient (TD3) (Fujimoto et al., 2018) are continuous control algorithms achieving state-of-the-art results on MUJOCO benchmarks. Random Network Distillation (RND) (Burda et al., 2018) is a curiosity-driven RL agent (Schulman et al., 2017) which was shown to perform well in hard exploration settings. CEM-RL (Pourchot & Sigaud, 2018) mixes Cross-Entropy Methods (CEM) and RL to evolve a population of agents to maximize quality and obtains stateof-the-art results MUJOCO benchmarks. Finally, to answer question 4, we propose to investigate the following matters: Can we replace alternating quality and diversity updates by a single update that optimizes for the sum of both criteria? Are quality gradients updates alone enough to fill the MAP-Elites grid? Are diversity gradients updates alone enough to do so? Consequently, we consider the following ablations of QD-PG: QD-PG SUM computes a gradient to optimize the sum of the quality and diversity rewards, D-PG applies only diversity gradients to the solutions, and Q-PG applies only quality gradients, but both D-PG and Q-PG still use QD selection (see Appendix E.1).
297
+
298
+ We compare QD-PG to its ablations and RL competitors in all environments and show results in Table 1a. Detailed results including graphic charts and coverage maps are given in Appendix E and more details about the evaluation procedure are given in Appendix E.1.
299
+
300
+ # 7 Results
301
+
302
+ # 1. Can QD-PG produce collections of neural policies and what are the advantages to do so?
303
+
304
+ 312 Table 1a presents QD-PG performances. In all environments, our algorithm manages to find working
305
+ 313 solutions that avoid local minima and reach the overall objective. In addition to its exploration
306
+ 314 capabilities, QD-PG generates collections of high performing solutions in a single run. During the
307
+ 315 ANT-TRAP experiment, the final collection of solutions returned by QD-PG contained, among others,
308
+ 316 5 solutions that were within a $10 \%$ performance margin from the best one. As illustrated in Figure 1,
309
+ 317 these agents typically differ in their gaits and preferred trajectories to circumvent the trap.
310
+
311
+ Generating a collection of diverse solutions comes with the benefit of having a repertoire of diverse solutions that can be used as alternatives when the MDP changes (Cully et al., 2015). We show that QD-PG is more robust than conventional policy gradient methods by changing the reward signal of the ANT-MAZE environment. We replace the original goal in the bottom right part of the maze (see Figure 3) with a new randomly located goal in the maze. Instead of running QD-PG to optimize for this new objective, we run a Bayesian optimization process to quickly find a good solution among the ones already stored in the grid. With a budget of only 20 solutions to be tested during the Bayesian optimization process, we are able to quickly recover a good solution for the new objective. We repeat this experiment 100 times, each time with a different random goal, and obtain an average performance of $- 1 0$ with a standard deviation of 9. In other words, 20 interaction episodes (corresponding to 60.000 time steps) suffice for the adaptation process to find a solution that performs well for the new objective without the need to re-train agents. More detailed results can be found in Appendix E.3. 2
312
+
313
+ ![](images/5dae693770ba1c498f1b1a8601153b56deb949b863f6dcdd179ab5d84b7a521d.jpg)
314
+ Figure 3: QD-PG produces a collection of diverse solutions. In ANT-MAZE, even after setting new randomly located goals, the MAP-Elites grid still contains solutions that are suited for the new objectives.
315
+
316
+ # 2. Is it more sample efficient than its QD competitors?
317
+
318
+ Table 1b compares QD-PG to Deep Neuroevolution algorithms with a diversity seeking component in terms of sample efficiency. QD-PG runs on 10 CPU cores for 2 days while its competitors used 1000 CPU cores for the same duration. Nonetheless, QD-PG matches the asymptotic performance of ME-ES using two orders of magnitude fewer samples, explaining the lower resource requirements.
319
+
320
+ Table 1: Results for all environments. Final Perf. is the minimum distance to the goal in ANT-MAZE and the episode return in POINT-MAZE and ANT-TRAP. The Ratio to ours column compares the sample efficiency of a method to QD-PG.
321
+
322
+ (a) Comparison to ablations and PG baselines.
323
+
324
+ <table><tr><td></td><td colspan="3">Final Perf.(± std)</td></tr><tr><td>Algorithm</td><td>POINT-MAZE</td><td>ANT-MAZE</td><td>ANT-TRAP</td></tr><tr><td>QD-PG</td><td>-24(±0)</td><td>-7(±7)</td><td>1541(±86)</td></tr><tr><td>QD-PG SUM</td><td>-25(±1)</td><td>-5(±3)</td><td>1018(±6)</td></tr><tr><td>D-PG</td><td>-37(±3)</td><td>-2(±0)</td><td>1016(±8)</td></tr><tr><td>Q-PG</td><td>-128(±0)</td><td>-26(±0)</td><td>1175(±79)</td></tr><tr><td>CEM-RL</td><td>-312(±1)</td><td>-26(±0)</td><td>934(±22)</td></tr><tr><td>SAC</td><td>-127(±1)</td><td>-59(±1)</td><td>1049(±21)</td></tr><tr><td>TD3</td><td>-130(±2)</td><td>-26(±0)</td><td>1131(±7)</td></tr><tr><td>RND</td><td>-35(±10)</td><td>-27(±1)</td><td>978(±61)</td></tr></table>
325
+
326
+ (b) Comparison to evolutionary competitors.
327
+
328
+ <table><tr><td></td><td colspan="3">ANT-MAZE</td></tr><tr><td>Algorithm</td><td>Final Perf.</td><td>Steps to goal</td><td>Ratio to ours</td></tr><tr><td>QD-PG</td><td>-7(±7)</td><td>1.15e8</td><td>1</td></tr><tr><td>CEM-RL</td><td>-26(±0)</td><td>8</td><td>8</td></tr><tr><td>ME-ES</td><td>-5(±1)</td><td>2.4e10</td><td>209</td></tr><tr><td>NSR-ES</td><td>-26(±0)</td><td>8</td><td>8</td></tr><tr><td>NSRA-ES</td><td>-2(±1)</td><td>2.1e10</td><td>182</td></tr></table>
329
+
330
+ 342 We see three reasons for the improved sample efficiency of QD-PG: 1) QD-PG leverages a replay
331
+ 343 buffer and can re-use each sample several times. 2) QD-PG leverages novelty at the state level and
332
+ 344 can exploit all collected transitions to maximize quality and diversity. For instance, in ANT-MAZE,
333
+ 345 a trajectory brings 3000 samples to QD-PG while standard QD methods would consider it a unique
334
+ 346 sample. 3) PG exploits the analytical gradient between the neural network weights and the resulting
335
+ 347 policy action distribution and estimates only the impact of the distribution on the return. By contrast,
336
+ 348 standard QD methods directly estimate the impact on the return of randomly modifying the weights.
337
+
338
+ # 3. To what extent the considered benchmarks are difficult for policy gradients methods?
339
+
340
+ Table 1a compares QD-PG to state-of-the-art policy gradient algorithms and validates that classical policy gradient methods fail to find optimal solutions in deceptive environments. TD3 quickly converges to local minima of performance resulting from being attracted in dead-ends by the deceptive gradients. While we may expect SAC to better explore due to entropy regularization, it also converges to that same local minima in ANT-TRAP and POINT-MAZE. Besides, despite its exploration mechanism based on CEM, CEM-RL also quickly converges to local optima in all benchmarks, confirming the need for a dedicated diversity seeking component. RND, which adds an exploration bonus used as an intrinsic reward (see Appendix G for more details), also demonstrates performances inferior to QD-PG in all environments but manages to solve POINT-MAZE. In ANT-MAZE and ANT-TRAP, as shown in Appendix G.2, RND extensively explores the BD space but fails to obtain high returns.
341
+
342
+ # 4. What is the usefulness of the different components of QD-PG ?
343
+
344
+ The ablation study in Table 1a shows that when maximising quality only, Q-PG fails due to the deceptive nature of the reward and when maximizing diversity only, D-PG sufficiently explores to solve the problem in both POINT-MAZE and ANT-MAZE but requires more steps and finds lowerperforming solutions. When optimizing simultaneously for quality and diversity, QD-PG SUM fails to learn in ANT-TRAP and manages to solve the task in ANT-MAZE but requires more samples than QD-PG. We hypothesize that quality and diversity rewards may give rise to conflicting gradients. For instance, at the beginning of training in ANT-TRAP, the quality reward drives the ant forward whereas the diversity reward drives it back to escape the trap and explore the environment. Therefore, both rewards cancel each other, preventing any learning. This study validates the usefulness of QD-PG components: 1) optimizing for diversity is required to overcome the deceptive nature of the reward; 2) adding quality optimization provides better asymptotic performance; 3) it is better to disentangle quality and diversity updates.
345
+
346
+ # 8 Conclusion
347
+
348
+ This paper is the first to introduce a diversity gradient to explore diversity both at the state and skill levels. Based on this component we proposed a novel algorithm, QD-PG, inspired from the Quality-Diversity literature, that produces collections of diverse and high-performing neural policies in a sample-efficient manner. We showed experimentally that QD-PG generates several solutions that achieve high returns in challenging exploration problems. Finally, we demonstrated that in a few interactions with the environment, QD-PG finds alternative solutions that still obtain good performance when the MDP changes.
349
+
350
+ # References
351
+
352
+ 382 Alvarez, A., Dahlskog, S., Font, J., and Togelius, J. Empowering quality diversity in dungeon design with interactive constrained map-elites. In 2019 IEEE Conference on Games (CoG), pp. 1–8. IEEE, 2019.
353
+ 385 Brockman, G., Cheung, V., Pettersson, L., Schneider, J., Schulman, J., Tang, J., and Zaremba, W. Openai gym. arXiv preprint arXiv:1606.01540, 2016.
354
+ 87 Burda, Y., Edwards, H., Storkey, A., and Klimov, O. Exploration by random network distillation. arXiv preprint arXiv:1810.12894, 2018.
355
+ 389 Cazenille, L., Bredeche, N., and Aubert-Kato, N. Exploring self-assembling behaviors in a swarm of bio-micro-robots using surrogate-assisted map-elites. arXiv preprint arXiv:1910.00230, 2019. Colas, C., Sigaud, O., and Oudeyer, P.-Y. GEP-PG: Decoupling exploration and exploitation in deep reinforcement learning algorithms. arXiv preprint arXiv:1802.05054, 2018. Colas, C., Madhavan, V., Huizinga, J., and Clune, J. Scaling map-elites to deep neuroevolution. In Proceedings of the 2020 Genetic and Evolutionary Computation Conference, pp. 67–75, 2020. Conti, E., Madhavan, V., Such, F. P., Lehman, J., Stanley, K., and Clune, J. Improving exploration in evolution strategies for deep reinforcement learning via a population of novelty-seeking agents. In Advances in neural information processing systems, pp. 5027–5038, 2018. Cully, A. and Demiris, Y. Quality and diversity optimization: A unifying modular framework. IEEE Transactions on Evolutionary Computation, 22(2):245–259, 2017.
356
+ 00 Cully, A., Clune, J., Tarapore, D., and Mouret, J.-B. Robots that can adapt like animals. Nature, 521 (7553):503–507, 2015. Doan, T., Mazoure, B., Durand, A., Pineau, J., and Hjelm, R. D. Attraction-repulsion actor-critic for continuous control reinforcement learning. arXiv preprint arXiv:1909.07543, 2019.
357
+ 04 Doncieux, S., Laflaquière, A., and Coninx, A. Novelty search: a theoretical perspective. In Proceedings of the Genetic and Evolutionary Computation Conference, pp. 99–106, 2019.
358
+ 06 Ecoffet, A., Huizinga, J., Lehman, J., Stanley, K. O., and Clune, J. Go-explore: a new approach for hard-exploration problems. arXiv preprint arXiv:1901.10995, 2019. Eysenbach, B., Gupta, A., Ibarz, J., and Levine, S. Diversity is all you need: Learning skills without a reward function. arXiv preprint arXiv:1802.06070, 2018.
359
+ 10 Forestier, S., Mollard, Y., and Oudeyer, P.-Y. Intrinsically motivated goal exploration processes with automatic curriculum learning. arXiv preprint arXiv:1708.02190, 2017.
360
+ 412 Frans, K., Ho, J., Chen, X., Abbeel, P., and Schulman, J. Meta learning shared hierarchies. Proc. of ICLR, 2018.
361
+ 414 Fujimoto, S., Van Hoof, H., and Meger, D. Addressing function approximation error in actor-critic methods. arXiv preprint arXiv:1802.09477, 2018.
362
+ 16 Haarnoja, T., Zhou, A., Hartikainen, K., Tucker, G., Ha, S., Tan, J., Kumar, V., Zhu, H., Gupta, A., Abbeel, P., et al. Soft actor-critic algorithms and applications. arXiv preprint arXiv:1812.05905, 2018.
363
+ 419 Islam, R., Ahmed, Z., and Precup, D. Marginalized state distribution entropy regularization in policy optimization. arXiv preprint arXiv:1912.05128, 2019. Jaderberg, M., Dalibard, V., Osindero, S., Czarnecki, W. M., Donahue, J., Razavi, A., Vinyals, O., Green, T., Dunning, I., Simonyan, K., et al. Population-based training of neural networks. arXiv preprint arXiv:1711.09846, 2017.
364
+ 424 Jung, W., Park, G., and Sung, Y. Population-guided parallel policy search for reinforcement learning. In International Conference on Learning Representations, 2020.
365
+ 426 Khadka, S. and Tumer, K. Evolution-guided policy gradient in reinforcement learning. In Neural Information Processing Systems, 2018.
366
+ 428 Khadka, S., Majumdar, S., Miret, S., Tumer, E., Nassar, T., Dwiel, Z., Liu, Y., and Tumer, K. Collaborative evolutionary reinforcement learning. arXiv preprint arXiv:1905.00976, 2019. Koos, S., Mouret, J.-B., and Doncieux, S. The transferability approach: Crossing the reality gap in evolutionary robotics. IEEE Transactions on Evolutionary Computation, 17(1):122–145, 2012. Lee, L., Eysenbach, B., Parisotto, E., Xing, E., Levine, S., and Salakhutdinov, R. Efficient exploration via state marginal matching. arXiv preprint arXiv:1906.05274, 2019.
367
+ 434 Lehman, J. and Stanley, K. O. Abandoning objectives: Evolution through the search for novelty alone. Evolutionary computation, 19(2):189–223, 2011a. Lehman, J. and Stanley, K. O. Evolving a diversity of virtual creatures through novelty search and local competition. In Proceedings of the 13th annual conference on Genetic and evolutionary computation, pp. 211–218, 2011b.
368
+ 439 Lillicrap, T. P., Hunt, J. J., Pritzel, A., Heess, N., Erez, T., Tassa, Y., Silver, D., and Wierstra, D. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971, 2015. Mouret, J.-B. and Clune, J. Illuminating search spaces by mapping elites. arXiv preprint arXiv:1504.04909, 2015. Nasiriany, S., Pong, V. H., Lin, S., and Levine, S. Planning with goal-conditioned policies. arXiv preprint arXiv:1911.08453, 2019. Parker-Holder, J., Pacchiano, A., Choromanski, K., and Roberts, S. Effective diversity in populationbased reinforcement learning. In Neural Information Processing Systems, 2020. Pong, V. H., Dalal, M., Lin, S., Nair, A., Bahl, S., and Levine, S. Skew-fit: State-covering selfsupervised reinforcement learning. arXiv preprint arXiv:1903.03698, 2019.
369
+ 449 Pourchot, A. and Sigaud, O. Cem-rl: Combining evolutionary and gradient-based methods for policy search. arXiv preprint arXiv:1810.01222, 2018. Pugh, J. K., Soros, L. B., and Stanley, K. O. Quality diversity: A new frontier for evolutionary computation. Frontiers in Robotics and AI, 3:40, 2016. Salimans, T., Ho, J., Chen, X., Sidor, S., and Sutskever, I. Evolution strategies as a scalable alternative to reinforcement learning. arXiv preprint arXiv:1703.03864, 2017. Schulman, J., Moritz, P., Levine, S., Jordan, M., and Abbeel, P. High-dimensional continuous control using generalized advantage estimation. arXiv preprint arXiv:1506.02438, 2015. Schulman, J., Wolski, F., Dhariwal, P., Radford, A., and Klimov, O. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
370
+ 459 Shi, L., Li, S., Zheng, Q., Yao, M., and Pan, G. Efficient novelty search through deep reinforcement learning. IEEE Access, 8:128809–128818, 2020. Silver, D., Lever, G., Heess, N., Degris, T., Wierstra, D., and Riedmiller, M. Deterministic policy gradient algorithms. In Proceedings of the 30th International Conference in Machine Learning, 2014. Stanton, C. and Clune, J. Curiosity search: producing generalists by encouraging individuals to continually explore and acquire skills throughout their lifetime. PloS one, 11(9):e0162235, 2016. Sutton, R. S., McAllester, D. A., Singh, S. P., Mansour, Y., et al. Policy gradient methods for reinforcement learning with function approximation. In NIPs, volume 99, pp. 1057–1063. Citeseer, 1999.
371
+ 469 Vemula, A., Sun, W., and Bagnell, J. Contrasting exploration in parameter and action space: A zerothorder optimization perspective. In The 22nd International Conference on Artificial Intelligence and Statistics, pp. 2926–2935. PMLR, 2019.
372
+
373
+ 1. For all authors...
374
+
375
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
376
+ (b) Did you describe the limitations of your work? [Yes]
377
+ (c) Did you discuss any potential negative societal impacts of your work? [No] We believe that this work, in itself, is not prone to have any negative societal impact.
378
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
379
+
380
+ 2. If you are including theoretical results...
381
+
382
+ (a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
383
+
384
+ 3. If you ran experiments...
385
+
386
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] The code and instructions to run it are available in the supplementary materials.
387
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Implementation details, hardware details and hyperparameters are presented in Appendix C.
388
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] Yes, we report mean and variance for all experiments, both graphically and in result tables.
389
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] Computational details are provided in Appedix C.
390
+
391
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
392
+
393
+ (a) If your work uses existing assets, did you cite the creators? [Yes] We use open sourced RL environments.
394
+ (b) Did you mention the license of the assets? [Yes] We cite the Mujoco physics engine, for which we have licenses.
395
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes] We provide appendices, source code and a demonstration website.
396
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
397
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
398
+
399
+ 5. If you used crowdsourcing or conducted research with human subjects...
400
+
401
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] We did not used crowdsourcing or conducted research with human subjects.
402
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] This work did not involve research with human subjects
403
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] This work did not involve research with human subjects
md/train/5nLibPckV2N/5nLibPckV2N.md ADDED
@@ -0,0 +1,276 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Fairness via Representation Neutralization
2
+
3
+ Mengnan $\mathbf { D } \mathbf { u } ^ { 1 }$ ∗, Subhabrata Mukherjee2, Guanchu Wang3, Ruixiang Tang3, Ahmed Hassan Awadallah2, Xia $\mathbf { H } \mathbf { u } ^ { 3 }$
4
+
5
+ 1Texas A&M University 2Microsoft Research 3Rice University dumengnan@tamu.edu, {submukhe,hassanam}@microsoft.com {guanchu.wang,rt39,xia.hu}@rice.edu
6
+
7
+ # Abstract
8
+
9
+ Existing bias mitigation methods for DNN models primarily work on learning debiased encoders. This process not only requires a lot of instance-level annotations for sensitive attributes, it also does not guarantee that all fairness sensitive information has been removed from the encoder. To address these limitations, we explore the following research question: Can we reduce the discrimination of DNN models by only debiasing the classification head, even with biased representations as inputs? To this end, we propose a new mitigation technique, namely, Representation Neutralization for Fairness (RNF) that achieves fairness by debiasing only the task-specific classification head of DNN models. To this end, we leverage samples with the same ground-truth label but different sensitive attributes, and use their neutralized representations to train the classification head of the DNN model. The key idea of RNF is to discourage the classification head from capturing undesirable correlation between fairness sensitive information in encoder representations with specific class labels. To address low-resource settings with no access to sensitive attribute annotations, we leverage a bias-amplified model to generate proxy annotations for sensitive attributes. Experimental results over several benchmark datasets demonstrate our RNF framework to effectively reduce discrimination of DNN models with minimal degradation in task-specific performance.
10
+
11
+ # 1 Introduction
12
+
13
+ Deep neural networks (DNNs) have made significant advances in recent times [1, 2, 3], and have been deployed in many real-world applications. However, DNNs often suffer from biases and show discrimination towards certain demographics, especially in high-stake applications, such as criminal justice, employment, loan approval, credit scoring, etc [4, 5, 6]. For example, COMPAS, an algorithmic recidivism predictor, is likely to associate African-American offenders with higher risk scores compared to Caucasians while having a similar profile [7]. This brings significant harm to both society and individuals, thus leading to recent focus on mitigation techniques to alleviate the adverse effects of DNN biases.
14
+
15
+ Existing debiasing methods usually work on learning debiased representations at the encoderlevel. One representative family of methods perform mitigation by explicitly learning debiased representations, either through adversarial learning [8, 9, 10] or invariant risk minimization [11, 12]. Another family of methods [13, 14, 15] implicitly learn debiased representations by incorporating explanation during model training to suppress it from paying high attention to biased features in the original input. Essentially, the above methods aim to remove the bias from deep representations.
16
+
17
+ Learning debiased representations is a technically challenging problem. Firstly, it is hard to remove all fairness sensitive information in the encoder. The suppression of fairness sensitive information might also remove useful information that is task relevant. Secondly, most existing debiasing methods assume access to additional meta-data such as fairness sensitive attributes and a lot of annotations corresponding to the protected groups to guide the learning of debiased representations. However, such resources are expensive to obtain, if not unavailable, for most real world applications.
18
+
19
+ To address these limitations, we explore the following research question: Can we reduce the discrimination of DNN models by only debiasing the task-specific classification head, even with a biased representation encoder? Our work is motivated by the empirical observation that standard training can result in the classification head capturing undesirable correlation between fairness sensitive information and specific class labels. Some recent works [16, 17, 18] have explored such spurious or shortcut learning behavior of DNNs in various applications. To this end, we propose the RNF (Representation Neutralization for Fairness) framework for mitigation, motivated by the Mixup work [19, 20]. We first train a biased teacher network via standard cross entropy loss. In the second stage, we freeze the representation encoder of the biased teacher, and only update the classification head via representation neutralization. This discourages the model from associating biased features with specific class labels, and enforces the model to focus more on task relevant information. To address low-resource settings, our RNF framework does not require any access to the protected attributes during training. To this end, we train a bias-amplified model using generalized cross entropy loss that is used to generate proxy annotations for sensitive attributes. Experimental results over several benchmark tabular and image datasets demonstrate our RNF framework to significantly reduce discrimination of DNN models with minimal degradation of the task performance. The major contributions of our work can be summarized as follows:
20
+
21
+ • We analyze bias propagation from the encoder representations to the final task-specific layer demonstrating that DNN models heavily rely on undesirable correlations for prediction.
22
+ • We introduce RNF, a bias mitigation framework for DNN models via representation neutralization. Our RNF framework achieves mitigation without any access to instance-level sensitive attribute annotations, and instead relies on self-generated proxy annotations.
23
+ • Experimental results on several benchmark datasets demonstrate the effectiveness of our RNF framework via debiasing only the classification head while using biased representations as input. Additionally, we show RNF to be complementary to existing methods that learn debiased encoders and can be further improved within our framework.
24
+
25
+ # 2 Related Work
26
+
27
+ We briefly review bias mitigation and broader robustness literature which are most relevant to ours.
28
+
29
+ Bias Mitigation. Recent studies have indicated that DNN models exhibit social bias towards certain demographic groups. This has led to increased attention to bias mitigation techniques in recent times [21, 22, 23]. Existing mitigation methods can be generally grouped into three broad categories. The first one is based on adversarial training [8, 9, 10]. It leads to a fair classifier as the predictions cannot carry any group discrimination information that the adversary can exploit. However, this method assumes that the sensitive attribute annotations are known, and uses those annotations to learn debiased representations. The second representative family of mitigation methods is based on explainability [13, 14, 15, 24]. These methods require fine-grained feature-level annotations to specify which subset of features are fairness sensitive. The third category falls under the umbrella of causal fairness [25, 11, 12]. The main idea is to enforce the model to concentrate more on task relevant causal features, and getting rid of superficial correlations [26]. This results in the model capturing debiased representations. For instance, [27] minimizes the correlation between sentence representations and bias words using a contrastive learning framework. We can typically decouple the classification problem into representation learning and classification as the two major parts [28]. Different from the above-mentioned methods that mainly aim to train the debiased representations, our work focuses on the classification head and aims to suppress it from capturing undesirable correlation between fairness sensitive attributes and class labels.
30
+
31
+ Shortcut Learning in DNNs. Our work is motivated by the observation that DNNs with standard training are prone to exploit undesirable correlations (or shortcuts in the dataset) for prediction [16, 29]. Beyond algorithmic discrimination, recent studies show that shortcut learning [17] can result in other undesirable consequences like poor generalization and adversarial vulnerability. Specifically, this leads to a high performance degradation for previously unseen inputs, especially for those data beyond held-out test set. Representative tasks depicting such behavior include reading comprehension [30], natural language inference [18], visual question answering[31] and deepfake detection [32].
32
+
33
+ ![](images/4f87e639c46a2629a698cb9f47b7bef8705729e59c21d9b8e4d05a01c94db98d.jpg)
34
+ Figure 1: Representation analysis of $z$ using Kernel PCA. (a) Protected attribute $a$ (i.e., gender) is a discriminative feature. In this plot, the male group primarily lies in the lower left interval, whereas the female group is located primarily on the upper right interval. (b) Predicted positive label and negative task-label distribution. (c) Representation neutralization (please refer to Sec. 3.3) to reduce the discriminative power of $a$ for dimensions relevant to the sensitive information, comparing to the distribution in (a). (d) Neutralization still preserves the useful task relevant information.
35
+
36
+ The most similar work to ours also regularizes the model training using interpolated samples between groups [33]. Similar to the aforementioned solutions, this work also heavily relies on sensitive attribute annotations in the training set. This limits the application scenarios of the mitigation algorithms, especially for many real-world applications without readily available annotations dealing with sensitive attributes. Our representation neutralization framework achieves comparable or better performance to such techniques without relying on such sensitive annotations by leveraging proxy annotations obtained from a bias-intensified version of our framework, thereby, making it broadly applicable to arbitrary real-world applications.
37
+
38
+ # 3 Representation Neutralization for Fairness
39
+
40
+ In this section, we first analyze the task-specific classification head of a DNN to examine how bias is propagated from the encoder representation layer to the task-specific output layer (Section 3.2). We empirically demonstrate the undesirable correlation between fairness sensitive information in representations with specific class labels. Based on the observation, we introduce the Representation Neutralization for Fairness (RNF) framework to debias DNN models (Section 3.3). Finally, we propose an approach to generate proxy annotations for sensitive attributes, enabling the RNF framework to be applicable to low-resource settings with no access to sensitive attribute annotations (Section 3.4).
41
+
42
+ # 3.1 Notations
43
+
44
+ We first introduce the notations used in this work. Let $\mathcal { X } = \{ x _ { i } , y _ { i } , a _ { i } \} , i \in { 1 , . . . , N }$ be the training set, where $x _ { i }$ is the input feature, $y _ { i }$ denotes the ground truth label, and $a _ { i }$ represents the sensitive attribute (e.g., gender, race, age). For ease of notation, in the following sections, we consider binary sensitive attributes2. Nevertheless, our proposed mitigation framework can also be applied to non-binary sensitive attributes (e.g., age).
45
+
46
+ Consider the classification model $f ( x , \theta ) = c ( g ( x ) )$ , parameterized with $\theta$ as the model parameters. Here $g ( x ) : \mathcal { X } \mathcal { Z }$ represents the feature encoder, and $g ( x ) = z$ is the representation for $x$ obtained from a DNN model. The predictor $c ( z ) : { \mathcal { Z } } \to { \mathcal { Y } }$ is the multi-layer classification head. It is depicted by the top layer(s) of the DNN, which takes the encoded representation $z$ as input and maps it to softmax probability. The final class prediction is denoted by $\tilde { y } = \arg \operatorname* { m a x } c ( z )$ . In this work, we aim to reduce the discrimination of DNN models by only debiasing the classification head $c ( z )$ , with the biased representation encoder $g ( x )$ as input.
47
+
48
+ # 3.2 Analysis of the Classification Head
49
+
50
+ In this section, we examine how bias manifests in the representation space $\mathcal { Z }$ as well as how the classification head $c ( z )$ obtained with standard training scheme propagates bias from the representation layer to the model output layer. To this end, we train a biased network $f _ { T } ( x )$ via standard cross entropy loss, where the following experiment is performed using the Adult dataset [34].
51
+
52
+ Representation Probing Analysis. For the Adult training set, we generate representation vectors for 500 training samples using the biased network $f _ { T } ( x )$ and project them in 2D for visualization. To this end, we utilize the Kernel Principal Component Analysis (KPCA) [35] with a sigmoid kernel, which is a tool to visualize high-dimensional data. Since the classification head $c ( z )$ contains multiple non-linear layers, we choose kernel PCA instead of a linear dimensionality reduction method such as linear PCA. The visualization is shown in Figure 1 (a). The plot depicts that the low dimensional projection separates the two protected groups in two areas, where the male group is primarily located in the lower left area, whereas the female group primarily occupies the upper right area. Comparing the task-label $y$ distribution in Figure 1 (b) with the protected group distribution in Figure 1 (a), we observe that the protected attribute information is a discriminative feature that could be exploited by the task classification head for prediction.
53
+
54
+ Role of the Biased Classification Head. The above demonstrative analysis indicates that the model representation captures both useful task relevant classification information as well as bias information from protected attributes. Specifically, the model captures strong correlation between the fairness sensitive information and the class labels. On analyzing the data distribution, we observe this to be an artifact of the conditional label distribution with respect to the sensitive attributes being skewed. The model relies on this shortcut for prediction, resulting in bias amplification. We observe the male neurons to positively correlate to the desirable label (also refer to the experimental analysis in Sec. 4.3), whereas the female neurons positively correlate to undesirable label. This depicts an undesirable correlation between sensitive information with certain class labels in the model.
55
+
56
+ Our Motivation. Based on the above empirical observations, we propose to neutralize the training samples (Fig 1 (c)) so as to reduce the discriminative power of the fairness sensitive information, while at the same time preserving task relevant information (Fig 1 (d)). With the neutralized training data, we propose to re-train the classification head. Our goal is to adjust the decision boundary to implicitly de-correlate the fairness sensitive information in the representation space with class labels.
57
+
58
+ # 3.3 Representation Neutralization for Debiasing Classification Head
59
+
60
+ Based on the aforementioned empirical observations, in this section we propose a simple yet effective bias mitigation framework via Representation Neutralization for Fairness (RNF). RNF does not require any prior knowledge about existing bias in the representation space; nor does it require any knowledge about specific dimension(s) encoding the sensitive attributes – making it widely useful for arbitrary applications. Our goal is to encourage the model to ignore the sensitive attributes and instead focus more on task relevant information.
61
+
62
+ RNF is implemented in two steps (see Figure 2). In the first step, we train the model using cross entropy loss, and obtain a biased teacher network $f _ { T } ( x )$ . During the second step, we freeze the encoder $g ( x )$ for $f _ { T } ( x )$ , and use it as our backbone encoder for learning representations. We then re-train only the classification head $c ( z )$ using feature neutralization (see Figure 2 (b)).
63
+
64
+ Representation Neutralization. To this end, while training the classification head, for an input sample $\{ x _ { 1 } , y , a _ { 1 } \}$ , we randomly select another sample $\{ x _ { 2 } , y , a _ { 2 } \}$ , with the same class label $y$ but a different sensitive attribute $a _ { 2 }$ compared to $a _ { 1 }$ in the input sample. Now we compute the corresponding representations $z _ { 1 } = g ( x _ { 1 } )$ and $z _ { 2 } = g ( x _ { 2 } )$ and re-train the classification head using the neutralized representation the neutralized $\begin{array} { r } { z = \frac { z _ { 1 } + z _ { 2 } } { 2 } } \end{array}$ as inbility supervision label after temperature $y$ for the classification head, we utilizecaling obtained as follows. Given the $\begin{array} { r } { y = \frac { p _ { 1 } + p _ { 2 } } { 2 } } \end{array}$
65
+ logit vector $z _ { 1 }$ for input $x _ { 1 }$ , the probability for class $i$ is computed as $\begin{array} { r } { p _ { 1 , i } = \frac { \exp ( z _ { 1 , i } / T ) } { \sum _ { j } \exp ( z _ { 1 , j } / T ) } } \end{array}$ , where $T \geq 1$ . This can be regarded as a form of knowledge distillation [36], where $T > 1$ softens the softmax score. A larger temperature prevents the model from assigning over-confident prediction probabilities. A special case for RNF is when $T = 1$ , where $p _ { 1 }$ and $p _ { 2 }$ are the standard softmax probabilities obtained from the biased teacher network $f _ { T } ( x )$ .
66
+
67
+ ![](images/0c76773c333ac8c9a63aa9c9b54f33638412319e47f79c29080bb14557cd9cbf.jpg)
68
+ Figure 2: Debiasing with representation neutralization. (a) We first train a biased teacher network using only cross entropy loss. For two inputs $x _ { 1 }$ and $x _ { 2 }$ that with the same class label $y$ and different sensitive attribute $a$ , we obtain the representations $z _ { 1 }$ and $z _ { 2 }$ , and softened probabilities $p _ { 1 }$ and $p _ { 2 }$ . (b) We freeze parameters of the biased encoder and only re-train the classification head using the neutralized representation $\frac { z _ { 1 } + z _ { 2 } } { 2 }$ as input, and softened probability $\frac { p _ { 1 } + p _ { 2 } } { 2 }$ as supervision signal.
69
+
70
+ We use the knowledge distillation loss. In particular, the mean squared error (MSE) loss is used as a distance-based metric to measure the similarity between model prediction and the supervision signal.
71
+
72
+ $$
73
+ \mathcal { L } _ { \mathrm { M S E } } = ( \hat { y } _ { i } - y ) ^ { 2 } = \{ c ( \frac { 1 } { 2 } z _ { 1 } + \frac { 1 } { 2 } z _ { 2 } ) - ( \frac { 1 } { 2 } p _ { 1 } + \frac { 1 } { 2 } p _ { 2 } ) \} ^ { 2 } .
74
+ $$
75
+
76
+ where, $c$ is the classification head to project representations to softmax prediction probability.
77
+
78
+ There are two main benefits of the aforementioned training scheme. From the input perspective, the neutralization of representations suppresses the model from capturing the undesirable correlation between fairness sensitive information in the representation with the class labels. From the output perspective, the softened label encourages the model to assign similar predictions to different sensitive groups. Optimizing Eq. (1) can lead to reduced generalization gap between the two groups.
79
+
80
+ Theorem 1 Given a well-trained representation encoder $g ( x ) \ = \ z$ satisfying $| | z _ { 1 } - z _ { 2 } | | _ { 2 } \leq$ $\lambda _ { z } | p _ { 1 } - p _ { 2 } |$ for $x _ { 1 } , x _ { 2 } \ \in \ { \mathcal { X } }$ and a bounded loss function $L ( c ( z _ { i } ) , p _ { i } ) = ( 1 - p _ { i } ) l ( c ( z _ { i } ) , y =$ $0 ) + p _ { i } l ( c ( z _ { i } ) , y = 1 )$ , where $l ( c ( z _ { i } ) , y ~ = ~ j ) ~ \le ~ \epsilon _ { L }$ for $x _ { i } ~ \in ~ { \mathcal { X } }$ and $j ~ = ~ 0 , 1$ ; if the classification head c minimizes the loss between neutralized representation and soft probabilities, i.e. $\left| \Big | \nabla _ { z } L ( c ( z ) , p ) \big | _ { z = \frac { z _ { 1 } + z _ { 2 } } 2 , p = \frac { p _ { 1 } + p _ { 2 } } 2 } \Big | \right| _ { 2 } \ \le \ \epsilon _ { c } ,$ , where $z ~ = ~ g ( x )$ , $x _ { 1 } ~ \sim ~ P ( x _ { 1 } ~ \mid ~ a _ { i } ~ = ~ 0 )$ , $x _ { 2 } \sim P ( x _ { 2 } \mid a _ { i } = 1 )$ , $| p _ { 1 } - p _ { 2 } | \le \epsilon _ { p }$ , the gap of generalization loss between groups $a = 0$ and $a = 1$ is bounded by:
81
+
82
+ $$
83
+ \begin{array} { r } { \left| \mathbb { E } _ { x _ { i } \sim P ( x _ { i } \mid a _ { i } = 0 ) } L ( c ( z _ { i } ) , p _ { i } ) - \mathbb { E } _ { x _ { j } \sim P ( x _ { j } \mid a _ { j } = 1 ) } L ( c ( z _ { j } ) , p _ { j } ) \right| \le \epsilon _ { p } ( \lambda _ { z } \epsilon _ { c } + \epsilon _ { L } ) } \end{array}
84
+ $$
85
+
86
+ Here “well-trained” means that the model has learned reasonably good representations to encode sufficient task relevant information. Essentially, after training for a sufficient number of epochs until the validation loss has converged, we have access to a reasonably good representation space (although it might encode a lot of fairness sensitive information). If we use the RNF loss function to further train the classification head, the generalization gap between the different protected groups would be small. For more detailed proof, please refer to Section A in the Appendix.
87
+
88
+ Smoothing Neutralization. To further enforce the model to ignore sensitive attributes, we construct augmented training samples using a hyper-parameter $\lambda$ to control the degree of neutralization of the samples $\{ z _ { 1 } , p _ { 1 } , \bar { y } \}$ and $\left\{ z _ { 2 } , p _ { 2 } , \bar { y } \right\}$ . The augmented neutralized sample is given by $z =$ $\lambda z _ { 1 } + ( 1 - \lambda ) z _ { 2 }$ , $\lambda \in [ \frac { 1 } { 2 } , 1 )$ . We encourage the classification head to give similar prediction scores for the augmented and the neutralized sample (with $\begin{array} { r } { \lambda = \frac { 1 } { 2 } . } \end{array}$ ). The regularization loss is given by:
89
+
90
+ $$
91
+ \mathcal { L } _ { \mathrm { S m o o t h } } = \sum _ { \lambda \in [ \frac { 1 } { 2 } , 1 ) } | c ( \lambda z _ { 1 } + ( 1 - \lambda ) z _ { 2 } ) - c ( \frac { 1 } { 2 } z _ { 1 } + \frac { 1 } { 2 } z _ { 2 } ) | _ { 1 } .
92
+ $$
93
+
94
+ By varying $\lambda$ we control the degree of sensitive information for the augmented samples. It is utilized to penalize the large changes in softmax probability when we move along the interpolation between two samples. We linearly combine the MSE loss in Eq. (1) with the regularization term as follows:
95
+
96
+ $$
97
+ \begin{array} { r } { \mathcal { L } = \mathcal { L } _ { \mathrm { M S E } } + \alpha \mathcal { L } _ { \mathrm { S m o o t h } } . } \end{array}
98
+ $$
99
+
100
+ We train the classification head using the loss function in Eq. (4). Eventually we combine the original encoder of $f _ { T } ( x )$ and re-trained classification head as the debiased student network $f _ { S } ( x )$ . The teacher $f _ { T } ( x )$ is later discarded and the debiased student network $f _ { S } ( x )$ is used for prediction.
101
+
102
+ # 3.4 Generating Proxy Annotations for Sensitive Attributes
103
+
104
+ The aforementioned feature neutralization is limited in that it requires instance-level sensitive attribute annotations $\{ a _ { i } \} _ { i = 1 } ^ { N }$ for all training samples. Such resource-extensive annotations are difficult to obtain for many practical applications particularly due to the nature of the sensitive attributes. To address this limitation, we propose a method to generate proxy annotations $\{ \hat { a } _ { i } \} _ { i = 1 } ^ { N }$ for the sensitive attributes based on the model uncertainty. The key idea is that a biased model generates over-confident predictions for one demographic group, while giving much lower scores for the alternative group. Particularly, the bias-amplified model tends to assign the privileged group more desired outcome, while assigning the under-privileged group less-desired outcome. For instance in the Adult dataset, the average prediction probability of the desired label (higher income) for the male group is much higher than that of the female group. In contrast, the average probability of the less-desired label for the female group is much higher than that of the male group.
105
+
106
+ To better facilitate the model to generate uncertainty scores, we train another biased model by intentionally amplifying the bias via generalized cross entropy loss (GCE) [37]. The bias-amplified model is denoted as $f _ { B } ( x )$ and the loss function is given as follows:
107
+
108
+ $$
109
+ \operatorname { G C E } ( f ( x ; \theta ) , y ) = { \frac { 1 - f _ { y } ( x ; \theta ) ^ { q } } { q } } ,
110
+ $$
111
+
112
+ where $f _ { y } ( x ; \theta )$ denotes the output probability for ground truth label $y$ . The hyper-parameter $q \in ( 0 , 1 ]$ controls the degree of bias amplification. When $\mathrm { l i m } _ { q \to 0 }$ , the GCE loss in Equation (2) approaches $- \mathrm { l o g } p$ which is equivalent to standard cross entropy loss. The core idea is that for more biased samples, i.e., samples with larger $f _ { y } ( x ; \theta )$ value, the model assigns higher weights $f _ { y } ^ { q }$ while updating the gradient.
113
+
114
+ $$
115
+ \frac { \partial \mathrm { G C E } ( p , y ) } { \partial \theta } = f _ { y } ^ { q } \frac { \partial \mathrm { C E } ( p , y ) } { \partial \theta } .
116
+ $$
117
+
118
+ In this setup, the model $f _ { B } ( x )$ learns more from bias-amplified samples compared to the model $f _ { T } ( x )$ trained with standard cross entropy loss.
119
+
120
+ The confidence score of $f _ { B } ( x )$ is used to indicate whether a sample belongs to a privileged or unprivileged group. Specifically, for a desired ground truth label, samples with over-confident scores are grouped into the privileged group, whereas subsets of samples with low prediction scores are grouped into the unprivileged group. In contrast, for the undesired ground truth label, samples with over-confident scores are grouped into the unprivileged group, and vice versa. Based on this criterion, we generate proxy sensitive attribute annotation $\hat { a }$ for each training sample $x$ to split samples into two groups, which are subsequently used for feature neutralization.
121
+
122
+ The overall process of our RNF mitigation framework is given in Algorithm 1, which contains two stages. In the first stage, we train the biased teacher network $f _ { T } ( x )$ 1 and the biasamplified network $f _ { B } ( x )$ 2 . In the second stage, we first use $f _ { B } ( x )$ 3 to generate proxy sensitive attribute annotations for all training samples. We use the ratio $\gamma$ 4 to partition the training set to gen5 erate proxy annotations for protected attributes 6 that are subsequently used for feature neutralization. Note that the ratio $\gamma$ is determined by the 7 fairness-accuracy trade-off on the validation set. Then we use representation neutralization and the loss function in Eq. (4) to re-train the classification head of $f _ { T } ( x )$ . Eventually, we combine the original encoder $\overset { \cdot } { \boldsymbol { g } } ( \boldsymbol { x } )$ of $f _ { T } ( x )$ and the re
123
+
124
+ # Algorithm 1: RNF mitigation framework.
125
+
126
+ Input: Training data $D = \{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { N }$ .
127
+ Set hyperparameter $q , \alpha$ .
128
+ while first stage do Train teacher network $f _ { T } ( x )$ and bias-amplified network $f _ { B } ( x )$ .
129
+
130
+ while second stage do
131
+
132
+ Determine the splitting threshold $\gamma$ for $f _ { B } ( { \boldsymbol { x } } )$ ; Calculate proxy annotation $\hat { a } _ { i }$ for each training sample $\{ ( x _ { i } ) \} _ { i = 1 } ^ { N }$ based on $\gamma$ and $f _ { B } ( x )$ ; Use loss function in Eq. (4) to re-train classification head $c ( z )$ of $f _ { T } ( x )$ .
133
+
134
+ Output: The debiased student network $f _ { S } ( x )$
135
+
136
+ fined classification head $c ( z )$ to give us the debiased student network $f _ { S } ( x )$ . It is worth noting that the neutralization is merely performed during the training stage for only debiasing the classification head. At inference time, the features just come in as encoded, and the classification head has learned to not exploit any of the information correlated with the sensitive attribute for prediction.
137
+
138
+ # 4 Experiments
139
+
140
+ In this section, we conduct experiments to evaluate the effectiveness of our RNF framework.
141
+
142
+ # 4.1 Experimental Setup
143
+
144
+ # 4.1.1 Fairness Metrics, Benchmark Datasets and Baselines
145
+
146
+ We use two group fairness metrics: Demographic Parity [38] and Equalized Odds [39]. Demographic Parity (DP) measures the ratio of the probability of favorable outcomes between unprivileged and privileged groups: $\begin{array} { r } { \mathrm { D P } = \frac { p ( \hat { y } = 1 | a = 0 ) } { p ( \hat { y } = 1 | a = 1 ) } } \end{array}$ . Equalized Odds $( \Delta \mathrm { E O } )$ require favorable outcomes to be independent of the protected class attribute $a$ , conditioned on the ground truth label $y$ . Specifically, it calculates the summation of the True Positive Rate difference and False Positive Rate difference:
147
+
148
+ $$
149
+ y = 1 ) \} + \{ P ( \hat { y } = 1 \mid a = 0 , y = 0 ) - P ( \hat { y } = 1 \mid a = 1 , y = 0 ) \}
150
+ $$
151
+
152
+ Under the above metrics, it is desirable to have a DP value closer to 1 and $\Delta \mathrm { E O }$ value closer to 0.
153
+
154
+ Table 1: Dataset statistics.
155
+
156
+ <table><tr><td></td><td>Adult</td><td>MEPS</td><td>CelebA</td></tr><tr><td>#Training</td><td>33120</td><td>11362</td><td>194599</td></tr><tr><td>#Validation</td><td>3000</td><td>1200</td><td>4000</td></tr><tr><td>#Test</td><td>9102</td><td>3168</td><td>8000</td></tr></table>
157
+
158
+ We use two benchmark tabular datasets and one image dataset to evaluate the effectiveness of RNF. For the Adult income dataset (Adult), the goal is to predict whether a person’s income exceeds $\$ 50 K/\mathrm { y r }$ [34]. We consider gender as the protected attribute where vanilla trained models show discrimination towards the female group by predicting females to earn less. For the Medical
159
+
160
+ Expenditure dataset (MEPS), we consider two groups white and non-white [40]. Here the task is to predict whether a person would have a ‘high’ utilization, where vanilla DNN shows discrimination towards the non-white group. The CelebFaces Attributes (CelebA) dataset is used to predict whether the hair in an image is wavy or not [41]. We consider two groups male and female, where vanilla trained models show discrimination towards the male group. We split all datasets into three subsets with statistics reported in Table 1. More details of the datasets are included in Sec. C in the Appendix.
161
+
162
+ We compare two variants of our framework RNF (using proxy sensitive attribute annotations) and $\mathbf { R N F } _ { \mathbf { G T } }$ (using ground truth sensitive attribute annotations) against baselines such as DNNs trained using only cross entropy loss (referred as Vanilla) and two regularization based mitigation methods, namely, adversarial training (Adversarial) [42] and Equalized Odds Regularization (EOR) [43]. Among them, the Adversarial method achieves fairness via learning debiased representations, whereas EOR directly optimizes the EO metric in Eq. (7). All three baselines control the fairness-accuracy trade-off via hyper-parameters. More details on the baselines are included in Sec. D in the Appendix.
163
+
164
+ # 4.1.2 Implementation Details
165
+
166
+ For the image classification task, we use ResNet-18 [1] (we add one more fully connected layer). We set the representation encoder $g ( x )$ as the convolutional layers and use the remaining two fully connected layers as the classification head $c ( z )$ . For tabular datasets, we use a three-layer MLP (multilayer perceptron) as the classification model, where the first layer is set as the encoder and the remaining two layers are used as the classification head. Dropout is used for the first two layers with the dropout probability fixed at 0.2. We use the same batch size of 64 for tabular datasets and 390 for the image dataset. For selecting another random sample $\{ x _ { 2 } , y , a _ { 2 } \}$ to be neutralized with current sample $\mathbf { \bar { \{ } } x _ { 1 } , y , a _ { 1 } \}$ , we perform the selection within the current batch of training data. The hyperparameters (e.g., learning rate and training epoches) are determined based on the model performance on the validation set, and early-stopping based on validation performance is used to avoid overfitting. The optimal temperature $T$ used to calculate the probability is set as 2.0, 5.0, 2.0 for Adult, MEPS and CelebA datasets respectively. For Eq. (3), we sample $\lambda$ from the list [0.6, 0.7, 0.8, 0.9]. The hyper-parameter $q$ in Eq. (5) is set as $0 . 2 , 0 . 6 , 0 . 3$ for Adult, MEPS and CelebA datasets respectively.
167
+
168
+ ![](images/4686305c6c8dc1e570d982dcc14a980a30ee225bd363abdc370790e7844b8160.jpg)
169
+ Figure 3: The fairness-accuracy curve comparison of RNF and other baselines. The first and second row depict the DP accuracy and $\Delta \mathrm { E O }$ accuracy trade-off curves, respectively. Note that there is a certain level of variance for each baseline method, and we report the average over 10 runs.
170
+
171
+ # 4.2 Mitigation Performance Analysis
172
+
173
+ We compare the mitigation performance of RNF (with proxy attribute annotations) and ${ \mathrm { R N F } } _ { \mathrm { G T } }$ (with ground-truth attribute annotations) with other competing methods and illustrate their fairness-accuracy curves for the three datasets in Figure 3. The hyper-parameter $\alpha$ in Eq. (4) controls the trade-off between accuracy and fairness for RNF. For Adversarial and EOR, we vary their regularization weights to obtain the corresponding performance curves. As the random seeds lead to variance in the accuracy and fairness metrics (please refer to Section E.4 in the Appendix for detailed analysis of the variability effect), we train the model for 10 times with different seeds and report the average result. Overall, we make the following key observations.
174
+
175
+ • Even though RNF does not rely on annotations for the sensitive attributes, it performs similar to baseline methods with access to such information, e.g, Adversarial training, or better than them in some cases. This makes RNF readily usable for real-world applications where protected attributes are not available in the training set.
176
+ • ${ \sf R N F } _ { \mathrm { G T } }$ improves mitigation performance over RNF by $1 0 \%$ on an average across all datasets and metrics, thereby, demonstrating the benefit of using ground truth sensitive attribute annotations.
177
+ • The soft labels of RNF and ${ \mathsf { R N F } } _ { \mathrm { G T } }$ (obtained using a higher temperature $T$ ) discourage the model to assign overconfident predictions, thereby, suppressing it from capturing undesirable correlation between fairness sensitive information and class labels. Penalizing the large changes of probability as we move along the interpolation between two samples further suppresses the model from capturing the undesirable correlation.
178
+ • Direct optimization of the equality of odds metric (i.e., EOR) achieves comparable performance to ${ \mathrm { R N F } } _ { \mathrm { G T } }$ for all the datasets. However, it has limited improvement in terms of the demographic parity metric. Note that EOR requires instance-level annotations for the protected attributes.
179
+ • We observe that Adversarial training also performs effective mitigation by learning debiased representations. However, this happens at the expense of a higher accuracy drop for the task performance. This likely results from the loss of task relevant information while suppressing sensitive information from the representations. Additionally, we observe adversarial training to be unstable, especially for relatively complex task like image classification.
180
+
181
+ # 4.3 Classification Head Analysis
182
+
183
+ In this section, we use explainability and an auxiliary prediction task to analyze the classification head $c ( z )$ for the Adult dataset. Particularly, we leverage explainability as a debugging tool to analyze the attention difference between Vanilla and RNF model with respect to the representations.
184
+
185
+ Auxiliary Sensitive Attribute Prediction Task. We perform a representation analysis using an auxiliary prediction task. To this end, we train another linear classifier to predict sensitive attributes using the biased representation $g ( x ) = z$ as input and the sensitive attribute annotations $\{ a _ { i } \} _ { i = 1 } ^ { N }$ as the supervision signal. The linear classifier is denoted by $L _ { \mathrm { S E N S } } ( z ) = W z + b$ , where $W$ and $b$ represent the weight matrix and bias for the linear classifier respectively. The weight matrix $W$ can be used to measure the degree of bias in each dimension of the representation $z$ .
186
+
187
+ Explanation Analysis. We use post-hoc explainability [44] to analyze the contribution of the classification head $c ( z )$ . Our goal is to figure out the contribution of each dimension within the biased representation $g ( x ) = z$ towards the model prediction $f ( x , \theta ) = c ( g ( x ) )$ . We train a linear classifier $L _ { \mathrm { e x p l a n } } ( z ) = \bar { W } \dot { z } + b$ to mimic the decision boundary of the multi-layer classification head $c ( z )$ .
188
+
189
+ We compare the weight matrix of the two linear classifiers $L _ { \mathrm { S E N S } } ( z )$ and $L _ { \mathrm { e x p l a n } } ( z )$ using cosine similarity. For models trained using Adult dataset, we extract the weight matrix corresponding to the protected attribute Male and task label Positive, and then we calculate the cosine similarity between the Male vector and the Positive vector. This follows from our observation in Figure 1 that the vanilla model makes use of male relevant information to make positive predictions. For the Vanilla model and RNF models listed in Figure 3 (a), we calculate the cosine similarity and report the DP-Similarity performance in Figure 4. We observe that RNF dramatically reduces the cosine similarity between positive predictions and male relevant information compared to Vanilla (from 0.272 to 0.075), by adjusting the decision boundary.
190
+
191
+ This eventually helps the head $c ( z )$ to shift its attention from fairness sensitive information to task relevant information.
192
+
193
+ ![](images/b9c3f6b8be378b0a238498a25921809e5af3fe75a2594128a6d1e9ef8279a652.jpg)
194
+ Figure 4: Analysis for the classification head.
195
+
196
+ # 4.4 Effectiveness of GCE Loss
197
+
198
+ We use MEPS dataset to examine the GCE loss in terms of generating proxy annotations for the protected attributes. The results are shown in Table 2. Firstly, we compare the fairness performance of GCE loss with standard CE loss (Vanilla). As expected, we observe that GCE is more biased than Vanilla in terms of the fairness metrics with $0 . 2 \%$ accuracy difference. Secondly, we compare RNF with several of its variants: 1) replacing GCE loss with cross entropy (CE) loss to generate proxy labels, and 2) using random annotations for the protected attributes. For a fair comparison, except for the protected attribute annotations, we use the same set of hyper-parameters for different variants. Even though the same level of regularization is performed for the three RNF variants, RNF-GCE has a higher mitigation performance than RNF-CE with $3 . 0 \%$ DP improvement and only $0 . 3 \%$ accuracy difference, thereby, demonstrating the effectiveness of GCE in terms of separating protected groups. Another observation is that even using random annotations, our RNF framework could achieve certain level of mitigation. This is because partial samples contain different sensitive attributes, which still could serve neutralization purpose.
199
+
200
+ Table 2: Ablation analysis.
201
+
202
+ <table><tr><td></td><td colspan="2">MEPS</td></tr><tr><td>Models</td><td>Accuracy</td><td>DP △EO</td></tr><tr><td>Vanilla</td><td>0.862</td><td>0.866 -0.210</td></tr><tr><td>GCE</td><td>0.860</td><td>0.839 -0.249</td></tr><tr><td>RNF-GCE</td><td>0.839</td><td>0.964 -0.099</td></tr><tr><td>RNF-CE</td><td>0.842</td><td>0.936 -0.128</td></tr><tr><td>RNF-Random</td><td>0.856</td><td>0.902 -0.163</td></tr></table>
203
+
204
+ # 4.5 Varying Layers for the Classification Head
205
+
206
+ We use MEPS and CelebA two datasets to study the effect of an important hyper-parameter of our framework in terms of which layers to use for the encoder. Our classification model $f ( x )$ contains the encoder $g ( x )$ and task predictor $c ( z )$ . In this experiment, we vary the depth of the representation layer to examine the effect of
207
+
208
+ Table 3: Varying the layers for classification head.
209
+
210
+ <table><tr><td rowspan="3">Models</td><td colspan="2">MEPS</td><td colspan="3">CelebA</td></tr><tr><td>Accuracy</td><td>DP △EO</td><td>Accuracy</td><td>DP</td><td>△EO</td></tr><tr><td>RNF</td><td>0.839</td><td>0.964 -0.099</td><td>0.668</td><td>0.836</td><td>-0.290</td></tr><tr><td>RNF-Last</td><td>0.837</td><td>0.971 -0.076</td><td>0.641</td><td>0.966</td><td>-0.052</td></tr></table>
211
+
212
+ layer selection. In particular, we investigate the question: can we debias only the very last layer, with the remaining layers as the biased encoder? We report the results for MEPS and CelebA datasets in Table 3, where the second row depicts the result of debiasing only the last layer. On MEPS dataset, RNF-Last has better performance in terms of the two fairness metrics with only $0 . 2 \%$ accuracy difference. Similarly, for CelebA dataset, with $2 . 7 \%$ accuracy difference, RNF-Last has better fairness performance (with $13 \%$ DP improvement). This demonstrates that debiasing only the last layer can achieve similar performance compared to debiasing the last several layers.
213
+
214
+ # 4.6 Representation Neutralization with Debiased Encoder
215
+
216
+ In the discussions so far, we reported the performance of RNF while debiasing only the classification head. In this section, we analyze the impact of RNF built on top of a debiased encoder. We first use Adversarial or EOR training to learn a debiased encoder – which is subsequently used as the backbone encoder for updating the classification head using RNF. This experiment is performed on the MEPS dataset where both Adversarial and EOR methods achieve competitive performance. We use the same hyper-parameters for different RNF variants and report a single point in the fairness-accuracy curve. The results are shown in Table 4. We observe RNF_EOR to achieve better fairness performance over RNF, with DP metric improvement of $1 . 6 \%$ and $\Delta \mathrm { E O }$ metric moves closer to 0. However, such improvement in the fairness metrics incur some loss in the task performance – where the accuracy reduces by $0 . 5 \%$ . We observe a similar trend with the combination of RNF and Adversarial training, where the joint combination improves the fairness metrics DP and $\Delta \mathrm { E O }$ . Similar to the previous case, this fairness improvement is achieved at the expense of some task performance degradation, where the accuracy drops by $1 . 3 \%$ . This indicates that our RNF is complementary to using a debiased encoder where the joint combination performs better than either of them in terms of the fairness metrics with some loss in task performance.
217
+
218
+ Table 4: RNF with debiased encoder.
219
+
220
+ <table><tr><td rowspan="2">Models</td><td colspan="3">MEPS</td></tr><tr><td>Accuracy</td><td>DP</td><td>△EO</td></tr><tr><td>Vanilla</td><td>0.862</td><td>0.866</td><td>-0.210</td></tr><tr><td>RNF</td><td>0.839</td><td>0.964</td><td>-0.099</td></tr><tr><td>RNF_EOR</td><td>0.834</td><td>0.980</td><td>-0.049</td></tr><tr><td>RNF_Adversarial</td><td>0.826</td><td>0.971</td><td>-0.085</td></tr></table>
221
+
222
+ # 5 Conclusions and Future Work
223
+
224
+ In this work, we demonstrate that even when input representations are biased, we can still improve fairness by debiasing only the classification head of the DNN models. We introduce the RNF framework for debiasing the classification head by neutralizing training samples that have the same ground truth label but with different sensitive attribute annotations. To reduce the reliance on sensitive attribute annotations (as used in existing works), we generate proxy annotations by training a biasintensified model and then annotating samples based on its confidence level. Experimental results indicate our RNF framework to dramatically reduce the discrimination of DNN models, without requiring access to annotations for the sensitive attributes for all the training samples. Experimental analysis further demonstrates our RNF framework to further improve in conjunction with other debiasing methods. Specifically, our RNF framework built on top of a debiased backbone encoder leads to better mitigation performance with negligible accuracy drop in the task performance. It is worth noting that our RNF framework could help alleviate the discrimination rather than eliminate it.
225
+
226
+ On the other hand, the experimental analysis indicates a mitigation gap between RNF and ${ \mathrm { R N F } } _ { \mathrm { G T } }$ This is because we assume zero access to the protected attribute annotations when using GCE framework. It is desirable to further boost the quality of the generated proxy annotations. In realworld applications, domain experts could be involved to annotate a small ratio of the samples for the training set. Equipped with this small ratio of high quality protected attribute annotations, we could generate proxy annotations for other training samples with a higher accuracy compared to the proxy annotations generated by GCE framework. As such, we can further boost the mitigation performance of RNF. This is a challenging topic and would be explored in our future research.
227
+
228
+ # 6 Funding Transparency Statement
229
+
230
+ The work is in part supported by NSF grants CNS-1816497, IIS-1900990, and IIS-1939716. The views and conclusions contained in this paper are those of the authors and should not be interpreted as representing any funding agencies.
231
+
232
+ References
233
+ [1] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition (CVPR), 2016.
234
+ [2] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. 2019 Annual Conference of the North American Chapter of the Association for Computational Linguistics (NAACL), 2019.
235
+ [3] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems (NeurIPS), 2012.
236
+ [4] Ninareh Mehrabi, Fred Morstatter, Nripsuta Saxena, Kristina Lerman, and Aram Galstyan. A survey on bias and fairness in machine learning. ACM Computing Surveys, 2021.
237
+ [5] Mengnan Du, Fan Yang, Na Zou, and Xia Hu. Fairness in deep learning: A computational perspective. IEEE Intelligent Systems, 2020.
238
+ [6] Rachel KE Bellamy, Kuntal Dey, Michael Hind, Samuel C Hoffman, Stephanie Houde, Kalapriya Kannan, Pranay Lohia, Jacquelyn Martino, Sameep Mehta, Aleksandra Mojsilovic, et al. Ai fairness 360: An extensible toolkit for detecting, understanding, and mitigating unwanted algorithmic bias. arXiv preprint arXiv:1810.01943, 2018.
239
+ [7] Julia Angwin, Jeff Larson, Surya Mattu, and Lauren Kirchner. Machine bias. https://www.propublica.org/article/machine-bias-risk-assessments-in-criminal-sentencing, 2016.
240
+ [8] Byungju Kim, Hyunwoo Kim, Kyungsu Kim, Sungjin Kim, and Junmo Kim. Learning not to learn: Training deep neural networks with biased data. In Proceedings of the IEEE conference on computer vision and pattern recognition (CVPR), 2019.
241
+ [9] Tianlu Wang, Jieyu Zhao, Mark Yatskar, Kai-Wei Chang, and Vicente Ordonez. Balanced datasets are not enough: Estimating and mitigating gender bias in deep image representations. International Conference on Computer Vision (ICCV), 2019.
242
+ [10] Yanai Elazar and Yoav Goldberg. Adversarial removal of demographic attributes from text data. 2018 Conference on Empirical Methods in Natural Language Processing (EMNLP), 2018.
243
+ [11] Martin Arjovsky, Léon Bottou, Ishaan Gulrajani, and David Lopez-Paz. Invariant risk minimization. arXiv preprint arXiv:1907.02893, 2019.
244
+ [12] Kartik Ahuja, Karthikeyan Shanmugam, Kush Varshney, and Amit Dhurandhar. Invariant risk minimization games. In International Conference on Machine Learning (ICML), 2020.
245
+ [13] Krishna Kumar Singh, Dhruv Mahajan, Kristen Grauman, Yong Jae Lee, Matt Feiszli, and Deepti Ghadiyaram. Don’t judge an object by its context: Learning to overcome contextual bias. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
246
+ [14] Andrea Zunino, Sarah Adel Bargal, Riccardo Volpi, Mehrnoosh Sameki, Jianming Zhang, Stan Sclaroff, Vittorio Murino, and Kate Saenko. Explainable deep classification models for domain generalization. arXiv preprint arXiv:2003.06498, 2020.
247
+ [15] Laura Rieger, Chandan Singh, W James Murdoch, and Bin Yu. Interpretations are useful: penalizing explanations to align neural networks with prior knowledge. International Conference on Machine Learning (ICML), 2020.
248
+ [16] Mohammad Pezeshki, Sékou-Oumar Kaba, Yoshua Bengio, Aaron Courville, Doina Precup, and Guillaume Lajoie. Gradient starvation: A learning proclivity in neural networks. arXiv preprint arXiv:2011.09468, 2020.
249
+ [17] Robert Geirhos, Jörn-Henrik Jacobsen, Claudio Michaelis, Richard Zemel, Wieland Brendel, Matthias Bethge, and Felix A Wichmann. Shortcut learning in deep neural networks. Nature Machine Intelligence, 2(11):665–673, 2020.
250
+ [18] Timothy Niven and Hung-Yu Kao. Probing neural network comprehension of natural language arguments. 57th Annual Meeting of the Association for Computational Linguistics (ACL), 2019.
251
+ [19] Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. International Conference on Learning Representations (ICLR), 2018.
252
+ [20] Vikas Verma, Alex Lamb, Christopher Beckham, Amir Najafi, Ioannis Mitliagkas, David LopezPaz, and Yoshua Bengio. Manifold mixup: Better representations by interpolating hidden states. In International Conference on Machine Learning (ICML), 2019.
253
+ [21] Hao Wang, Berk Ustun, and Flavio Calmon. Repairing without retraining: Avoiding disparate impact with counterfactual distributions. In International Conference on Machine Learning (ICML), 2019.
254
+ [22] Christina Wadsworth, Francesca Vera, and Chris Piech. Achieving fairness through adversarial learning: an application to recidivism prediction. Fairness, Accountability, and Transparency in Machine Learning (FAT/ML), 2018.
255
+ [23] Harrison Edwards and Amos Storkey. Censoring representations with an adversary. International Conference on Learning Representations (ICLR), 2016.
256
+ [24] Frederick Liu and Besim Avci. Incorporating priors with feature attribution on text classification. 57th Annual Meeting of the Association for Computational Linguistics (ACL), 2019.
257
+ [25] Matt J Kusner, Joshua Loftus, Chris Russell, and Ricardo Silva. Counterfactual fairness. In Advances in neural information processing systems (NeurIPS), 2017.
258
+ [26] Niki Kilbertus, Mateo Rojas Carulla, Giambattista Parascandolo, Moritz Hardt, Dominik Janzing, and Bernhard Schölkopf. Avoiding discrimination through causal reasoning. In Advances in Neural Information Processing Systems (NeurIPS), 2017.
259
+ [27] Pengyu Cheng, Weituo Hao, Siyang Yuan, Shijing Si, and Lawrence Carin. Fairfil: Contrastive neural debiasing method for pretrained text encoders. International Conference on Learning Representations (ICLR), 2021.
260
+ [28] Bingyi Kang, Saining Xie, Marcus Rohrbach, Zhicheng Yan, Albert Gordo, Jiashi Feng, and Yannis Kalantidis. Decoupling representation and classifier for long-tailed recognition. International Conference on Learning Representations (ICLR), 2020.
261
+ [29] Junhyun Nam, Hyuntak Cha, Sungsoo Ahn, Jaeho Lee, and Jinwoo Shin. Learning from failure: Training debiased classifier from biased classifier. Advances in Neural Information Processing Systems (NeurIPS), 2020.
262
+ [30] Robin Jia and Percy Liang. Adversarial examples for evaluating reading comprehension systems. 2017 Conference on Empirical Methods in Natural Language Processing (EMNLP), 2017.
263
+ [31] Aishwarya Agrawal, Dhruv Batra, Devi Parikh, and Aniruddha Kembhavi. Don’t just assume; look and answer: Overcoming priors for visual question answering. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
264
+ [32] Ali Khodabakhsh, Raghavendra Ramachandra, Kiran Raja, Pankaj Wasnik, and Christoph Busch. Fake face detection methods: Can they be generalized? In 2018 International Conference of the Biometrics Special Interest Group (BIOSIG), 2018.
265
+ [33] Ching-Yao Chuang and Youssef Mroueh. Fair mixup: Fairness via interpolation. International Conference on Learning Representations (ICLR), 2021.
266
+ [34] Ron Kohavi. Scaling up the accuracy of naive-bayes classifiers: A decision-tree hybrid. In Proceedings of the Second International Conference on Knowledge Discovery and Data Mining (KDD), 1996.
267
+ [35] Gökhan H Bakır, Jason Weston, and Bernhard Schölkopf. Learning to find pre-images. Advances in neural information processing systems (NeurIPS), 2004.
268
+ [36] Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. NeurIPS 2014 Deep Learning Workshop, 2015.
269
+ [37] Zhilu Zhang and Mert R Sabuncu. Generalized cross entropy loss for training deep neural networks with noisy labels. Advances in Neural Information Processing Systems (NeurIPS), 2018.
270
+ [38] Michael Feldman, Sorelle A Friedler, John Moeller, Carlos Scheidegger, and Suresh Venkatasubramanian. Certifying and removing disparate impact. In ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD), 2015.
271
+ [39] Moritz Hardt, Eric Price, Nati Srebro, et al. Equality of opportunity in supervised learning. In Advances in neural information processing systems (NeurIPS), 2016.
272
+ [40] Steven B Cohen. Design strategies and innovations in the medical expenditure panel survey. Medical care, pages III5–III12, 2003.
273
+ [41] Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), 2015.
274
+ [42] Brian Hu Zhang, Blake Lemoine, and Margaret Mitchell. Mitigating unwanted biases with adversarial learning. In AAAI/ACM Conference on Artificial Intelligence, Ethics, and Society (AIES), 2018.
275
+ [43] Yahav Bechavod and Katrina Ligett. Penalizing unfairness in binary classification. Fairness, Accountability and Transparency in Machine Learning (FAT/ML), 2017.
276
+ [44] Mengnan Du, Ninghao Liu, and Xia Hu. Techniques for interpretable machine learning. Communications of the ACM, 2019.
md/train/B1e3OlStPB/B1e3OlStPB.md ADDED
@@ -0,0 +1,531 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DEEPSPHERE: A GRAPH-BASED SPHERICAL CNN
2
+
3
+ Michael Defferrard, Martino Milani & Fr ¨ ed´ erick Gusset ´
4
+ Ecole Polytechnique F ´ ed´ erale de Lausanne (EPFL), Switzerland ´
5
+ {michael.defferrard,martino.milani,frederick.gusset}@epfl.ch
6
+
7
+ # Nathanael Perraudin ¨
8
+
9
+ Swiss Data Science Center (SDSC), Switzerland nathanael.perraudin@sdsc.ethz.ch
10
+
11
+ # ABSTRACT
12
+
13
+ Designing a convolution for a spherical neural network requires a delicate tradeoff between efficiency and rotation equivariance. DeepSphere, a method based on a graph representation of the sampled sphere, strikes a controllable balance between these two desiderata. This contribution is twofold. First, we study both theoretically and empirically how equivariance is affected by the underlying graph with respect to the number of vertices and neighbors. Second, we evaluate DeepSphere on relevant problems. Experiments show state-of-the-art performance and demonstrates the efficiency and flexibility of this formulation. Perhaps surprisingly, comparison with previous work suggests that anisotropic filters might be an unnecessary price to pay. Our code is available at https: //github.com/deepsphere.
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ Spherical data is found in many applications (figure 1). Planetary data (such as meteorological or geological measurements) and brain activity are example of intrinsically spherical data. The observation of the universe, LIDAR scans, and the digitalization of 3D objects are examples of projections due to observation. Labels or variables are often to be inferred from them. Examples are the inference of cosmological parameters from the distribution of mass in the universe (Perraudin et al., 2019), the segmentation of omnidirectional images (Khasanova & Frossard, 2017), and the segmentation of cyclones from Earth observation (Mudigonda et al., 2017).
18
+
19
+ ![](images/33a638b46f1fa41380e07021f5ad002111a633f73f53357c2d170917e890718a.jpg)
20
+ Figure 1: Examples of spherical data: (a) brain activity recorded through magnetoencephalography (MEG),1(b) the cosmic microwave background (CMB) temperature from Planck Collaboration (2016), (c) hourly precipitation from a climate simulation (Jiang et al., 2019), (d) daily maximum temperature from the Global Historical Climatology Network (GHCN). $^ 2 \mathrm { A }$ rigid full-sphere sampling is not ideal: brain activity is only measured on the scalp, the Milky Way’s galactic plane masks observations, climate scientists desire a variable resolution, and the position of weather stations is arbitrary and changes over time. (e) Graphs can faithfully and efficiently represent sampled spherical data by placing vertices where it matters.
21
+
22
+ As neural networks (NNs) have proved to be great tools for inference, variants have been developed to handle spherical data. Exploiting the locally Euclidean property of the sphere, early attempts used standard 2D convolutions on a grid sampling of the sphere (Boomsma & Frellsen, 2017; Su & Grauman, 2017; Coors et al., 2018). While simple and efficient, those convolutions are not equivariant to rotations. On the other side of this tradeoff, Cohen et al. (2018) and Esteves et al. (2018) proposed to perform proper spherical convolutions through the spherical harmonic transform. While equivariant to rotations, those convolutions are expensive (section 2).
23
+
24
+ As a lack of equivariance can penalize performance (section 4.2) and expensive convolutions prohibit their application to some real-world problems, methods standing between these two extremes are desired. Cohen et al. (2019) proposed to reduce costs by limiting the size of the representation of the symmetry group by projecting the data from the sphere to the icosahedron. The distortions introduced by this projection might however hinder performance (section 4.3).
25
+
26
+ Another approach is to represent the sampled sphere as a graph connecting pixels according to the distance between them (Bruna et al., 2013; Khasanova & Frossard, 2017; Perraudin et al., 2019). While Laplacian-based graph convolutions are more efficient than spherical convolutions, they are not exactly equivariant (Defferrard et al., 2019). In this work, we argue that graph-based spherical CNNs strike an interesting balance, with a controllable tradeoff between cost and equivariance (which is linked to performance). Experiments on multiple problems of practical interest show the competitiveness and flexibility of this approach.
27
+
28
+ # 2 METHOD
29
+
30
+ DeepSphere leverages graph convolutions to achieve the following properties: (i) computational efficiency, (ii) sampling flexibility, and (iii) rotation equivariance (section 3). The main idea is to model the sampled sphere as a graph of connected pixels: the length of the shortest path between two pixels is an approximation of the geodesic distance between them. We use the graph CNN formulation introduced in (Defferrard et al., 2016) and a pooling strategy that exploits hierarchical samplings of the sphere.
31
+
32
+ Sampling. A sampling scheme $\mathcal { V } = \{ x _ { i } \in \mathbb { S } ^ { 2 } \} _ { i = 1 } ^ { n }$ is defined to be the discrete subset of the sphere containing the $n$ points where the values of the signals that we want to analyse are known. For a given continuous signal $f$ , we represent such values in a vector $\pmb { f } \in \mathbb { R } ^ { n }$ . As there is no analogue of uniform sampling on the sphere, many samplings have been proposed with different tradeoffs. In this work, depending on the considered application, we will use the equiangular (Driscoll & Healy, 1994), HEALPix (Gorski et al., 2005), and icosahedral (Baumgardner & Frederickson, 1985) samplings.
33
+
34
+ Graph. From $\nu$ , we construct a weighted undirected graph $\mathcal { G } = ( \nu , w )$ , where the elements of $\nu$ are the vertices and the weight $w _ { i j } = w _ { j i }$ is a similarity measure between vertices $x _ { i }$ and $x _ { j }$ . The combinatorial graph Laplacian $\breve { \pmb { L } } \in \mathbb { R } ^ { \breve { n } \times n }$ is defined as $L = D - A$ , where $\mathbf { A } = \left( w _ { i j } \right)$ is the weighted adjacency matrix, $D = \left( d _ { i i } \right)$ is the diagonal degree matrix, and $\begin{array} { r } { d _ { i i } = \sum _ { j } w _ { i j } } \end{array}$ is the weighted degree of vertex $x _ { i }$ . Given a sampling $\nu$ , usually fixed by the application or the available measurements, the freedom in constructing $\mathcal { G }$ is in setting $w$ . Section 3 shows how to set $w$ to minimize the equivariance error.
35
+
36
+ Convolution. On Euclidean domains, convolutions are efficiently implemented by sliding a window in the signal domain. On the sphere however, there is no straightforward way to implement a convolution in the signal domain due to non-uniform samplings. Convolutions are most often performed in the spectral domain through a spherical harmonic transform (SHT). That is the approach taken by Cohen et al. (2018) and Esteves et al. (2018), which has a computational cost of $\mathcal { O } ( n ^ { 3 / 2 } )$ on isolatitude samplings (such as the HEALPix and equiangular samplings) and $O ( n ^ { 2 } )$ in general.
37
+
38
+ On the other hand, following Defferrard et al. (2016), graph convolutions can be defined as
39
+
40
+ $$
41
+ h ( { \cal L } ) f = \left( \sum _ { i = 0 } ^ { P } \alpha _ { i } { \cal L } ^ { i } \right) f ,
42
+ $$
43
+
44
+ where $P$ is the polynomial order (which corresponds to the filter’s size) and $\alpha _ { i }$ are the coefficients to be optimized during training.3 Those convolutions are used by Khasanova & Frossard (2017) and Perraudin et al. (2019) and cost ${ \mathcal { O } } ( n )$ operations through a recursive application of $\pmb { L }$ . 4
45
+
46
+ Pooling. Down- and up-sampling is natural for hierarchical samplings,5 where each subdivision divides a pixel in (an equal number of) child sub-pixels. To pool (down-sample), the data supported on the sub-pixels is summarized by a permutation invariant function such as the maximum or the average. To unpool (up-sample), the data supported on a pixel is copied to all its sub-pixels.
47
+
48
+ Architecture. All our NNs are fully convolutional, and employ a global average pooling (GAP) for rotation invariant tasks. Graph convolutional layers are always followed by batch normalization and ReLU activation, except in the last layer. Note that batch normalization and activation act on the elements of $f$ independently, and hence don’t depend on the domain of $f$ .
49
+
50
+ # 3 GRAPH CONVOLUTION AND EQUIVARIANCE
51
+
52
+ While the graph framework offers great flexibility, its ability to faithfully represent the underlying sphere — for graph convolutions to be rotation equivariant — highly depends on the sampling locations and the graph construction.
53
+
54
+ # 3.1 PROBLEM FORMULATION
55
+
56
+ A continuous function $f : { \mathcal { C } } ( \mathbb { S } ^ { 2 } ) \supset F \nu \mathbb { R }$ is sampled as $T _ { \mathcal { V } } ( f ) = f$ by the sampling operator $T _ { \mathcal { V } } : C ( \mathbb { S } ^ { 2 } ) \supset F _ { \mathcal { V } } \to ^ { } \mathbb { R } ^ { n }$ defined as $f : f _ { i } = f ( x _ { i } )$ . We require $F _ { \mathcal { V } }$ to be a suitable subspace of continuous functions such that $T _ { \nu }$ is invertible, i.e., the function $f \in F _ { \nu }$ can be unambiguously reconstructed from its sampled values $f$ . The existence of such a subspace depends on the sampling $\nu$ and its characterization is a common problem in signal processing (Driscoll & Healy, 1994). For most samplings, it is not known if $F _ { \mathcal { V } }$ exists and hence if $T _ { \nu }$ is invertible. A special case is the equiangular sampling where a sampling theorem holds, and thus a closed-form of $T _ { \nu } ^ { - 1 }$ is known. For samplings where no such sampling formula is available, we leverage the discrete SHT to reconstruct $f$ from $f = T _ { \nu } f$ , thus approximating $T _ { \nu } ^ { - 1 }$ . For all theoretical considerations, we assume that $F _ { \mathcal { V } }$ exists and $f \in F _ { \nu }$ .
57
+
58
+ By definition, the (spherical) graph convolution is rotation equivariant if and only if it commutes with the rotation operator defined as $R ( g ) , g \in S O ( 3 )$ : $R ( \bar { g } ) f ( x ) = f \left( g ^ { - 1 } x \right)$ . In the context of this work, graph convolution is performed by recursive applications of the graph Laplacian (1). Hence, if $R ( g )$ commutes with $\pmb { L }$ , then, by recursion, it will also commute with the convolution $h ( L )$ . As a result, $h ( L )$ is rotation equivariant if and only if
59
+
60
+ $$
61
+ { \pmb R } _ { \mathcal { V } } ( g ) { \pmb L } { \pmb f } = { \pmb L } { \pmb R } _ { \mathcal { V } } ( g ) { \pmb f } , \qquad { \forall } { \pmb f } \in { \cal F } _ { \mathcal { V } } \mathrm { a n d } \forall g \in S O ( 3 ) ,
62
+ $$
63
+
64
+ where $\pmb { R } _ { \mathcal { V } } ( g ) = T _ { \mathcal { V } } \pmb { R } ( g ) T _ { \mathcal { V } } ^ { - 1 }$ . For an empirical evaluation of equivariance, we define the normalized equivariance error for a signal $f$ and a rotation $g$ as
65
+
66
+ $$
67
+ E _ { L } ( \pmb { f } , g ) = \left( \frac { \| R _ { \mathcal { V } } ( g ) L f - L R _ { \mathcal { V } } ( g ) \pmb { f } \| } { \| L \pmb { f } \| } \right) ^ { 2 } .
68
+ $$
69
+
70
+ More generally for a class of signals $f \in C \subset F _ { \mathcal { V } }$ , the mean equivariance error defined as
71
+
72
+ $$
73
+ \overline { { E } } _ { L , C } = \mathbb { E } _ { \pmb { f } \in C , \ b { g } \in S O ( 3 ) } \ E _ { L } ( \pmb { f } , \pmb { g } )
74
+ $$
75
+
76
+ represents the overall equivariance error. The expected value is obtained by averaging over a finite number of random functions and random rotations.
77
+
78
+ ![](images/c259942ababe0afbb992fff3f37e327b70b3ab3c836ad54436a4ca246ef6395b.jpg)
79
+ Figure 2: Mean equivariance error (3). There is a clear tradeoff between equivariance and computational cost, governed by the number of vertices $n$ and edges $k n$ .
80
+
81
+ ![](images/bf5f6ea76c86d1b1392b4816f424f002718e7197c39a62f017e7f24dfcd442d5.jpg)
82
+ Figure 3: Kernel widths.
83
+
84
+ ![](images/96f715570bd1fd35baf0a998c2ff1be5c5ac1319917b0249e47cea9934dd7180.jpg)
85
+ Figure 4: 3D object represented as a spherical depth map.
86
+
87
+ ![](images/fe666d69c6f980d9cf4362d71e9b27f5d085761cb87c4295ffa7c73e8c79e2d3.jpg)
88
+ Figure 5: Power spectral densities.
89
+
90
+ # 3.2 FINDING THE OPTIMAL WEIGHTING SCHEME
91
+
92
+ Considering the equiangular sampling and graphs where each vertex is connected to 4 neighbors (north, south, east, west), Khasanova & Frossard (2017) designed a weighting scheme to minimize (3) for longitudinal and latitudinal rotations6. Their solution gives weights inversely proportional to Euclidean distances:
93
+
94
+ $$
95
+ w _ { i j } = { \frac { 1 } { \| x _ { i } - x _ { j } \| } } .
96
+ $$
97
+
98
+ While the resulting convolution is not equivariant to the whole of $S O ( 3 )$ (figure 2), it is enough for omnidirectional imaging because, as gravity consistently orients the sphere, objects only rotate longitudinally or latitudinally.
99
+
100
+ To achieve equivariance to all rotations, we take inspiration from Belkin & Niyogi (2008). They prove that for a random uniform sampling, the graph Laplacian $\pmb { L }$ built from weights
101
+
102
+ $$
103
+ w _ { i j } = e ^ { - { \frac { 1 } { 4 t } } { \| x _ { i } - x _ { j } \| } ^ { 2 } }
104
+ $$
105
+
106
+ converges to the Laplace-Beltrami operator $\Delta _ { \mathbb { S } ^ { 2 } }$ as the number of samples grows to infinity. This result is a good starting point as $\Delta _ { \mathbb { S } ^ { 2 } }$ commutes with rotation, i.e., $\Delta _ { \mathbb { S } ^ { 2 } } \bar { R } ( \bar { g } ) = R ( g ) \Delta _ { \mathbb { S } ^ { 2 } }$ . While the weighting scheme is full (i.e., every vertex is connected to every other vertex), most weights are small due to the exponential. We hence make an approximation to limit the cost of the convolution (1) by only considering the $k$ nearest neighbors ( $k$ -NN) of each vertex. Given $k$ , the optimal kernel width $t$ is found by searching for the minimizer of (3). Figure 3 shows the optimal kernel widths found for various resolutions of the HEALPix sampling. As predicted by the theory, $t _ { n } \propto n ^ { \beta } , \beta \in$ $\mathbb { R }$ . Importantly however, the optimal $t$ also depends on the number of neighbors $k$ .
107
+
108
+ Considering the HEALPix sampling, Perraudin et al. (2019) connected each vertex to their 8 adjacent vertices in the tiling of the sphere, computed the weights with (5), and heuristically set $t$ to half the average squared Euclidean distance between connected vertices. This heuristic however overestimates $t$ (figure 3) and leads to an increased equivariance error (figure 2).
109
+
110
+ # 3.3 ANALYSIS OF THE PROPOSED WEIGHTING SCHEME
111
+
112
+ We analyze the proposed weighting scheme both theoretically and empirically.
113
+
114
+ Theoretical convergence. We extend the work of (Belkin & Niyogi, 2008) to a sufficiently regular, deterministic sampling. Following their setting, we work with the extended graph Laplacian operator as the linear operator $L _ { n } ^ { t } : L ^ { 2 } ( \mathbb { S } ^ { 2 } ) \to L ^ { 2 } ( \mathbb { S } ^ { 2 } )$ such that
115
+
116
+ $$
117
+ L _ { n } ^ { t } f ( y ) : = { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } e ^ { - { \frac { \| x _ { i } - y \| ^ { 2 } } { 4 t } } } \left( f ( y ) - f ( x _ { i } ) \right) .
118
+ $$
119
+
120
+ ![](images/916ef864d86c3e318cf67c47ef100d36021894e1f1c9fe5b2963a0ef51b3e6f6.jpg)
121
+ Figure 6: Patch.
122
+
123
+ This operator extends the graph Laplacian with the weighting scheme (5) to each point of the sphere (i.e., $\pmb { L } _ { n } ^ { t } \pmb { f } = T _ { \nu } \pmb { L } _ { n } ^ { t } \pmb { f } )$ . As the radius of the kernel $t$ will be adapted to the number of samples, we scale the operator as
124
+
125
+ $\hat { L } _ { n } ^ { t } : = | \mathbb { S } ^ { 2 } | ( 4 \pi t ^ { 2 } ) ^ { - 1 } L _ { n } ^ { t }$ . Given a sampling $\nu$ , we define $\sigma _ { i }$ to be the patch of the surface of the sphere corresponding to $x _ { i }$ , $A _ { i }$ its corresponding area, and $d _ { i }$ the largest distance between the center $x _ { i }$ and any point on the surface $\sigma _ { i }$ . Define $d ^ { ( n ) } : = \operatorname* { m a x } _ { i = 1 , \dots , n } d _ { i }$ and $A ^ { ( n ) } : = \operatorname* { m a x } _ { i = 1 , \ldots , n } A _ { i }$ .
126
+
127
+ Theorem 3.1. For a sampling $\nu$ of the sphere that is equi-area and such that $\begin{array} { r } { d ^ { ( n ) } \leq \frac { C } { n ^ { \alpha } } } \end{array}$ , $\alpha \in$ $( 0 , 1 / 2 ]$ , for all $f : \mathbb { S } ^ { 2 } \to \mathbb { R }$ Lipschitz with respect to the Euclidean distance in $\mathbb { R } ^ { 3 }$ , for all $y \in \mathbb { S } ^ { 2 }$ , there exists a sequence $t _ { n } = n ^ { \bar { \beta } }$ , $\beta \in \mathbb { R }$ such that
128
+
129
+ $$
130
+ \operatorname* { l i m } _ { n \to \infty } \hat { L } _ { n } ^ { t _ { n } } f ( y ) = \Delta _ { \mathbb { S } ^ { 2 } } f ( y ) .
131
+ $$
132
+
133
+ This is a major step towards equivariance, as the Laplace-Beltrami operator commutes with rotation.
134
+ Based on this property, we show the equivariance of the scaled extended graph Laplacian.
135
+
136
+ Theorem 3.2. Under the hypothesis of theorem 3.1, the scaled graph Laplacian commutes with any rotation, in the limit of infinite sampling, i.e.,
137
+
138
+ $$
139
+ \forall y \in \mathbb { S } ^ { 2 } \quad \left| R ( g ) \hat { L } _ { n } ^ { t _ { n } } f ( y ) - \hat { L } _ { n } ^ { t _ { n } } R ( g ) f ( y ) \right| \xrightarrow { n \to \infty } 0 .
140
+ $$
141
+
142
+ From this theorem, it follows that the discrete graph Laplacian will be equivariant in the limit of $n \infty$ as by construction ${ \pmb { L } } _ { n } ^ { t } { \pmb { f } } = T _ { \nu } { \pmb { L } } _ { n } ^ { t } { \pmb { f } }$ and as the scaling does not affect the equivariance property of $L _ { n } ^ { t }$ .
143
+
144
+ Importantly, the proof of Theorem 3.1 (in Appendix A) inspires our construction of the graph Laplacian. In particular, it tells us that $t$ should scale as $n ^ { \beta }$ , which has been empirically verified (figure 3). Nevertheless, it is important to keep in mind the limits of Theorem 3.1 and 3.2. Both theorems present asymptotic results, but in practice we will always work with finite samplings. Furthermore, since this method is based on the capability of the eigenvectors of the graph Laplacian to approximate the spherical harmonics, a stronger type of convergence of the graph Laplacian would be preferable, i.e., spectral convergence (that is proved for a full graph in the case of random sampling for a class of Lipschitz functions in (Belkin & Niyogi, 2007)). Finally, while we do not have a formal proof for it, we strongly believe that the HEALPix sampling does satisfy the hypothesis $\begin{array} { r } { d ^ { ( n ) } \leq \frac { \bar { C } } { n ^ { \alpha } } } \end{array}$ Cnα , α ∈ (0, 1/2], with α very close or equal to 1/2. The empirical results discussed in the next paragraph also points in this direction. This is further discussed in Appendix A.
145
+
146
+ Empirical convergence. Figure 2 shows the equivariance error (3) for different parameter sets of DeepSphere for the HEALPix sampling as well as for the graph construction of Khasanova & Frossard (2017) fresolution and sigfor HEALPix and uiangular sampling. The error is estimated as a function ofency. The resolution is controlled by the number of pixels for the equiangular sampling. The frequency is controlled $n = 1 2 \bar { N } _ { s i d e } ^ { 2 }$ $n = 4 \hat { b } ^ { 2 }$
147
+ set $C$ to functions $f$ made of spherical harmonics of a single degree $\ell$ . To allow for an almost perfect implementation (up to numerical errors) of the operator $\scriptstyle R _ { \gamma }$ , the degree $\ell$ was chosen in the range $( 0 , 3 N _ { s i d e } - 1 )$ for HEALPix and $( 0 , b )$ for the equiangular sampling (Gorski et al., 1999). Using these parameters, the measured error is mostly due to imperfections in the empirical approximation of the Laplace-Beltrami operator and not to the sampling.
148
+
149
+ <table><tr><td rowspan="2"></td><td colspan="2"> performance</td><td>size</td><td colspan="2">speed</td></tr><tr><td>F1</td><td>mAP</td><td>params</td><td>inference</td><td>training</td></tr><tr><td>Cohen et al. (2018) (b = 128)</td><td>1</td><td>67.6</td><td>1400k</td><td>38.0ms</td><td>50h</td></tr><tr><td>Cohen et al. (2018) (simplified,9b = 64)</td><td>78.9</td><td>66.5</td><td>400k</td><td>12.0 ms</td><td>32h</td></tr><tr><td>Esteves et al. (2018) (b = 64)</td><td>79.4</td><td>68.5</td><td>500k</td><td>9.8ms</td><td>3h</td></tr><tr><td>DeepSphere (equiangular, b = 64)</td><td>79.4</td><td>66.5</td><td>190k</td><td>0.9 ms</td><td>50m</td></tr><tr><td>DeepSphere (HEALPix, Nside = 32)</td><td>80.7</td><td>68.6</td><td>190k</td><td>0.9 ms</td><td>50m</td></tr></table>
150
+
151
+ Table 1: Results on SHREC’17 (3D shapes). DeepSphere achieves similar performance at a much lower cost, suggesting that anisotropic filters are an unnecessary price to pay.
152
+
153
+ Figure 2 shows that the weighting scheme (4) from (Khasanova & Frossard, 2017) does indeed not lead to a convolution that is equivariant to all rotations $g \in S O ( 3 )$ .7 For $k = 8$ neighbors, selecting the optimal kernel width $t$ improves on (Perraudin et al., 2019) at no cost, highlighting the importance of this parameter. Increasing the resolution decreases the equivariance error in the high frequencies, an effect most probably due to the sampling. Most importantly, the equivariance error decreases when connecting more neighbors. Hence, the number of neighbors $k$ gives us a precise control of the tradeoff between cost and equivariance.
154
+
155
+ # 4 EXPERIMENTS
156
+
157
+ # 4.1 3D OBJECTS RECOGNITION
158
+
159
+ The recognition of 3D shapes is a rotation invariant task: rotating an object doesn’t change its nature. While 3D shapes are usually represented as meshes or point clouds, representing them as spherical maps (figure 4) naturally allows a rotation invariant treatment.
160
+
161
+ The SHREC’17 shape retrieval contest (Savva et al., 2017) contains 51,300 randomly oriented 3D models from ShapeNet (Chang et al., 2015), to be classified in 55 categories (tables, lamps, airplanes, etc.). As in (Cohen et al., 2018), objects are represented by 6 spherical maps. At each pixel, a ray is traced towards the center of the sphere. The distance from the sphere to the object forms a depth map. The cos and sin of the surface angle forms two normal maps. The same is done for the object’s convex hull.8 The maps are sampled by an equiangular sampling with bandwidth $b = 6 4$ $( n ^ { \cdot } = 4 b ^ { 2 } = 1 6 , 3 8 4$ pixels) or an HEALPix sampling with $N _ { s i d e } = 3 2$ $\dot { ( n = 1 2 N _ { s i d e } ^ { 2 } = 1 2 , 2 8 8 }$ pixels).
162
+
163
+ The equiangular graph is built with (4) and $k = 4$ neighbors (following Khasanova & Frossard, 2017). The HEALPix graph is built with (5), $k = 8$ , and a kernel width $t$ set to the average of the distances (following Perraudin et al., 2019). The NN is made of 5 graph convolutional layers, each followed by a max pooling layer which down-samples by 4. A GAP and a fully connected layer with softmax follow. The polynomials are all of order $P = 3$ and the number of channels per layer is 16, 32, 64, 128, 256, respectively. Following Esteves et al. (2018), the cross-entropy plus a triplet loss is optimized with Adam for 30 epochs on the dataset augmented by 3 random translations. The learning rate is $5 \cdot 1 0 ^ { - 2 } ~ $ and the batch size is 32.
164
+
165
+ Results are shown in table 1. As the network is trained for shape classification rather than retrieval, we report the classification F1 alongside the mAP used in the retrieval contest.10 DeepSphere achieves the same performance as Cohen et al. (2018) and Esteves et al. (2018) at a much lower cost, suggesting that anisotropic filters are an unnecessary price to pay. As the information in those spherical maps resides in the low frequencies (figure 5), reducing the equivariance error didn’t translate into improved performance. For the same reason, using the more uniform HEALPix sampling or lowering the resolution down to $N _ { s i d e } = 8$ $n = 7 6 8$ pixels) didn’t impact performance either.
166
+
167
+ Table 2: Results on the classification of partial convergence maps. Lower equivariance error translates to higher performance.
168
+
169
+ <table><tr><td></td><td>accuracy</td><td>time</td></tr><tr><td>Perraudin etal. (2019),2D CNNbaseline</td><td>54.2</td><td>104 ms</td></tr><tr><td>Perraudin et al. (2019), CNN variant, k = 8</td><td>62.1</td><td>185ms</td></tr><tr><td>Perraudin etal. (2019),FCN variant, k = 8</td><td>83.8</td><td>185 ms</td></tr><tr><td>k = 8 neighbors,t from section 3.2</td><td>87.1</td><td>185 ms</td></tr><tr><td>k = 2O neighbors,t from section 3.2</td><td>91.3</td><td>250 ms</td></tr><tr><td>k = 40 neighbors,t from section 3.2</td><td>92.5</td><td>363 ms</td></tr></table>
170
+
171
+ ![](images/82ba85a574ce1b8bec111f356c7f88aed670a9d495e7edd9c1cd3977647025fc.jpg)
172
+ Figure 7: Tradeoff between cost and accuracy.
173
+
174
+ # 4.2 COSMOLOGICAL MODEL CLASSIFICATION
175
+
176
+ Given observations, cosmologists estimate the posterior probability of cosmological parameters, such as the matter density $\Omega _ { m }$ and the normalization of the matter power spectrum $\sigma _ { 8 }$ . Those parameters are typically estimated by likelihood-free inference, which requires a function to predict the parameters from simulations. As that is complicated to setup, prediction methods are typically benchmarked on the classification of spherical maps instead (Schmelzle et al., 2017). We used the same task, data, and setup as Perraudin et al. (2019): the classification of 720 partial convergence maps made of $n \approx 1 0 ^ { 6 }$ pixels $( 1 / 1 2 \approx 8 \%$ of a sphere at $N _ { s i d e } = 1 0 2 4 )$ from two $\Lambda { \bf C D M }$ cosmological models, $\Omega _ { m } = 0 . 3 1$ , $\sigma _ { 8 } = 0 . 8 2 ,$ ) and $\Omega _ { m } = 0 . 2 6$ , $\sigma _ { 8 } = 0 . 9 1$ ), at a relative noise level of 3.5 (i.e., the signal is hidden in noise of 3.5 times higher standard deviation). Convergence maps represent the distribution of over- and under-densities of mass in the universe (see Bartelmann, 2010, for a review of gravitational lensing).
177
+
178
+ Graphs are built with (5), $k = 8 , 2 0 , 4 0$ neighbors, and the corresponding optimal kernel widths $t$ given in section 3.2. Following Perraudin et al. (2019), the NN is made of 5 graph convolutional layers, each followed by a max pooling layer which down-samples by 4. A GAP and a fully connected layer with softmax follow. The polynomials are all of order $P = 4$ and the number of channels per layer is 16, 32, 64, 64, 64, respectively. The cross-entropy loss is optimized with Adam for 80 epochs. The learning rate is $2 \cdot 1 \dot { 0 } ^ { - 4 } \cdot 0 . 9 9 9 ^ { \mathrm { s t e p } }$ and the batch size is 8.
179
+
180
+ Unlike on SHREC’17, results (table 2) show that a lower equivariance error on the convolutions translates to higher performance. That is probably due to the high frequency content of those maps (figure 5). There is a clear cost-accuracy tradeoff, controlled by the number of neighbors $k$ (figure 7). This experiment moreover demonstrates DeepSphere’s flexibility (using partial spherical maps) and scalability (competing spherical CNNs were tested on maps of at most 10, 000 pixels).
181
+
182
+ # 4.3 CLIMATE EVENT SEGMENTATION
183
+
184
+ We evaluate our method on a task proposed by (Mudigonda et al., 2017): the segmentation of extreme climate events, Tropical Cyclones (TC) and Atmospheric Rivers (AR), in global climate simulations (figure 1c). The data was produced by a 20-year run of the Community Atmospheric Model v5 (CAM5) and consists of 16 channels such as temperature, wind, humidity, and pressure at multiple altitudes. We used the pre-processed dataset from (Jiang et al., 2019).11 There is 1,072,805 spherical maps, down-sampled to a level-5 icosahedral sampling $( n = 1 0 \cdot 4 ^ { l } + 2 = 1 0$ , 242 pixels). The labels are heavily unbalanced with $0 . 1 \%$ TC, $2 . 2 \%$ AR, and $9 7 . 7 \%$ background (BG) pixels.
185
+
186
+ The graph is built with (5), $k = 6$ neighbors, and a kernel width $t$ set to the average of the distances. Following Jiang et al. (2019), the NN is an encoder-decoder with skip connections. Details in section C.3. The polynomials are all of order $P = 3$ . The cross-entropy loss (weighted or nonweighted) is optimized with Adam for 30 epochs. The learning rate is $1 \cdot 1 0 { - 3 }$ and the batch size is 64.
187
+
188
+ Results are shown in table 3 (details in tables 6, 7 and 8). The mean and standard deviation are computed over 5 runs. Note that while Jiang et al. (2019) and Cohen et al. (2019) use a weighted cross-entropy loss, that is a suboptimal proxy for the mAP metric. DeepSphere achieves state-of
189
+
190
+ Table 3: Results on climate event segmentation: mean accuracy (over TC, AR, BG) and mean average precision (over TC and AR). DeepSphere achieves state-of-the-art performance.
191
+
192
+ <table><tr><td></td><td>accuracy</td><td>mAP</td></tr><tr><td>Jiang et al. (2019) (rerun)</td><td>94.95</td><td>38.41</td></tr><tr><td>Cohen et al. (2019) (S2R)</td><td>97.5</td><td>68.6</td></tr><tr><td>Cohen et al. (2019) (R2R)</td><td>97.7</td><td>75.9</td></tr><tr><td>DeepSphere (weighted loss)</td><td>97.8 ± 0.3</td><td>77.15 ± 1.94</td></tr><tr><td>DeepSphere (non-weighted loss)</td><td>87.8 ± 0.5</td><td>89.16 ± 1.37</td></tr></table>
193
+
194
+ <table><tr><td rowspan="2">order P</td><td colspan="3">temp. (from past temp.)</td><td colspan="3">day (from temperature)</td><td colspan="3">day (from precipitations)</td></tr><tr><td>MSE</td><td>MAE</td><td>R2</td><td>MSE</td><td>MAE</td><td>R2</td><td>MSE</td><td>MAE</td><td>R2</td></tr><tr><td>0</td><td>10.88</td><td>2.42</td><td>0.896</td><td>0.10</td><td>0.10</td><td>0.882</td><td>0.58</td><td>0.42</td><td>-0.980</td></tr><tr><td>4</td><td>8.20</td><td>2.11</td><td>0.919</td><td>0.05</td><td>0.05</td><td>0.969</td><td>0.50</td><td>0.18</td><td>0.597</td></tr></table>
195
+
196
+ Table 4: Prediction results on data from weather stations. Structure always improves performance.
197
+
198
+ the-art performance, suggesting again that anisotropic filters are unnecessary. Note that results from Mudigonda et al. (2017) cannot be directly compared as they don’t use the same input channels.
199
+
200
+ Compared to Cohen et al. (2019)’s conclusion, it is surprising that S2R does worse than DeepSphere (which is limited to S2S). Potential explanations are (i) that their icosahedral projection introduces harmful distortions, or (ii) that a larger architecture can compensate for the lack of generality. We indeed observed that more feature maps and depth led to higher performance (section C.3).
201
+
202
+ # 4.4 UNEVEN SAMPLING
203
+
204
+ To demonstrate the flexibility of modeling the sampled sphere by a graph, we collected historical measurements from $n \approx 1 0 , 0 0 0$ weather stations scattered across the Earth.12 The spherical data is heavily non-uniformly sampled, with a much higher density of weather stations over North America than the Pacific (figure 1d). For illustration, we devised two artificial tasks. A dense regression: predict the temperature on a given day knowing the temperature on the previous 5 days. A global regression: predict the day (represented as one period of a sine over the year) from temperature or precipitations. Predicting from temperature is much easier as it has a clear yearly pattern.
205
+
206
+ The graph is built with (5), $k = 5$ neighbors, and a kernel width $t$ set to the average of the distances. The equivariance property of the resulting graph has not been tested, and we don’t expect it to be good due to the heavily non-uniform sampling. The NN is made of 3 graph convolutional layers. The polynomials are all of order $P = 0$ or 4 and the number of channels per layer is 50, 100, 100, respectively. For the global regression, a GAP and a fully connected layer follow. For the dense regression, a graph convolutional layer follows instead. The MSE loss is optimized with RMSprop for 250 epochs. The learning rate is $\mathrm { i } \cdot 1 0 ^ { - 3 }$ and the batch size is 64.
207
+
208
+ Results are shown in table 4. While using a polynomial order $P = 0$ is like modeling each time series independently with an MLP, orders $P > 0$ integrate neighborhood information. Results show that using the structure induced by the spherical geometry always yields better performance.
209
+
210
+ # 5 CONCLUSION
211
+
212
+ This work showed that DeepSphere strikes an interesting, and we think currently optimal, balance between desiderata for a spherical CNN. A single parameter, the number of neighbors $k$ a pixel is connected to in the graph, controls the tradeoff between cost and equivariance (which is linked to performance). As computational cost and memory consumption scales linearly with the number of pixels, DeepSphere scales to spherical maps made of millions of pixels, a required resolution to faithfully represent cosmological and climate data. Also relevant in scientific applications is the flexibility offered by a graph representation (for partial coverage, missing data, and non-uniform samplings). Finally, the implementation of the graph convolution is straightforward, and the ubiquity of graph neural networks — pushing for their first-class support in DL frameworks — will make implementations even easier and more efficient.
213
+
214
+ A potential drawback of graph Laplacian-based approaches is the isotropy of graph filters, reducing in principle the expressive power of the NN. Experiments from Cohen et al. (2019) and Boscaini et al. (2016) indeed suggest that more general convolutions achieve better performance. Our experiments on 3D shapes (section 4.1) and climate (section 4.3) however show that DeepSphere’s isotropic filters do not hinder performance. Possible explanations for this discrepancy are that NNs somehow compensate for the lack of anisotropic filters, or that some tasks can be solved with isotropic filters. The distortions induced by the icosahedral projection in (Cohen et al., 2019) or the leakage of curvature information in (Boscaini et al., 2016) might also alter performance.
215
+
216
+ Developing graph convolutions on irregular samplings that respect the geometry of the sphere is another research direction of importance. Practitioners currently interpolate their measurements (coming from arbitrarily positioned weather stations, satellites or telescopes) to regular samplings. This practice either results in a waste of resolution or computational and storage resources. Our ultimate goal is for practitioners to be able to work directly on their measurements, however distributed.
217
+
218
+ # ACKNOWLEDGMENTS
219
+
220
+ We thank Pierre Vandergheynst for advices, and Taco Cohen for his inputs on the intriguing results of our comparison with Cohen et al. (2019). We thank the anonymous reviewers for their constructive feedback. The following software packages were used for computation and plotting: PyGSP (Defferrard et al.), healpy (Zonca et al., 2019), matplotlib (Hunter, 2007), SciPy (Virtanen et al., 2020), NumPy (Walt et al., 2011), TensorFlow (Abadi et al., 2015).
221
+
222
+ # REFERENCES
223
+
224
+ Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dandelion Mane, Rajat Monga, Sherry Moore, Derek Murray, Chris ´ Olah, Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viegas, Oriol Vinyals, Pete Warden, Martin Wat- ´ tenberg, 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.
225
+
226
+ M. Bartelmann. Gravitational lensing. Classical and Quantum Gravity, 2010.
227
+
228
+ John R Baumgardner and Paul O Frederickson. Icosahedral discretization of the two-sphere. SIAM Journal on Numerical Analysis, 1985.
229
+
230
+ Mikhail Belkin and Partha Niyogi. Convergence of laplacian eigenmaps. In Advances in Neural Information Processing Systems, 2007.
231
+
232
+ Mikhail Belkin and Partha Niyogi. Towards a theoretical foundation for laplacian-based manifold methods. Journal of Computer and System Sciences, 2008.
233
+
234
+ Wouter Boomsma and Jes Frellsen. Spherical convolutions and their application in molecular modelling. In Advances in Neural Information Processing Systems, 2017.
235
+
236
+ Davide Boscaini, Jonathan Masci, Emanuele Rodola, and Michael Bronstein. Learning shape cor- \` respondence with anisotropic convolutional neural networks. In Advances in Neural Information Processing Systems, 2016.
237
+
238
+ Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann LeCun. Spectral networks and locally connected networks on graphs. arXiv:1312.6203, 2013. URL https://arxiv.org/abs/ 1312.6203.
239
+
240
+ Angel X Chang, Thomas Funkhouser, Leonidas Guibas, Pat Hanrahan, Qixing Huang, Zimo Li, Silvio Savarese, Manolis Savva, Shuran Song, Hao Su, et al. Shapenet: An information-rich 3d model repository. arXiv:1512.03012, 2015.
241
+
242
+ Taco S Cohen, Mario Geiger, Jonas Koehler, and Max Welling. Spherical cnns. In International Conference on Learning Representations (ICLR), 2018. URL https://arxiv.org/abs/ 1801.10130.
243
+
244
+ Taco S. Cohen, Maurice Weiler, Berkay Kicanaoglu, and Max Welling. Gauge equivariant convolutional networks and the icosahedral cnn. In International Conference on Machine Learning (ICML), 2019. URL http://arxiv.org/abs/1902.04615.
245
+
246
+ Benjamin Coors, Alexandru Paul Condurache, and Andreas Geiger. Spherenet: Learning spherical representations for detection and classification in omnidirectional images. In European Conference on Computer Vision, 2018.
247
+
248
+ Michael Defferrard, Lionel Martin, Rodrigo Pena, and Nathana ¨ el Perraudin. Pygsp: Graph signal ¨ processing in python. URL https://github.com/epfl-lts2/pygsp/.
249
+
250
+ Michael Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks ¨ on graphs with fast localized spectral filtering. In Advances in Neural Information Processing Systems, 2016. URL https://arxiv.org/abs/1606.09375.
251
+
252
+ Michael Defferrard, Nathana ¨ el Perraudin, Tomasz Kacprzak, and Raphael Sgier. Deepsphere: to- ¨ wards an equivariant graph-based spherical cnn. In ICLR Workshop on Representation Learning on Graphs and Manifolds, 2019. URL https://arxiv.org/abs/1904.05146.
253
+
254
+ J. R. Driscoll and D. M. Healy. Computing fourier transforms and convolutions on the 2-sphere. Adv. Appl. Math., 1994. URL http://dx.doi.org/10.1006/aama.1994.1008.
255
+
256
+ Carlos Esteves, Christine Allen-Blanchette, Ameesh Makadia, and Kostas Daniilidis. Learning so(3) equivariant representations with spherical cnns. In Proceedings of the European Conference on Computer Vision (ECCV), 2018. URL https://arxiv.org/abs/1711.06721.
257
+
258
+ Krzysztof M Gorski, Benjamin D Wandelt, Frode K Hansen, Eric Hivon, and Anthony J Banday. The healpix primer. arXiv preprint astro-ph/9905275, 1999.
259
+
260
+ Krzysztof M Gorski, Eric Hivon, AJ Banday, Benjamin D Wandelt, Frode K Hansen, Mstvos Reinecke, and Matthia Bartelmann. Healpix: a framework for high-resolution discretization and fast analysis of data distributed on the sphere. The Astrophysical Journal, 2005.
261
+
262
+ J. D. Hunter. Matplotlib: A 2d graphics environment. Computing in Science & Engineering, 9(3): 90–95, 2007. doi: 10.1109/MCSE.2007.55.
263
+
264
+ Chiyu ”Max” Jiang, Jingwei Huang, Karthik Kashinath, Prabhat, Philip Marcus, and Matthias Niessner. Spherical cnns on unstructured grids. In International Conference on Learning Representations (ICLR), 2019. URL https://arxiv.org/abs/1901.02039.
265
+
266
+ Renata Khasanova and Pascal Frossard. Graph-based classification of omnidirectional images. In Proceedings of the IEEE International Conference on Computer Vision, 2017. URL https: //arxiv.org/abs/1707.08301.
267
+
268
+ Mayur Mudigonda, Sookyung Kim, Ankur Mahesh, Samira Kahou, Karthik Kashinath, Dean Williams, Vincen Michalski, Travis O’Brien, and Mr Prabhat. Segmenting and tracking extreme climate events using neural networks. In Deep Learning for Physical Sciences (DLPS) Workshop, held with NIPS Conference, 2017. URL https://dl4physicalsciences.github.io/ files/nips_dlps_2017_20.pdf.
269
+
270
+ Nathanael Perraudin, Micha ¨ el Defferrard, Tomasz Kacprzak, and Raphael Sgier. Deepsphere: Effi-¨ cient spherical convolutional neural network with healpix sampling for cosmological applications. Astronomy and Computing, 2019. URL https://arxiv.org/abs/1810.12186.
271
+
272
+ Planck Collaboration. Planck 2015 results. i. overview of products and scientific results. Astronomy & Astrophysics, 2016.
273
+
274
+ Manolis Savva, Fisher Yu, Hao Su, Asako Kanezaki, Takahiko Furuya, Ryutarou Ohbuchi, Zhichao Zhou, Rui Yu, Song Bai, Xiang Bai, et al. Large-scale 3d shape retrieval from shapenet core55: Shrec’17 track. In Eurographics Workshop on 3D Object Retrieval, 2017. J. Schmelzle, A. Lucchi, T. Kacprzak, A. Amara, R. Sgier, A. Refr ´ egier, and T. Hofmann. Cosmo- ´ logical model discrimination with deep learning. arxiv:1707.05167, 2017. Yu-Chuan Su and Kristen Grauman. Learning spherical convolution for fast features from 360 imagery. In Advances in Neural Information Processing Systems, 2017. Pauli Virtanen, Ralf Gommers, Travis E. Oliphant, Matt Haberland, Tyler Reddy, David Cournapeau, Evgeni Burovski, Pearu Peterson, Warren Weckesser, Jonathan Bright, Stefan J. van der ´ Walt, Matthew Brett, Joshua Wilson, K. Jarrod Millman, Nikolay Mayorov, Andrew R. J. Nelson, Eric Jones, Robert Kern, Eric Larson, CJ Carey, ˙Ilhan Polat, Yu Feng, Eric W. Moore, Jake Vand erPlas, Denis Laxalde, Josef Perktold, Robert Cimrman, Ian Henriksen, E. A. Quintero, Charles R Harris, Anne M. Archibald, Antonio H. Ribeiro, Fabian Pedregosa, Paul van Mulbregt, ˆ and SciPy 1. 0 Contributors. SciPy 1.0: Fundamental Algorithms for Scientific Computing in Python. Nature Methods, 2020. doi: https://doi.org/10.1038/s41592-019-0686-2. Stefan van der Walt, S Chris Colbert, and Gael Varoquaux. The numpy array: a structure for efficient ´ numerical computation. Computing in Science & Engineering, 13(2):22–30, 2011. Andrea Zonca, Leo Singer, Daniel Lenz, Martin Reinecke, Cyrille Rosset, Eric Hivon, and Krzysztof Gorski. healpy: equal area pixelization and spherical harmonics transforms for data on the sphere in python. Journal of Open Source Software, 4(35):1298, March 2019. doi: 10.21105/joss.01298. URL https://doi.org/10.21105/joss.01298.
275
+
276
+ # SUPPLEMENTARY MATERIAL
277
+
278
+ # A PROOF OF THEOREM 3.1
279
+
280
+ Preliminaries. The proof of theorem 3.1 is inspired from the work of Belkin & Niyogi (2008). As a result, we start by restating some of their results. Given a sampling ${ \mathcal { V } } = \{ x _ { i } \in { \mathcal { M } } \} _ { i = 1 } ^ { n }$ of a closed, compact and infinitely differentiable manifold $\mathcal { M }$ , a smooth $( \in \mathcal { C } _ { \infty } ( \mathcal { M } ) )$ function $f : \mathcal { M } \mathbb { R }$ , and defined the vector $f$ of samples of $f$ as follows: $T _ { \mathcal { V } } f = f \in \mathbb { R } ^ { n }$ , $f _ { i } = f ( x _ { i } )$ . The proof is constructed by leveraging 3 different operators:
281
+
282
+ • The extended graph Laplacian operator, already presented in (6), is a linear operator $L _ { n } ^ { t }$ : $L ^ { 2 } ( \mathcal { M } ) \to L ^ { 2 } \mathbf { \bar { ( } } \mathcal { M } )$ defined as
283
+
284
+ $$
285
+ L _ { n } ^ { t } f ( y ) : = { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } e ^ { - { \frac { \| x _ { i } - y \| ^ { 2 } } { 4 t } } } \left( f ( y ) - f ( x _ { i } ) \right) .
286
+ $$
287
+
288
+ Note that we have the following relation $L _ { n } ^ { t } f = T _ { \nu } L _ { n } ^ { t } f$ .
289
+
290
+ • The functional approximation to the Laplace-Beltrami operator is a linear operator $L ^ { t }$ : $L ^ { 2 } ( \mathcal { M } ) \to L ^ { 2 } ( \dot { \mathcal { M } } )$ defined as
291
+
292
+ $$
293
+ L ^ { t } f ( y ) = \int _ { \mathcal { M } } e ^ { - \frac { \| x - y \| ^ { 2 } } { 4 t } } \left( f ( y ) - f ( x ) \right) d \mu ( x ) ,
294
+ $$
295
+
296
+ where $\mu$ is the uniform probability measure on the manifold $\mathcal { M }$ , and $\operatorname { v o l } ( \mathcal { M } )$ is the volume of $\mathcal { M }$ .
297
+
298
+ • The Laplace-Beltrami operator $\Delta _ { { \scriptscriptstyle M } }$ is defined as the divergence of the gradient
299
+
300
+ $$
301
+ \Delta _ { \mathcal { M } } f ( y ) : = - \mathrm { d i v } ( \nabla _ { \mathcal { M } } f )
302
+ $$
303
+
304
+ of a differentiable function $f : \mathcal { M } \mathbb { R }$ . The gradient $\nabla f : \mathcal { M } T _ { p } \mathcal { M }$ is a vector field defined on the manifold pointing towards the direction of steepest ascent of $f$ , where $T _ { p } { \mathcal { M } }$ is the affine space of all vectors tangent to $\mathcal { M }$ at $p$ .
305
+
306
+ Leveraging these three operators, Belkin & Niyogi (2008; 2007) have build proofs of both pointwise and spectral convergence of the extended graph Laplacian towards the Laplace-Beltrami operator in the general setting of any compact, closed and infinitely differentiable manifold $\mathcal { M }$ , where the sampling $\nu$ is drawn randomly on the manifold. For this reason, their results are all to be interpreted in a probabilistic sense. Their proofs consist in establishing that (6) converges in probability towards (8) as $n \to \infty$ and (8) converges towards (9) as $t 0$ . In particular, this second step is given by the following:
307
+
308
+ Proposition 1 (Belkin & Niyogi (2008), Proposition 4.4). Let $\mathcal { M }$ be a $k$ -dimensional compact smooth manifold embedded in some Euclidean space $\mathbb { R } ^ { N }$ , and fix $y \in \mathcal { M }$ . Let $f \in \mathcal { C } _ { \infty } ( \mathcal { M } )$ . Then
309
+
310
+ $$
311
+ \frac { 1 } { t } \frac { 1 } { ( 4 \pi t ) ^ { k / 2 } } L ^ { t } f ( y ) \xrightarrow { t \to 0 } \frac { 1 } { \nu o l ( \mathcal { M } ) } \Delta _ { \mathcal { M } } f ( y ) .
312
+ $$
313
+
314
+ Building the proof. As the sphere is a compact smooth manifold embedded in $\mathbb { R } ^ { 3 }$ , we can reuse proposition 1. Thus, our strategy to prove Theorem 3.1 is to (i) show that
315
+
316
+ $$
317
+ \operatorname* { l i m } _ { n \to \infty } L _ { n } ^ { t } f ( y ) = L ^ { t } ( y )
318
+ $$
319
+
320
+ for a particular class of deterministic samplings, and (ii) apply Proposition 1.
321
+
322
+ We start by proving that for smooth functions, for any fixed $t$ , the extended graph Laplacian $L _ { n } ^ { t }$ converges towards its continuous counterpart $L ^ { t }$ as the sampling increases in size.
323
+
324
+ Proposition 2. For an equal area sampling $\{ x _ { i } \in \mathbb { S } ^ { 2 } \} _ { i = 1 } ^ { n } : A _ { i } = A _ { j } \forall i , j$ of the sphere it is true that for all $f : \mathbb { S } ^ { 2 } \to \mathbb { R }$ Lipschitz with respect to the Euclidean distance $\lVert \cdot \rVert$ with Lipschitz constant $C _ { f }$
325
+
326
+ $$
327
+ \left| \int _ { \mathbb { S } ^ { 2 } } f ( x ) d \mu ( x ) - { \frac { 1 } { n } } \sum _ { i } f ( x _ { i } ) \right| \leq C _ { f } d ^ { ( n ) } .
328
+ $$
329
+
330
+ Furthermore, for all $y \in \mathbb { S } ^ { 2 }$ the Heat Kernel Graph Laplacian operator $L _ { n } ^ { t }$ converges pointwise to the functional approximation of the Laplace Beltrami operator $L ^ { t }$
331
+
332
+ $$
333
+ L _ { n } ^ { t } f ( y ) \xrightarrow { n \to \infty } L ^ { t } f ( y ) .
334
+ $$
335
+
336
+ Proof. Assuming $f : \mathbb { S } ^ { 2 } \to \mathbb { R }$ is Lipschitz with Lipschitz constant $C _ { f }$ , we have
337
+
338
+ $$
339
+ \left| \int _ { \sigma _ { i } } f ( x ) \mathrm { d } \mu ( x ) - \frac { 1 } { n } f ( x _ { i } ) \right| \leq C _ { f } d ^ { ( n ) } \frac { 1 } { n } ,
340
+ $$
341
+
342
+ where $\sigma _ { i } \subset \mathbb { S } ^ { 2 }$ is the subset of the sphere corresponding to the patch around $x _ { i }$ . Remember that the sampling is equal area. Hence, using the triangular inequality and summing all the contributions of the $n$ patches, we obtain
343
+
344
+ $$
345
+ \left| \int _ { \mathbb { S } ^ { 2 } } f ( x ) \mathrm { d } \mu ( x ) - \frac { 1 } { n } \sum _ { i } f ( x _ { i } ) \right| \leq \sum _ { i } \left| \frac { 1 } { 4 \pi ^ { 2 } } \int _ { \sigma _ { i } } f ( x ) \mathrm { d } \mu ( x ) - \frac { 1 } { n } f ( x _ { i } ) \right| \leq n C _ { f } d ^ { ( n ) } \frac { 1 } { n } = C _ { f } d ^ { ( n ) }
346
+ $$
347
+
348
+ A direct application of this result leads to the following pointwise convergences
349
+
350
+ $$
351
+ \forall f \mathrm { L i p s c h i t z } , \quad \forall y \in \mathbb { S } ^ { 2 } , \qquad \frac { 1 } { n } \sum _ { i } e ^ { - \frac { \| x _ { i } - y \| ^ { 2 } } { 4 t } } \to \int e ^ { - \frac { \| x - y \| ^ { 2 } } { 4 t } } d \mu ( x )
352
+ $$
353
+
354
+ $$
355
+ \forall f \mathrm { L i p s c h i t z } , \quad \forall y \in \mathbb { S } ^ { 2 } , \qquad \frac { 1 } { n } \sum _ { i } e ^ { - \frac { \| x _ { i } - y \| ^ { 2 } } { 4 t } } f ( x _ { i } ) \to \int e ^ { - \frac { \| x - y \| ^ { 2 } } { 4 t } } f ( x ) d \mu ( x )
356
+ $$
357
+
358
+ Definitions 6 and 8 end the proof.
359
+
360
+ The last proposition show that for a fixed $t$ , $L _ { n } ^ { t } f ( x ) \to 1 / 4 \pi ^ { 2 } L ^ { t } f ( x )$ . To utilize Proposition 1 and complete the proof, we need to find a sequence of $t _ { n }$ for which this holds as $t _ { n } \to 0$ . Furthermore this should hold with a faster decay than $\frac { 1 } { 4 \pi t _ { n } ^ { 2 } }$ .
361
+
362
+ Proposition 3. Given $A _ { j } \ \forall i , j$ and $\begin{array} { r } { d ^ { ( n ) } \leq \frac { C } { n ^ { \alpha } } } \end{array}$ , $a$ $\alpha \in ( 0 , 1 / 2 ]$ sampling regular enough, i.e., for which we assume , a Lipschitz function $f$ and a point $y \in \mathbb { S } ^ { 2 }$ i there exists $\begin{array} { r l } { A _ { i } } & { { } = } \end{array}$ $a$ sequence $t _ { n } = n ^ { \beta } , \beta < 0$ such that
363
+
364
+ $$
365
+ \forall f L i p s c h i t z , \forall x \in \mathbb { S } ^ { 2 } \quad \left| { \frac { 1 } { 4 \pi t _ { n } ^ { 2 } } } \left( L _ { n } ^ { t _ { n } } f ( x ) - L ^ { t _ { n } } f ( x ) \right) \right| { \xrightarrow { n \to \infty } } 0 .
366
+ $$
367
+
368
+ Proof. To ease the notation, we define
369
+
370
+ $$
371
+ \begin{array} { r l } & { K ^ { t } ( x , y ) : = e ^ { - \frac { \| x - y \| ^ { 2 } } { 4 t } } } \\ & { \phi ^ { t } ( x ; y ) : = e ^ { - \frac { \| x - y \| ^ { 2 } } { 4 t } } \left( f ( y ) - f ( x ) \right) . } \end{array}
372
+ $$
373
+
374
+ We start with the following inequality
375
+
376
+ $$
377
+ \begin{array} { l } { { \displaystyle \| L _ { n } ^ { t } f - L ^ { t } f \| _ { \infty } = \operatorname* { m a x } _ { y \in \mathbb S ^ { 2 } } \left| L _ { n } ^ { t } f ( y ) - L ^ { t } f ( y ) \right| } } \\ { { \displaystyle \qquad = \operatorname* { m a x } _ { y \in \mathbb S ^ { 2 } } \left| \frac 1 n \sum _ { i = 1 } ^ { n } \phi ^ { t } ( x _ { i } ; y ) - \int _ { \mathbb S ^ { 2 } } \phi ^ { t } ( x ; y ) d \mu ( x ) \right| } } \\ { { \displaystyle \qquad \leq \operatorname* { m a x } _ { y \in \mathbb S ^ { 2 } } \sum _ { i = 1 } ^ { n } \left| \frac 1 n \phi ^ { t } ( x _ { i } ; y ) - \int _ { \sigma _ { i } } \phi ^ { t } ( x ; y ) d \mu ( x ) \right| } } \\ { { \displaystyle \qquad \leq d ^ { ( n ) } \operatorname* { m a x } _ { y \in \mathbb S ^ { 2 } } C _ { \phi _ { y } ^ { t } } } , } \end{array}
378
+ $$
379
+
380
+ where $C _ { \phi _ { y } ^ { t } }$ is the Lipschitz constant of $x \to \phi ^ { t } ( x , y )$ and the last inequality follows from Proposition 2. Using the assumption $\begin{array} { r } { d ^ { ( n ) } \leq \frac { C } { \sqrt { n } } } \end{array}$ we find
381
+
382
+ $$
383
+ \| L _ { n } ^ { t } f - L ^ { t } f \| _ { \infty } \leq \frac { C } { \sqrt { n } } \operatorname* { m a x } _ { y \in \mathbb { S } ^ { 2 } } C _ { \phi _ { y } ^ { t } }
384
+ $$
385
+
386
+ We now find the explicit dependence between $t$ and $C _ { \phi _ { y } ^ { t } }$
387
+
388
+ $$
389
+ \begin{array} { r l } { C _ { \phi _ { \mathcal { Y } } ^ { t } } = \| \partial _ { x } \phi ^ { t } ( \cdot ; y ) \| _ { \infty } } & { } \\ & { = \| \partial _ { x } \left( K ^ { t } ( \cdot ; y ) f \right) \| _ { \infty } } \\ & { = \| \partial _ { x } K ^ { t } ( \cdot ; y ) f + K ^ { t } ( \cdot ; y ) \partial _ { x } f \| _ { \infty } } \\ & { \leq \| \partial _ { x } K ^ { t } ( \cdot ; y ) f \| _ { \infty } + \| K ^ { t } ( \cdot ; y ) \partial _ { x } f \| _ { \infty } } \\ & { \leq \| \partial _ { x } K ^ { t } ( \cdot ; y ) \| _ { \infty } \| f \| _ { \infty } + \| K ^ { t } ( \cdot ; y ) \| _ { \infty } \| \partial _ { x } f \| _ { \infty } } \\ & { = \| \partial _ { x } K ^ { t } ( \cdot ; y ) \| _ { \infty } \| f \| _ { \infty } + \| \partial _ { x } f \| _ { \infty } } \\ & { = C _ { K _ { y } ^ { t } } \| f \| _ { \infty } + \| \partial _ { x } f \| _ { \infty } } \\ & { = C _ { K _ { x } ^ { t } } \| f \| _ { \infty } + C _ { f } } \end{array}
390
+ $$
391
+
392
+ where $C _ { K _ { y } ^ { t } }$ is the Lipschitz constant of the function $x \to K ^ { t } ( x ; y )$ . We note that this constant does not depend on $y$ :
393
+
394
+ $$
395
+ C _ { K _ { y } ^ { t } } = \left\| \partial _ { x } e ^ { - { \frac { x ^ { 2 } } { 4 t } } } \right\| _ { \infty } = \left\| { \frac { x } { 2 t } } e ^ { - { \frac { x ^ { 2 } } { 4 t } } } \right\| _ { \infty } = \left. { \frac { x } { 2 t } } e ^ { - { \frac { x ^ { 2 } } { 4 t } } } \right| _ { x = { \sqrt { 2 t } } } = ( 2 e t ) ^ { - { \frac { 1 } { 2 } } } \propto t ^ { - { \frac { 1 } { 2 } } } .
396
+ $$
397
+
398
+ Hence we have
399
+
400
+ $$
401
+ \begin{array} { r l r } { { \frac { C } { \sqrt { n } } \operatorname* { m a x } _ { y \in \mathbb { S } ^ { 2 } } C _ { \phi _ { y } ^ { t } } \leq \frac { C } { \sqrt { n } } ( ( 2 e t ) ^ { - \frac { 1 } { 2 } } \| f \| _ { \infty } + C _ { f } ) } } \\ & { } & { \leq \frac { C \| f \| _ { \infty } } { n ^ { \alpha } ( 2 e t ) ^ { 1 / 2 } } + \frac { C } { n ^ { \alpha } } C _ { f } . ~ } \end{array}
402
+ $$
403
+
404
+ Inculding this result in (14) and rescaling by $1 / 4 \pi t ^ { 2 }$ , we obtain
405
+
406
+ $$
407
+ \begin{array} { r l } & { \left\| \frac { 1 } { 4 \pi t ^ { 2 } } \left( L _ { n } ^ { t } f - L ^ { t } f \right) \right\| _ { \infty } \le \frac { 1 } { 4 \pi t ^ { 2 } } \left\| \left( L _ { n } ^ { t } f - L ^ { t } f \right) \right\| _ { \infty } } \\ & { \qquad \le \frac { C } { 4 \pi } \left[ \frac { \| f \| _ { \infty } } { \sqrt { 2 e } } \frac { 1 } { n ^ { \alpha } t ^ { 5 / 2 } } + \frac { C _ { f } } { n ^ { \alpha } t ^ { 2 } } \right] . } \end{array}
408
+ $$
409
+
410
+ In order for ${ \frac { C } { 4 \pi } } \left[ { \frac { \lVert f \rVert _ { \infty } } { \sqrt { 2 e } } } { \frac { 1 } { n ^ { \alpha } t ^ { 5 / 2 } } } + { \frac { C _ { f } } { n ^ { \alpha } t ^ { 2 } } } \right] { \frac { n \to \infty } { t \to 0 } } \ 0$ n→∞ −−−−→ 0, we need $\begin{array} { r } { \{ { n ^ { \alpha } t ^ { 5 / 2 } \infty } } \\ { { n ^ { \alpha } t ^ { 2 } \infty } } \end{array}$
411
+ It happens if $\begin{array}{c} \begin{array} { r } { \left\{ { \begin{array} { l l } { t ( n ) = n ^ { \beta } , } & { \beta \in ( - \frac { 2 \alpha } { 5 } , 0 ) } \\ { t ( n ) = n ^ { \beta } , } & { \beta \in ( - \frac { \alpha } { 2 } , 0 ) } \end{array} } \Longrightarrow t ( n ) = n ^ { \beta } , \quad \beta \in ( - \frac { 2 \alpha } { 5 } , 0 ) . \right.} \end{array} \end{array}$
412
+ Indeed, we have
413
+ $n ^ { a } l p h a t ^ { 5 / 2 } = n ^ { 5 / 2 \beta + \alpha } ~ \xrightarrow { n \infty } ~ \infty$ se $\textstyle { \frac { 5 } { 2 } } \beta + \alpha > 0 \iff \beta > - { \frac { 2 \alpha } { 5 } }$
414
+ $n ^ { \alpha } t ^ { 2 } = n ^ { 2 \beta + \alpha } \xrightarrow { n \infty } \infty$ $2 \beta + \alpha > 0 \iff \beta > - { \frac { \alpha } { 2 } }$
415
+ As a result, for $t = n ^ { \beta }$ with $\beta \in ( - \frac { 1 } { 5 } , 0 )$ we have $\left\{ \left. \left. \frac { n \to \infty } { 4 \pi t _ { n } ^ { 2 } } L _ { n } ^ { t _ { n } } f - \frac { 1 } { 4 \pi t _ { n } ^ { 2 } } L ^ { t _ { n } } f \right. \right. _ { \infty } \xrightarrow [ ] { n \to \infty } 0 , \right.$ which concludes the proof.
416
+
417
+ Theorem 3.1, is then an immediate consequence of Proposition 3 and 1.
418
+
419
+ Proof of Theorem 3.1. Thanks to Proposition 3 and Proposition 1 we conclude that $\forall y \in \mathbb { S } ^ { 2 }$
420
+
421
+ $$
422
+ \operatorname * { l i m } _ { n \to \infty } \frac { 1 } { 4 \pi t _ { n } ^ { 2 } } L _ { n } ^ { t _ { n } } f ( y ) = \operatorname * { l i m } _ { n \to \infty } \frac { 1 } { 4 \pi t _ { n } ^ { 2 } } L ^ { t _ { n } } f ( y ) = \frac { 1 } { | \mathbb { S } ^ { 2 } | } \Delta _ { \mathbb { S } ^ { 2 } } f ( y )
423
+ $$
424
+
425
+ In (Belkin & Niyogi, 2008), the sampling is drawn from a uniform random distribution on the sphere, and their proof heavily relies on the uniformity properties of the distribution from which the sampling is drawn. In our case the sampling is deterministic, and this is indeed a problem that we need to overcome by imposing the regularity conditions above.
426
+
427
+ micro (label average)
428
+ macro (instance average)
429
+ Table 5: Official metrics from the SHREC’17 object retrieval competition.
430
+
431
+ <table><tr><td></td><td>P@N</td><td>R@N</td><td>F1@N</td><td>mAP</td><td>P@N</td><td>R@N</td><td>F1@N</td><td>mAP</td></tr><tr><td>Cohen et al.(2018)(b= 128)</td><td>0.701</td><td>0.711</td><td>0.699</td><td>0.676</td><td>-</td><td>-</td><td>-</td><td>1</td></tr><tr><td>Cohen et al.(2018) (simplified,b = 64)</td><td>0.704</td><td>0.701</td><td>0.696</td><td>0.665</td><td>0.430</td><td>0.480</td><td>0.429</td><td>0.385</td></tr><tr><td>Esteves et al.(2018)(b = 64)</td><td>0.717</td><td>0.737</td><td>-</td><td>0.685</td><td>0.450</td><td>0.550</td><td>-</td><td>0.444</td></tr><tr><td>DeepSphere (equiangular b = 64)</td><td>0.709</td><td>0.700</td><td>0.698</td><td>0.665</td><td>0.439</td><td>0.489</td><td>0.439</td><td>0.403</td></tr><tr><td>DeepSphere (HEALPix Nside = 32)</td><td>0.725</td><td>0.717</td><td>0.715</td><td>0.686</td><td>0.475</td><td>0.508</td><td>0.468</td><td>0.428</td></tr></table>
432
+
433
+ To conclude, we see that the result obtained is of similar form than the result obtained in (Belkin & Niyogi, 2008). Given the kernel density $t ( n ) = n ^ { \beta }$ , Belkin & Niyogi (2008) proved convergence in the random case for $\beta \in ( - \frac { 1 } { 4 } , 0 )$ and we proved convergence in the deterministic case for $\beta \in$ $\textstyle ( - { \frac { 2 \alpha } { 5 } } , 0 )$ , where $\alpha \in ( 0 , 1 / 2 ]$ (for the spherical manifold).
434
+
435
+ # B PROOF OF THEOREM 3.2
436
+
437
+ Proof. Fix $x \in \mathbb { S } ^ { 2 }$ . Since any rotation $R ( g )$ is an isometry, and the Laplacian $\Delta$ commutes with all isometries of a Riemanniann manifold, and defining $R ( g ) \dot { f } = : f ^ { \prime }$ for ease of notation, we can write that
438
+
439
+ $$
440
+ \begin{array} { r l } { { R ( g ) \hat { L } _ { n } ^ { t _ { n } } f ( x ) - \hat { L } _ { n } ^ { t _ { n } } R ( g ) f ( x ) \Big | \leq \Big | R ( g ) \hat { L } _ { n } ^ { t _ { n } } f ( x ) - R ( g ) \Delta _ { \mathbb { S } ^ { 2 } } f ( x ) \Big | + \Big | R ( g ) \Delta _ { \mathbb { S } ^ { 2 } } f ( x ) - \hat { L } _ { n } ^ { t _ { n } } R ( g ) f ( x ) \Big | } } \\ & { = \Big | R ( g ) ( \hat { L } _ { n } ^ { t _ { n } } f - \Delta _ { \mathbb { S } ^ { 2 } } f ) ( x ) \Big | + \Big | \Delta _ { \mathbb { S } ^ { 2 } } f ^ { \prime } ( x ) - \hat { L } _ { n } ^ { t _ { n } } f ^ { \prime } ( x ) \Big | \leq } \\ & { \leq \Big | ( \hat { L } _ { n } ^ { t _ { n } } f - \Delta _ { \mathbb { S } ^ { 2 } } f ) ( g ^ { - 1 } ( x ) ) \Big | + \Big | \Delta _ { \mathbb { S } ^ { 2 } } f ^ { \prime } ( x ) - \hat { L } _ { n } ^ { t _ { n } } f ^ { \prime } ( x ) \Big | } \end{array}
441
+ $$
442
+
443
+ Since $g ^ { - 1 } ( x ) \in \mathbb { S } ^ { 2 }$ and $f ^ { \prime }$ still satisfies hypothesis, we can apply theorem 3.1 to say that
444
+
445
+ $$
446
+ \begin{array} { r l } & { \left| ( \hat { L } _ { n } ^ { t _ { n } } f - \Delta _ { \mathbb { S } ^ { 2 } } f ) ( g ^ { - 1 } ( x ) ) \right| \xrightarrow { n \to \infty } 0 } \\ & { \left| \Delta _ { \mathbb { S } ^ { 2 } } f ^ { \prime } ( x ) - \hat { L } _ { n } ^ { t _ { n } } f ^ { \prime } ( x ) \right| \xrightarrow { n \to \infty } 0 } \end{array}
447
+ $$
448
+
449
+ to conclude that
450
+
451
+ $$
452
+ \begin{array} { r l } { \forall x \in \mathbb { S } ^ { 2 } } & { { } \left| R ( g ) \hat { L } _ { n } ^ { t _ { n } } f ( x ) - \hat { L } _ { n } ^ { t _ { n } } R ( g ) f ( x ) \right| \xrightarrow { n \to \infty } 0 } \end{array}
453
+ $$
454
+
455
+ # C EXPERIMENTAL DETAILS
456
+
457
+ # C.1 3D OBJECTS RECOGNITION
458
+
459
+ Table 5 shows the results obtained from the SHREC’17 competition’s official evaluation script.
460
+
461
+ $$
462
+ \begin{array} { r l } { [ G C _ { 1 6 } + B N + R e L U ] _ { n s i d e 3 2 } + \mathrm { P o o l } + [ G C _ { 3 2 } + B N + R e L U ] _ { n s i d e 1 6 } + \mathrm { P o o l } ~ } & { } \\ { + \left[ G C _ { 6 4 } + B N + R e L U \right] _ { n s i d e 8 } + \mathrm { P o o l } + [ G C _ { 1 2 8 } + B N + R e L U ] _ { n s i d e 4 } } \\ { + \mathrm { P o o l } + [ G C _ { 2 5 6 } + B N + R e L U ] _ { n s i d e 2 } + \mathrm { P o o l } + G A P + F C N + \mathrm { s o f } \mathrm { t m } a } \end{array}
463
+ $$
464
+
465
+ # C.2 COSMOLOGICAL MODEL CLASSIFICATION
466
+
467
+ $$
468
+ \begin{array} { r l } & { [ G C _ { 1 6 } + B N + R e L U ] _ { n s i d e 1 0 2 4 } + \mathsf { P o o l } + [ G C _ { 3 2 } + B N + R e L U ] _ { n s i d e 5 1 2 } } \\ & { ~ + ~ \mathsf { P o o l } + [ G C _ { 6 4 } + B N + R e L U ] _ { n s i d e 2 5 6 } + \mathsf { P o o l } } \\ & { ~ + ~ [ G C _ { 6 4 } + B N + R e L U ] _ { n s i d e 1 2 8 } + \mathsf { P o o l } + [ G C _ { 6 4 } + B N + R e L U ] _ { n s i d e 6 4 } } \\ & { ~ + ~ \mathsf { P o o l } + [ G C _ { 2 } ] _ { n s i d e 3 2 } + G A P + \mathrm { s o f t m a x } } \end{array}
469
+ $$
470
+
471
+ Table 6: Results on climate event segmentation: accuracy. Tropical cyclones (TC) and atmospheric rivers (AR) are the two positive classes, against the background (BG). Mudigonda et al. (2017) is not directly comparable as they don’t use the same input feature maps. Note that a non-weighted cross-entropy loss is not optimal for the accuracy metric.
472
+
473
+ <table><tr><td></td><td>TC</td><td>AR</td><td>BG</td><td>mean</td></tr><tr><td>Mudigonda et al. (2017)</td><td>74</td><td>65</td><td>97</td><td>78.67</td></tr><tr><td>Jiang et al. (2019) (paper)</td><td>94</td><td>93</td><td>97</td><td>94.67</td></tr><tr><td>Jiang et al. (2019) (rerun)</td><td>93.9</td><td>95.7</td><td>95.2</td><td>94.95</td></tr><tr><td>Cohen et al. (2019) (S2R)</td><td>97.8</td><td>97.3</td><td>97.3</td><td>97.5</td></tr><tr><td>Cohen et al. (2019) (R2R)</td><td>97.9</td><td>97.8</td><td>97.4</td><td>97.7</td></tr><tr><td>DS (Jiang architecture, weighted loss)</td><td>97.1</td><td>97.6</td><td>96.5</td><td>97.1</td></tr><tr><td>DS (weighted loss)</td><td>97.4 ± 1.1</td><td>97.7± 0.7</td><td>98.2 ± 0.5</td><td>97.8 ± 0.3</td></tr><tr><td>DS (wider architecture, weighted loss)</td><td>91.5</td><td>93.4</td><td>99.0</td><td>94.6</td></tr><tr><td>DS (Jiang architecture, non-weighted loss)</td><td>33.6</td><td>93.6</td><td>99.3</td><td>75.5</td></tr><tr><td>DS (non-weighted loss)</td><td>69.2 ± 3.7</td><td>94.5 ± 2.9</td><td>99.7± 0.1</td><td>87.8 ± 0.5</td></tr><tr><td>DS (wider architecture, non-weighted loss)</td><td>73.4</td><td>92.7</td><td>99.8</td><td>88.7</td></tr></table>
474
+
475
+ Table 7: Results on climate event segmentation: average precision. Tropical cyclones (TC) and atmospheric rivers (AR) are the two positive classes. Note that a weighted cross-entropy loss is not optimal for the average precision metric.
476
+
477
+ <table><tr><td></td><td>TC</td><td>AR</td><td>mean</td></tr><tr><td>Jiang et al. (2019) (rerun)</td><td>11.08</td><td>65.21</td><td>38.41</td></tr><tr><td>Cohen et al. (2019) (S2R) Cohen et al. (2019) (R2R)</td><td>- 1</td><td>1 1</td><td>68.6 75.9</td></tr><tr><td>DS (Jiang architecture, non-weighted loss)</td><td>46.2</td><td>93.9</td><td>70.0</td></tr><tr><td>DS (non-weighted loss)</td><td>80.86 ± 2.42</td><td>97.45 ± 0.38</td><td>89.16 ± 1.37</td></tr><tr><td>DS (wider architecture, non-weighted loss)</td><td>84.71</td><td>98.05</td><td>91.38</td></tr><tr><td>DS (Jiang architecture, weighted loss)</td><td>49.7</td><td>89.2</td><td>69.5</td></tr><tr><td>DS (weighted loss)</td><td>58.88 ± 3.17</td><td>95.41 ± 1.51</td><td>77.15 ± 1.94</td></tr><tr><td>DS (wider architecture,weighted loss)</td><td>52.80</td><td>94.78</td><td>73.79</td></tr></table>
478
+
479
+ Table 6, 7, and 8 show the accuracy, mAP, and efficiency of all the NNs we ran.
480
+
481
+ The experiment with the model from Jiang et al. (2019) was rerun in order to obtain the AP metrics, but with a batch size of 64 instead of 256 due to GPU memory limit.
482
+
483
+ Several experiments were run with different architectures for DeepSphere (DS). Jiang architecture use a similar one as Jiang et al. (2019), with only the convolutional operators replaced. DeepSphere only is the original architecture giving the best results, deeper and with four times more feature maps than Jiang architecture. And the wider architecture is the same as the previous one with two times the number of feature maps.
484
+
485
+ Regarding the weighted loss, the weights are chosen with scikit-learn function compute class weight on the training set.
486
+
487
+ Table 8: Results on climate event segmentation: size and speed.
488
+
489
+ <table><tr><td rowspan="2"></td><td>size</td><td colspan="2">speed</td></tr><tr><td>params</td><td>inference</td><td>training</td></tr><tr><td>Jiang et al. (2019)</td><td>330k</td><td>10ms</td><td>10h</td></tr><tr><td>DeepSphere (Jiang architecture)</td><td>590k</td><td>5ms</td><td>3h</td></tr><tr><td>DeepSphere</td><td>13M</td><td>33 ms</td><td>13h</td></tr><tr><td>DeepSphere (wider architecture)</td><td>52M</td><td>50ms</td><td>20h</td></tr></table>
490
+
491
+ DeepSphere with Jiang architecture
492
+
493
+ encoder:
494
+
495
+ $$
496
+ \begin{array} { r l } & { [ G C _ { 8 } + B N + R e L U ] _ { L 5 } + \mathrm { P o o l } + [ G C _ { 1 6 } + B N + R e L U ] _ { L 4 } + \mathrm { P o o l } } \\ & { ~ + ~ [ G C _ { 3 2 } + B N + R e L U ] _ { L 3 } + \mathrm { P o o l } + [ G C _ { 6 4 } + B N + R e L U ] _ { L 2 } + \mathrm { P o o l } } \\ & { ~ + ~ [ G C _ { 1 2 8 } + B N + R e L U ] _ { L 1 } + \mathrm { P o o l } + [ G C _ { 1 2 8 } + B N + R e L U ] _ { L 0 } } \end{array}
497
+ $$
498
+
499
+ decoder:
500
+
501
+ $$
502
+ \begin{array} { r l } & { { \mathrm { U n p o o l } } + [ G C _ { 1 2 8 } + B N + R e L U ] _ { L 1 } + \mathrm { c o n c a t } + [ G C _ { 1 2 8 } + B N + R e L U ] _ { L 1 } } \\ & { ~ + ~ \mathrm { U n p o o l } + [ G C _ { 6 4 } + B N + R e L U ] _ { L 2 } + \mathrm { c o n c a t } } \\ & { ~ + ~ [ G C _ { 6 4 } + B N + R e L U ] _ { L 2 } + \mathrm { U n p o o l } + [ G C _ { 3 2 } + B N + R e L U ] _ { L 3 } } \\ & { ~ + ~ \mathrm { c o n c a t } + [ G C _ { 3 2 } + B N + R e L U ] _ { L 3 } + \mathrm { U n p o o l } } \\ & { ~ + [ G C _ { 1 6 } + B N + R e L U ] _ { L 4 } + \mathrm { c o n c a t } + [ G C _ { 1 6 } + B N + R e L U ] _ { L 4 } + \mathrm { U n p o o l } } \\ & { ~ + [ G C _ { 8 } + B N + R e L U ] _ { L 5 } + \mathrm { c o n c a t } + [ G C _ { 8 } + B N + R e L U ] _ { L 5 } + [ G C _ { 3 } ] _ { L 5 } } \end{array}
503
+ $$
504
+
505
+ Concat is the operation that concatenate the results of the corresponding encoder layer.
506
+
507
+ Original DeepSphere architecture with encoder decoder encoder:
508
+
509
+ $$
510
+ \begin{array} { r l } & { [ G C _ { 3 2 } + B N + R e L U ] _ { L 5 } + [ G C _ { 6 4 } + B N + R e L U ] _ { L 5 } } \\ & { ~ + ~ \mathsf { P o o l } + [ G C _ { 1 2 8 } + B N + R e L U ] _ { L 4 } + \mathsf { P o o l } } \\ & { ~ + ~ [ G C _ { 2 5 6 } + B N + R e L U ] _ { L 3 } + \mathsf { P o o l } + [ G C _ { 5 1 2 } + B N + R e L U ] _ { L 2 } } \\ & { ~ + ~ \mathsf { P o o l } + [ G C _ { 5 1 2 } + B N + R e L U ] _ { L 1 } + \mathsf { P o o l } + [ G C _ { 5 1 2 } ] _ { L 0 } } \end{array}
511
+ $$
512
+
513
+ decoder:
514
+
515
+ $$
516
+ \begin{array} { r l } & { \mathrm { U n p o o l } + [ G C _ { 5 1 2 } + B N + R e L U ] _ { L 1 } + \mathrm { c o n c a t } + [ G C _ { 5 1 2 } + B N + R e L U ] _ { L 1 } } \\ & { ~ + \mathrm { U n p o o l } + [ G C _ { 2 5 6 } + B N + R e L U ] _ { L 2 } + \mathrm { c o n c a t } } \\ & { ~ + [ G C _ { 2 5 6 } + B N + R e L U ] _ { L 2 } + \mathrm { U n p o o l } + [ G C _ { 1 2 8 } + B N + R e L U ] _ { L 3 } } \\ & { ~ + \mathrm { c o n c a t } + [ G C _ { 1 2 8 } + B N + R e L U ] _ { L 3 } + \mathrm { U n p o o l } } \\ & { ~ + [ G C _ { 6 4 } + B N + R e L U ] _ { L 4 } + \mathrm { c o n c a t } + [ G C _ { 6 4 } + B N + R e L U ] _ { L 4 } } \\ & { ~ + \mathrm { U n p o o l } + [ G C _ { 3 2 } + B N + R e L U ] _ { L 5 } + [ G C _ { 3 } ] _ { L 5 } } \end{array}
517
+ $$
518
+
519
+ # C.4 UNEVEN SAMPLING
520
+
521
+ Architecture for dense regression:
522
+
523
+ $$
524
+ [ G C _ { 5 0 } + B N + R e L U ] + [ G C _ { 1 0 0 } + B N + R e L U ] + [ G C _ { 1 0 0 } + B N + R e L U ] + [ G C _ { 1 } ]
525
+ $$
526
+
527
+ Architecture for global regression:
528
+
529
+ $$
530
+ \begin{array} { r l } { { } } & { { [ G C _ { 5 0 } + B N + R e L U ] + [ G C _ { 1 0 0 } + B N + R e L U ] } } \\ { { } } & { { ~ + ~ [ G C _ { 1 0 0 } + B N + R e L U ] + G A P + F C N } } \end{array}
531
+ $$
md/train/B1lfHhR9tm/B1lfHhR9tm.md ADDED
@@ -0,0 +1,630 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # THE NATURAL LANGUAGE DECATHLON: MULTITASK LEARNING AS QUESTION ANSWERING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Deep learning has improved performance on many natural language processing (NLP) tasks individually. However, general NLP models cannot emerge within a paradigm that focuses on the particularities of a single metric, dataset, and task. We introduce the Natural Language Decathlon (decaNLP), a challenge that spans ten tasks: question answering, machine translation, summarization, natural language inference, sentiment analysis, semantic role labeling, relation extraction, goal-oriented dialogue, semantic parsing, and commonsense pronoun resolution. We cast all tasks as question answering over a context. Furthermore, we present a new multitask question answering network (MQAN) that jointly learns all tasks in decaNLP without any task-specific modules or parameters more effectively than sequence-to-sequence and reading comprehension baselines. MQAN shows improvements in transfer learning for machine translation and named entity recognition, domain adaptation for sentiment analysis and natural language inference, and zero-shot capabilities for text classification. We demonstrate that the MQAN’s multi-pointer-generator decoder is key to this success and that performance further improves with an anti-curriculum training strategy. Though designed for decaNLP, MQAN also achieves state of the art results on the WikiSQL semantic parsing task in the single-task setting. We also release code for procuring and processing data, training and evaluating models, and reproducing all experiments for decaNLP.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ We introduce the Natural Language Decathlon (decaNLP) in order to explore models that generalize to many different kinds of NLP tasks. decaNLP encourages a single model to simultaneously optimize for ten tasks: question answering, machine translation, document summarization, semantic parsing, sentiment analysis, natural language inference, semantic role labeling, relation extraction, goal oriented dialogue, and pronoun resolution.
12
+
13
+ We frame all tasks as question answering (Kumar et al., 2016) with a context, question, and answer (Fig. 1). Traditionally, NLP examples have inputs $x$ and outputs $y$ , and the underlying task $t$ is provided through explicit modeling constraints. Meta-learning approaches include $t$ as additional input (Schmidhuber, 1987; Thrun and Pratt, 1998; Thrun, 1998; Vilalta and Drissi, 2002). Our approach does not use a single representation for any $t$ , but instead uses the combination of natural language questions and contexts to orient the model to the correct task. This allows single models to effectively multitask, makes them more suitable as pretrained models, allows a model to generalize to completely new tasks through different but related contexts and questions.
14
+
15
+ We provide a set of baselines for decaNLP that combine the basics of sequence-to-sequence learning (Sutskever et al., 2014; Bahdanau et al., 2014; Luong et al., 2015b) with pointer networks (Vinyals et al., 2015; Merity et al., 2017; Gülçehre et al., 2016; Gu et al., 2016; Nallapati et al., 2016), advanced attention mechanisms (Xiong et al., 2017), attention networks (Vaswani et al., 2017), question answering (Seo et al., 2017; Xiong et al., 2018; Yu et al., 2016; Weissenborn et al., 2017), and curriculum learning (Bengio et al., 2009).
16
+
17
+ The multitask question answering network (MQAN) is designed for decaNLP and makes use of a novel dual coattention and multi-pointer-generator decoder to multitask across all tasks in decaNLP. Our results demonstrate that training the MQAN jointly on all tasks with the right anti-curriculum
18
+
19
+ ![](images/17b595e21b2540abb7e672428b1eb0aaf71904c5eb5f5c2eec52af210bf18bcc.jpg)
20
+
21
+ Figure 1: Overview of the decaNLP dataset with one example from each decaNLP task in the order presented in Section 2. Each task is framed as a form of question answering. Answer words in red are generated by pointing to the context, in green from the question, and in blue if they are generated from a classifier over the full output vocabulary.
22
+
23
+ strategy can achieve performance comparable to that of ten separate MQANs, each trained separately. A MQAN pretrained on decaNLP shows improvements in transfer learning for machine translation and named entity recognition, domain adaptation for sentiment analysis and natural language inference, and zero-shot capabilities for text classification. Though not explicitly designed for any one task, MQAN proves to be a strong model in the single-task setting as well, achieving state-of-the-art results on the semantic parsing component of decaNLP.
24
+
25
+ We have released all code1 used for this project as well as a leaderboard2 based on decathlon scores (decaScore). We hope that the combination of these resources will facilitate research in multitask learning, transfer learning, general embeddings and encoders, architecture search, zero-shot learning, general purpose question answering, meta-learning, and other related areas of NLP.
26
+
27
+ # 2 TASKS AND METRICS
28
+
29
+ decaNLP consists of 10 publicly available datasets with examples cast as (question, context, answer) triplets as shown in Fig. 1. For a detailed discussion of why these ten tasks were chosen over others, please refer to Appendix A.
30
+
31
+ Question Answering. Question answering (QA) models receive a question and a context that contains information necessary to output the desired answer. We use the Stanford Question Answering Dataset (SQuAD) (Rajpurkar et al., 2016) for this task. Contexts are paragraphs taken from the English Wikipedia, and answers are sequences of words copied from the context. SQuAD uses a normalized F1 (nF1) metric that strips out articles and punctuation.
32
+
33
+ Machine Translation. Machine translation models receive an input document in a source language that must be translated into a target language. We use the 2016 English to German training data prepared for the International Workshop on Spoken Language Translation (IWSLT) (Cettolo et al., 2016). We evaluate with a corpus-level BLEU score (Papineni et al., 2002) on the 2013 and 2014 test sets as validation and test sets, respectively.
34
+
35
+ Summarization. Summarization models take in a document and output a summary of that document. We used the transformed, non-anonymized version of the CNN/DailyMail (CNN/DM) corpus (Hermann et al., 2015) by dataset (Nallapati et al., 2016). We average ROUGE-1, ROUGE-2, and ROUGE-L scores (Lin, 2004) to compute an overall ROUGE score.
36
+
37
+ Natural Language Inference. Natural Language Inference (NLI) models receive two input sentences: a premise and a hypothesis. Models must then classify the inference relationship between the two as one of entailment, neutrality, or contradiction. We use the Multi-Genre Natural Language Inference Corpus (MNLI) (Williams et al., 2017) which provides training examples from multiple domains (transcribed speech, popular fiction, government reports) and test pairs from seen and unseen domains. MNLI uses an exact match (EM) score.
38
+
39
+ Table 1: Summary of openly available benchmark datasets in decaNLP and evaluation metrics that contribute to the decaScore. All metrics are case insensitive. nF1 is a normalized F1 metric that strips out articles and punctuation. EM is an exact match comparison: for text classification, this amounts to accuracy; for WOZ it is equivalent to turn-based dialogue state exact match (dsEM) and for WikiSQL it is equivalent to exact match of logical forms (lfEM). F1 for QA-ZRE is a corpus level metric (cF1) that takes into account that some questions are unanswerable.
40
+
41
+ <table><tr><td>Task</td><td>Dataset</td><td>#Train</td><td>#Dev</td><td>#Test</td><td>Metric</td></tr><tr><td>Question Answering</td><td>SQuAD</td><td>87599</td><td>10570</td><td>9616</td><td>nF1</td></tr><tr><td>Machine Translation</td><td>IWSLT</td><td>196884</td><td>993</td><td>1305</td><td>BLEU</td></tr><tr><td>Summarization</td><td>CNN/DM</td><td>287227</td><td>13368</td><td>11490</td><td>ROUGE</td></tr><tr><td>Natural Language Inference</td><td>MNLI</td><td>392702</td><td>20000</td><td>20000</td><td>EM</td></tr><tr><td>Sentiment Analysis</td><td>SST</td><td>6920</td><td>872</td><td>1821</td><td>EM</td></tr><tr><td>Semantic Role Labeling</td><td>QA-SRL</td><td>6414</td><td>2183</td><td>2201</td><td>nF1</td></tr><tr><td>Zero-Shot Relation Extraction</td><td>QA-ZRE</td><td>840000</td><td>600</td><td>12000</td><td>cF1</td></tr><tr><td>Goal-Oriented Dialogue</td><td>WOZ</td><td>2536</td><td>830</td><td>1646</td><td>dsEM</td></tr><tr><td>Semantic Parsing</td><td>WikiSQL</td><td>56355</td><td>8421</td><td>15878</td><td>1fEM</td></tr><tr><td>Pronoun Resolution</td><td>MWSC</td><td>80</td><td>82</td><td>100</td><td>EM</td></tr></table>
42
+
43
+ Sentiment Analysis. Sentiment analysis models are trained to classify the sentiment expressed by input text. The Stanford Sentiment Treebank (SST) (Socher et al., 2013) consists of movie reviews with the corresponding sentiment (positive, neutral, negative). We use the unparsed, binary version (Radford et al., 2017). SST also uses an EM score.
44
+
45
+ Semantic Role Labeling. Semantic role labeling (SRL) models are given a sentence and predicate (typically a verb) and must determine ‘who did what to whom,’ ‘when,’ and ‘where’ (Johansson and Nugues, 2008). We use an SRL dataset that treats the task as question answering, QA-SRL (He et al., 2015). This dataset covers both news and Wikipedia domains, but we only use the latter in order to ensure that all data for decaNLP can be freely downloaded. We evaluate QA-SRL with the nF1 metric used for SQuAD.
46
+
47
+ Relation Extraction. Relation extraction systems take in a piece of unstructured text and the kind of relation that is to be extracted from that text. As with SRL, we use a dataset that maps relations to a set of questions so that relation extraction can be treated as question answering: QA-ZRE (Levy et al., 2017). Evaluation of the dataset is designed to measure zero shot performance on new kinds of relations – the dataset is split so that relations seen at test time are unseen at train time. This kind of zero-shot relation extraction, framed as question answering, makes it possible to generalize to new relations. QA-ZRE uses a corpus-level F1 metric (cF1) in order to accurately account for when relations are not present, in which case the question is unanswerable.
48
+
49
+ Goal-Oriented Dialogue. Dialogue state tracking is a key component of goal-oriented dialogue systems. Based on user utterances and actions taken, dialogue state trackers keep track of which user goals and requests as the system and user interact turn-by-turn. We use the English Wizard of $\mathrm { O z }$ (WOZ) restaurant reservation task (Wen et al., 2016), which comes with a predefined ontology of foods, dates, times, addresses, and other information that would help an agent make a reservation for a customer. WOZ is evaluated by turn-based dialogue state EM (dsEM) over the goals of the customers.
50
+
51
+ Semantic Parsing. SQL query generation is related to semantic parsing. Models based on the WikiSQL dataset (Zhong et al., 2017) translate natural language questions into structured SQL queries so that users can interact with a database in natural language. WikiSQL is evaluated by a logical form exact match (lfEM) to ensure that models do not obtain correct answers from incorrectly generated queries.
52
+
53
+ Pronoun Resolution. Our final task is based on Winograd schemas (Winograd, 1972), which require pronoun resolution: "Joan made sure to thank Susan for the help she had [given/received]. Who had [given/received] help? Susan or Joan?". We started with examples taken from the Winograd Schema Challenge (Levesque et al., 2011) and modified them to ensure that answers were a single word from the context. This modified Winograd Schema Challenge (MWSC) ensures that scores are neither inflated nor deflated by oddities in phrasing or inconsistencies between context, question, and answer. We evaluate with an EM score.
54
+
55
+ ![](images/1abdf48092443aa30a848a34a7ea4ff07383c48580893f85208768548c06d81f.jpg)
56
+ Figure 2: Overview of the MQAN model. It takes in a question and context document, encodes both with a BiLSTM, uses dual coattention to condition representations for both sequences on the other, compresses all of this information with another two BiLSTMs, applies self-attention to collect long-distance dependency, and then uses a final two BiLSTMs to get representations of the question and context. The multi-pointer-generator decoder uses attention over the question, context, and previously output tokens to decide whether to copy from the question, copy from the context, or generate from a limited vocabulary.
57
+
58
+ The Decathlon Score (decaScore). Models competing on decaNLP are evaluated using an additive combination of each task-specific metric. All metrics fall between 0 and 100, so that the decaScore naturally falls between 0 and 1000 for ten tasks. Using an additive combination avoids issues that arise from weighing different metrics. All metrics are case insensitive.
59
+
60
+ # 3 MULTITASK QUESTION ANSWERING NETWORK (MQAN)
61
+
62
+ Because every task is framed as question answering and trained jointly, we call our model a multitask question answering network (MQAN). Each example consists of a context, question, and answer as shown in Fig. 1. Many recent QA models for question answering typically assume the answer can be copied from the context (Wang and Jiang, 2017; Seo et al., 2017; Xiong et al., 2018), but this assumption does not hold for general question answering. The question often contains key information that constrains the answer space. Noting this, we extend the coattention of (Xiong et al., 2017) to enrich the representation of not only the input but also the question. Also, the pointer-mechanism of (See et al., 2017) is generalized into a hierarchical, multi-pointer-generator that enables the capacity to copy directly from the question and the context.
63
+
64
+ During training, the MQAN takes as input three sequences: a context $c$ with $l$ tokens, a question $q$ with $m$ tokens, and an answer $a$ with $n$ tokens. Each of these is represented by a matrix where the ith row of the matrix corresponds to a $d _ { e m b }$ -dimensional embedding (such as word or character vectors) for the $i$ th token in the sequence:
65
+
66
+ $$
67
+ C \in \mathbb { R } ^ { l \times d _ { e m b } } \qquad Q \in \mathbb { R } ^ { m \times d _ { e m b } } \qquad A \in \mathbb { R } ^ { n \times d _ { e m b } }
68
+ $$
69
+
70
+ An encoder takes these matrices as input and uses a deep stack of recurrent, coattentive, and selfattentive layers to produce final representations, $C _ { f i n } \in \mathbf { \bar { \mathbb { R } } } ^ { l \times d }$ and $Q _ { f i n } \in \mathbb { R } ^ { m \times d }$ , of both context and question sequences designed to capture local and global interdependencies. Appendix $\mathrm { E }$ describes the full details of the encoder.
71
+
72
+ Answer Representations. During training, the decoder begins by projecting the answer embeddings onto a $d$ -dimensional space:
73
+
74
+ $$
75
+ A W _ { 2 } = A _ { p r o j } \in \mathbb { R } ^ { n \times d }
76
+ $$
77
+
78
+ This is followed by a self-attentive layers, which has a corresponding self-attentive layer in the encoder. Because it lacks both recurrence and convolution, we add to $A _ { p r o j }$ positional encodings (Vaswani et al., 2017) $P E \in \mathbb { R } ^ { n \times d }$ with entries
79
+
80
+ $$
81
+ P E [ t , k ] = \left\{ \begin{array} { l l } { \sin ( t / 1 0 0 0 0 ^ { k / 2 d } ) } & { k \mathrm { ~ i s ~ e v e n } } \\ { \cos ( t / 1 0 0 0 0 ^ { ( k - 1 ) / 2 d } ) } & { k \mathrm { ~ i s ~ o d d } } \end{array} \right. \quad \quad A _ { p r o j } + P E = A _ { p p r } \in \mathbb { R } ^ { n \times d } .
82
+ $$
83
+
84
+ Multi-head Decoder Attention. We use self-attention3 (Vaswani et al., 2017) so that the decoder is aware of previous outputs (or a special intialization token in the case of no previous outputs) and attention over the context to prepare for the next output. Refer to Appendix $\mathrm { E }$ for definitions of MultiHead attention and FFN, the residual feedforward network applied after MultiHead attention over the context.
85
+
86
+ $$
87
+ \mathrm { M u l t i H e a d } _ { A } ( A _ { p p r } , A _ { p p r } , A _ { p p r } ) = A _ { m h a } \in \mathbb { R } ^ { n \times d }
88
+ $$
89
+
90
+ $$
91
+ \mathrm { M u l t i H e a d } _ { A C } \ l ( ( A _ { m h a } + A _ { p p r } ) , C _ { f i n } , C _ { f i n } \ l ) = A _ { a c } \in \mathbb { R } ^ { n \times d }
92
+ $$
93
+
94
+ $$
95
+ F F N _ { A } ( A _ { a c } + A _ { m h a } + A _ { p p r } ) = A _ { s e l f } \in \mathbb { R } ^ { n \times d }
96
+ $$
97
+
98
+ Intermediate Decoder State. We next use a standard LSTM with attention to get a recurrent context state word $\tilde { c } _ { t }$ time-step and recu $t$ . First, the LSTM produces an intermediate state ent context state (Luong et al., 2015b): $h _ { t }$ using the previous answer $A _ { s e l f } ^ { t - 1 }$
99
+
100
+ $$
101
+ \mathbf { L S T M } ( [ \left( A _ { s e l f } \right) _ { t - 1 } ; \tilde { c } _ { t - 1 } ] , h _ { t - 1 } ) = h _ { t } \in \mathbb { R } ^ { d }
102
+ $$
103
+
104
+ Context and Question Attention. This intermediate state is used to get attention weights $\alpha _ { t } ^ { C }$ and α Qt to allow the decoder to focus on encoded information relevant to time step $t$ .
105
+
106
+ $$
107
+ \mathrm { s o f t m a x } C _ { f i n } ( W _ { 2 } h _ { t } ) = \alpha _ { t } ^ { C } \in \mathbb { R } ^ { l } \qquad \mathrm { s o f t m a x } Q _ { f i n } ( W _ { 3 } h _ { t } ) = \alpha _ { t } ^ { Q } \in \mathbb { R } ^ { m }
108
+ $$
109
+
110
+ Recurrent Context State. Context representations are combined with these weights and fed through a feedforward network with tanh activation to form the recurrent context state and question state:
111
+
112
+ $$
113
+ \operatorname { t a n h } \left( W _ { 4 } \left[ C _ { f i n } ^ { \top } \alpha _ { t } ^ { C } ; h _ { t } \right] \right) = \tilde { c } _ { t } \in \mathbb { R } ^ { d } \qquad \operatorname { t a n h } \left( W _ { 5 } \left[ Q _ { f i n } ^ { \top } \alpha _ { t } ^ { Q } ; h _ { t } \right] \right) = \tilde { q } _ { t } \in \mathbb { R } ^ { d }
114
+ $$
115
+
116
+ Multi-Pointer-Generator. Our model must be able to generate tokens that are not in the context or the question. We give it access to $v$ additional vocabulary tokens. We obtain distributions over tokens in the context, question, and this external vocabulary, respectively, as
117
+
118
+ $$
119
+ \sum _ { i : c _ { i } = w _ { t } } \left( \alpha _ { t } ^ { C } \right) _ { i } = p _ { c } ( w _ { t } ) \in \mathbb { R } ^ { n } \qquad \sum _ { i : q _ { i } = w _ { t } } \left( \alpha _ { t } ^ { Q } \right) _ { i } = p _ { q } ( w _ { t } ) \in \mathbb { R } ^ { m }
120
+ $$
121
+
122
+ $$
123
+ \mathrm { s o f t m a x } W _ { v } \tilde { c } _ { t } = p _ { v } ( w _ { t } ) \in \mathbb { R } ^ { v }
124
+ $$
125
+
126
+ These distributions are extended to cover the union of the tokens in the context, question, and external vocabulary by setting missing entries in each to 0 so that each distribution is in $\mathbb { R } ^ { l + m + v }$ . Two scalar switches regulate the importance of each distribution in determining the final output distribution.
127
+
128
+ $$
129
+ \sigma \left( W _ { p v } \left[ \tilde { c } _ { t } ; h _ { t } ; \left( A _ { s e l f } \right) _ { t - 1 } \right] \right) = \gamma \in [ 0 , 1 ] \qquad \sigma \left( W _ { c q } \left[ \tilde { q } _ { t } ; h _ { t } ; \left( A _ { s e l f } \right) _ { t - 1 } \right] \right) = \lambda \in [ 0 , 1 ]
130
+ $$
131
+
132
+ $$
133
+ \gamma p _ { v } ( w _ { t } ) + ( 1 - \gamma ) \left[ \lambda p _ { c } ( w _ { t } ) + ( 1 - \lambda ) p _ { q } ( w _ { t } ) \right] = p ( w _ { t } ) \in \mathbb { R } ^ { l + m + v }
134
+ $$
135
+
136
+ We train using a token-level negative log-likelihood loss over all time-steps: $\begin{array} { r } { \mathcal { L } = - \sum _ { t } ^ { T } \log p ( a _ { t } ) } \end{array}$ .
137
+
138
+ Table 2: Validation metrics for decaNLP baselines: sequence-to-sequence (S2S) with self-attentive transformer layers $( + { \bf S } \mathrm { A t t } )$ , the addition of coattention $\mathrm { ( + C A t t ) }$ over a split context and question, and a question pointer $\left( + \mathrm { Q P t r } \right)$ . The last model is equivalent to MQAN. Multitask models use a round-robin batch-level sampling strategy to jointly train on the full decaNLP. The last column includes an additional anti-curriculum $( + \mathrm { \mathbf { A } C u r r } )$ phase that trains on SQuAD alone before switching to the fully joint strategy. Entries marked with ’-’ would correspond to decaScores for aggregates of separately trained models; this is not well-defined without a mechanism for choosing between models.
139
+
140
+ <table><tr><td></td><td colspan="4">Single-task Training</td><td colspan="5">Multitask Training</td></tr><tr><td>Dataset</td><td>S2S</td><td>+SAtt</td><td>+CAtt</td><td>+QPtr</td><td>S2S</td><td>+SAtt</td><td>+CAtt</td><td>+QPtr</td><td>+ACurr</td></tr><tr><td>SQuAD</td><td>48.2</td><td>68.2</td><td>74.6</td><td>75.3</td><td>47.5</td><td>66.8</td><td>71.8</td><td>70.8</td><td>74.4</td></tr><tr><td>IWSLT</td><td>25.0</td><td>23.3</td><td>26.0</td><td>26.7</td><td>14.2</td><td>13.6</td><td>9.0</td><td>16.1</td><td>18.6</td></tr><tr><td>CNN/DM</td><td>19.0</td><td>20.0</td><td>25.1</td><td>25.5</td><td>25.7</td><td>14.0</td><td>15.7</td><td>23.9</td><td>24.3</td></tr><tr><td>MNLI</td><td>67.5</td><td>68.5</td><td>34.7</td><td>73.0</td><td>60.9</td><td>69.0</td><td>70.4</td><td>70.5</td><td>71.5</td></tr><tr><td>SST</td><td>86.4</td><td>86.8</td><td>86.2</td><td>88.5</td><td>85.9</td><td>84.7</td><td>86.5</td><td>86.2</td><td>87.4</td></tr><tr><td>QA-SRL</td><td>63.5</td><td>67.8</td><td>74.8</td><td>77.9</td><td>68.7</td><td>75.1</td><td>76.1</td><td>75.8</td><td>78.4</td></tr><tr><td>QA-ZRE</td><td>20.0</td><td>19.9</td><td>16.6</td><td>24.3</td><td>28.5</td><td>31.7</td><td>28.5</td><td>28.0</td><td>37.6</td></tr><tr><td>WOZ</td><td>85.3</td><td>86.0</td><td>86.5</td><td>88.0</td><td>84.0</td><td>82.8</td><td>75.1</td><td>80.6</td><td>84.8</td></tr><tr><td>WikiSQL</td><td>60.0</td><td>72.4</td><td>72.3</td><td>73.5</td><td>45.8</td><td>64.8</td><td>62.9</td><td>62.0</td><td>64.8</td></tr><tr><td>MWSC</td><td>43.9</td><td>46.3</td><td>40.4</td><td>48.8</td><td>52.4</td><td>43.9</td><td>37.8</td><td>48.8</td><td>48.8</td></tr><tr><td>decaScore</td><td>1</td><td>-</td><td>1</td><td>1</td><td>513.6</td><td>546.4</td><td>533.8</td><td>562.7</td><td>590.6</td></tr></table>
141
+
142
+ # 4 EXPERIMENTS AND ANALYSIS
143
+
144
+ # 4.1 BASELINES AND MQAN
145
+
146
+ In our framework, training examples are (question, context, answer) triplets. Our first baseline is the pointer-generator sequence-to-sequence (S2S) model of See et al. (2017), modified only to take in fixed GloVe vectors instead of training word vectors from scratch. S2S models take in only a single input sequence, so we concatenate the context and question for this model. In Table 2, validation metrics reveal that the S2S model does not perform well on SQuAD. On WikiSQL, it obtains a much higher score than prior sequence-to-sequence baselines (Zhong et al., 2017), but it is low compared to MQAN $\left( + \mathrm { Q P t r } \right)$ and other baselines.
147
+
148
+ Augmenting the S2S model with self-attentive $( + { \bf S } \mathrm { A t t } )$ encoder and decoder layers Vaswani et al. (2017), as detailed in E, increases the model’s capacity to integrate information from both context and question. This improves performance on SQuAD by $2 0 ~ \mathrm { n F 1 }$ , QA-SRL by $4 \mathrm { n F } 1$ , and WikiSQL by 12 LFEM. For WikiSQL, this model nearly matches the prior state-of-the-art validation results of $7 2 . 4 \%$ without using a structured approach (Dong and Lapata, 2018; Huang et al., 2018; Yu et al., 2018b).
149
+
150
+ We next explore splitting the context and question into two input sequences as in typical reading comprehension and question answering settings. We augment the S2S model with a coattention mechanism $\mathrm { ( + C A t t ) }$ from reading comprehension models to tackle this new task formulation. Performance on SQuAD and QA-SRL increases by more than $5 \mathrm { n F } 1$ each. Unfortunately, this fails to improve other tasks, and it significantly hurts performance on MNLI and MWSC. For these two tasks, answers can be copied directly from the question. Because both S2S baselines had the question concatenated to the context, the pointer-generator mechanism was able to copy directly from the question. When the context and question were separated into two different inputs, the model lost this ability.
151
+
152
+ To remedy this, we add a question pointer $\left( + \mathsf { Q P t r } \right)$ to the previous baseline, which gives the MQAN described in Section 3 and Appendix E. This boosts performance on both MNLI and MWSC above prior baselines. It also improved performance on SQuAD to $7 5 . 5 \mathrm { n F } 1$ , which matches performance of the first wave of SQuAD models to make use of direct span supervision (Xiong et al., 2017). This makes it the highest performing question answering model trained on SQuAD that does not explicitly model the problem as span extraction.
153
+
154
+ ![](images/a5dd6b0a7c8b7592d46f434809e52edee366f9ff27b58509ed47d6e938bea482.jpg)
155
+ Figure 3: An analysis of how the MQAN chooses to output answer words. When p(generation) is highest, the MQAN places the most weight on the external vocab. When p(context) is highest, the MQAN places the most weight on the pointer distribution over the context. When p(question) is highest, the MQAN places the most weight on the pointer distribution over the question.
156
+
157
+ This last model achieved a new state-of-the-art test result on WikiSQL by reaching $7 2 . 4 \%$ lfEM and $8 0 . 4 \%$ database execution accuracy, surpassing the previous state of the art set by (Dong and Lapata, 2018) at $7 1 . 7 \%$ and $7 8 . 5 \%$ .
158
+
159
+ In the multitask setting, we see similar results, but we also notice several additional striking features. QA-ZRE performance increases 11 F1 points over the highest single-task models, which supports the hypothesis that multitask learning can lead to better generalization for zero-shot learning. See Appendix $\mathrm { D }$ for details regarding pre-processing and hyperparameters. See Appendix $\mathbf { G }$ for a deeper analysis of how different tasks are related and contribute to the decaScore as well as further experiments using contextualized word vectors (McCann et al., 2017).
160
+
161
+ # 4.2 OPTIMIZATION STRATEGIES AND CURRICULUM LEARNING
162
+
163
+ For multitask training, we experiment with various round-robin batch-level sampling strategies. Fully joint training cycles through all tasks from the beginning of training. However, some tasks require more iterations to converge in the single-task setting, which suggests that these are more difficult for the model to learn. We experiment with both curriculum and anti-curriculum strategies Bengio et al. (2009) based on this notion of difficulty.
164
+
165
+ We divide tasks into two groups: the easiest difficult task requires more than twice the iterations the most difficult easy task requires. Compared to the fully joint strategy, curriculum learning jointly trains the easier tasks (SST, QA-SRL, QA-ZRE, WOZ, WikiSQL, and MWSC) first. This leads to a dramatically reduced decaScore (Appendix F). Anti-curriculum strategies boost performance on tasks trained early, but can also hurt performance on tasks held out until later training. Of the various anti-curriculum strategies we experimented with, only the one which trains on SQuAD alone before transitioning to a fully joint strategy yielded a decaScore higher than using the fully joint strategy without modification. For a full comparison, see Appendix F.
166
+
167
+ # 4.3 ANALYSIS
168
+
169
+ Multi-Pointer-Generator and task identification. At each step, the MQAN decides between three choices: generating from the vocabulary, pointing to the question, and pointing to the context. While the model is not trained with explicit supervision for these decisions, it learns to switch between the three options. Fig. 3 presents statistics of how often the final model chooses each option. For SQuAD, QA-SRL, and WikiSQL, the model mostly copies from the context. This is intuitive because all tokens necessary to correctly answer questions from these datasets are contained in the context. The model also usually copies from the context for CNN/DM because answer summaries consist mostly of words from the context with few words generated from outside the context in between.
170
+
171
+ For SST, MNLI, and MWSC, the model prefers the question pointer because the question contains the tokens for acceptable classes. Because the model learns to use the question pointer in this way, it can do zero-shot classification as discussed in 4.3. For IWSLT and WOZ, the model prefers generating from the vocabulary because German words and dialogue state fields are rarely in the context. The models also avoids copying for QA-ZRE; half of those examples require generating ‘unanswerable’ from the external vocabulary.
172
+
173
+ ![](images/dd2348ee0b4b41f0493b60be2ee39d8b5be3de2505ec24409bf26100b4af0ac1.jpg)
174
+ Figure 4: MQAN pretrained on decaNLP outperforms random initialization when adapting to new domains and learning new tasks. Left: training on a new language pair – English to Czech, right: training on a new task – Named Entity Recognition (NER).
175
+
176
+ Sampled answers confirm that the model does not confuse tasks. German words are only ever output during translation from English to German. The model never outputs anything but ’positive’ and ’negative’ for sentiment analysis.
177
+
178
+ Adaptation to new tasks. MQAN trained on decaNLP learn to generalize beyond the specific domains for any one task while also learning representations that make learning completely new tasks easier. For two new tasks (English-to-Czech translation and named entity recognition - NER), finetuning a MQAN trained on decaNLP requires fewer iterations and reaches a better final performance than training from a random initialization (Fig. 4). For the translation experiment, we use the IWSLT $2 0 1 6 ~ \mathrm { E n { \to } C s }$ dataset and for NER, we use OntoNotes 5.0 (Hovy et al., 2006). For both of these experiments, we retain the model weights and only train a (new) softmax layer that contains the necessary tokens for the new tasks.
179
+
180
+ Zero-shot domain adaptation for text classification. Because MNLI is included in decaNLP, it is possible to adapt to the related Stanford Natural Language Inference Corpus (SNLI) (Bowman et al., 2015) without changing the model at all. Fine-tuning a MQAN pretrained on decaNLP and training exactly as before on MultiNLI achieves an $8 7 \%$ test exact match score, which is a $2 \%$ increase over training from a random initialization and $2 \%$ from the state of the art (Kim et al., 2018). Remarkably, without any training on SNLI, a MQAN pretrained on decaNLP still achieves an EM score of $6 2 \%$ . Because decaNLP contains SST, it can also perform well on other binary sentiment classification tasks without any changes to the model or fine-tuning. We used Amazon and Yelp reviews (Kotzias et al., 2015) as an out of domain test set. A MQAN pretrained on decaNLP achieves test exact match scores of $8 2 . 1 \%$ and $8 0 . 8 \%$ , respectively, without any fine-tuning.
181
+
182
+ Additionally, rephrasing questions by replacing the tokens for the training labels positive/negative with happy/angry or supportive/unsupportive at inference time, leads to only small degradation in performance. The model’s reliance on the question pointer for SST (see Figure 3) allows it to copy different, but related class labels with little confusion. This suggests these multitask models are more robust to slight variations in questions and tasks and can generalize to new and unseen classes.
183
+
184
+ These results demonstrate that models trained on decaNLP have the potential to simultaneously generalize to out-of-domain contexts and questions for multiple tasks and adapt to unseen classes for text classification. This zero-shot domain input and output spaces suggests that the breadth of tasks in decaNLP encourages generalization beyond what can be achieved by training for a single task.
185
+
186
+ # 5 CONCLUSION
187
+
188
+ We introduced the Natural Language Decathlon (decaNLP), a new benchmark for measuring the performance of NLP models across ten tasks that appear disparate until unified as question answering. We presented MQAN, a model for general question answering that uses a multi-pointer-generator decoder to capitalize on questions as natural language descriptions of tasks. Despite not having any task-specific modules, we trained MQAN on all decaNLP tasks jointly, and we showed that anti-curriculum learning gave further improvements. After training on decaNLP , MQAN exhibits transfer learning and zero-shot capabilities. When used as pretrained weights, MQAN improved performance on new tasks. It also demonstrated zero-shot domain adaptation capabilities on text classification from new domains. We hope the the decaNLP benchmark, experimental results, and publicly available code encourage further research into general models for NLP.
189
+
190
+ # REFERENCES
191
+
192
+ Marcin Andrychowicz, Misha Denil, Sergio Gomez, Matthew W Hoffman, David Pfau, Tom Schaul, and Nando de Freitas. Learning to learn by gradient descent by gradient descent. In NIPS, pages 3981–3989, 2016.
193
+
194
+ Jimmy Ba, Ryan Kiros, and Geoffrey E. Hinton. Layer normalization. CoRR, abs/1607.06450, 2016.
195
+
196
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. CoRR, abs/1409.0473, 2014.
197
+
198
+ Samy Bengio, Yoshua Bengio, Jocelyn Cloutier, and Jan Gecsei. On the optimization of a synaptic learning rule. Optimality in Artificial and Biological Neural, pages Networks, pp. , 1992, 1992.
199
+
200
+ Yoshua Bengio, Jérôme Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In ICML, 2009.
201
+
202
+ Johan Bos and Katja Markert. Recognising textual entailment with robust logical inference. In MLCW, 2005.
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
+ Rich Caruana. Multitask learning. Machine Learning, 28:41–75, 1997.
207
+
208
+ Mauro Cettolo, Jan Niehues, Sebastian Stüker, Luisa Bentivogli, R. Cattoni, and Monica J. Federico. The iwslt 2016 evaluation campaign. In IWSLT, 2016.
209
+
210
+ Mia Xu Chen, Orhan Firat, Ankur Bapna, Melvin Johnson, Wolfgang Macherey, George Foster, Llion Jones, Niki Parmar, Mike Schuster, Zhifeng Chen, et al. The best of both worlds: Combining recent advances in neural machine translation. arXiv preprint arXiv:1804.09849, 2018.
211
+
212
+ Qian Chen, Xiao-Dan Zhu, Zhen-Hua Ling, Diana Inkpen, and Si Wei. Natural language inference with external knowledge. CoRR, abs/1711.04289, 2017.
213
+
214
+ Jihun Choi, Kang Min Yoo, and Sang goo Lee. Learning to compose task-specific tree structures. In Association for the Advancement of Artificial Intelligence, 2017.
215
+
216
+ Ronan Collobert and Jason Weston. A unified architecture for natural language processing: deep neural networks with multitask learning. In ICML, 2008.
217
+
218
+ Ronan Collobert, Jason Weston, Léon Bottou, Michael Karlen, Koray Kavukcuoglu, and Pavel P. Kuksa. Natural language processing (almost) from scratch. Journal of Machine Learning Research, 12:2493–2537, 2011.
219
+
220
+ Cleo Condoravdi, Dick Crouch, Valeria de Paiva, Reinhard Stolle, and Daniel G. Bobrow. Entailment, intensionality and text understanding. In Proceedings of the HLT-NAACL 2003 Workshop on Text Meaning - Volume 9, HLT-NAACL-TEXTMEANING ’03, 2003.
221
+
222
+ Ido Dagan, Oren Glickman, and Bernardo Magnini. The pascal recognising textual entailment challenge. In MLCW, 2005.
223
+
224
+ K. Deb. Multi-objective optimization. In Search methodologies, pages 403–449. Springer, 2014.
225
+
226
+ Li Dong and Mirella Lapata. Coarse-to-fine decoding for neural semantic parsing. arXiv preprint arXiv:1805.04793, 2018.
227
+
228
+ C. Fernando, D. Banarse, C. Blundell, Y. Zwols, D. Ha, A. A. Rusu, A. Pritzel, and D. Wierstra. Pathnet: Evolution channels gradient descent in super neural networks. arXiv preprint arXiv:1701.08734, 2017.
229
+
230
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In ICML, 2017.
231
+
232
+ Yaroslav Fyodorov, Yoad Winter, and Nissim Francez. A natural logic inference system. In In Proceedings of the 2nd Workshop on Inference in Computational Semantics (ICoS-2), 2000.
233
+
234
+ Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann Dauphin. Convolutional sequence to sequence learning. In ICML, 2017.
235
+ A. Gepperth and C. Karaoguz. A bio-inspired incremental learning architecture for applied perceptual problems. Cognitive Computation, 8(5):924–934, 2016.
236
+ Reza Ghaeini, Sadid A. Hasan, Vivek Datla, Joey Liu, Kathy Lee, Ashequl Qadir, Yuan Ling, Aaditya Prakash, Xiaoli Z. Fern, and Oladimeji Farri. Dr-bilstm: Dependent reading bidirectional lstm for natural language inference. CoRR, abs/1802.05577, 2018.
237
+ Alex Graves and Jürgen Schmidhuber. Framewise phoneme classification with bidirectional lstm and other neural network architectures. Neural networks : the official journal of the International Neural Network Society, 18 5-6:602–10, 2005.
238
+ Max Grusky, Mor Naaman, and Yoav Artzi. Newsroom: A dataset of 1.3 million summaries with diverse extractive strategies. In NAACL-HLT, New Orleans, Louisiana, 2018.
239
+ Jiatao Gu, Zhengdong Lu, Hang Li, and Victor O. K. Li. Incorporating Copying Mechanism in Sequence-to-Sequence Learning. CoRR, abs/1603.06393, 2016.
240
+ Çaglar Gülçehre, Sungjin Ahn, Ramesh Nallapati, Bowen Zhou, and Yoshua Bengio. Pointing the Unknown Words. arXiv preprint arXiv:1603.08148, 2016.
241
+ Kazuma Hashimoto, Caiming Xiong, Yoshimasa Tsuruoka, and Richard Socher. A joint many-task model: Growing a neural network for multiple NLP tasks. In ICLR, 2016.
242
+ Luheng He, Mike Lewis, and Luke S. Zettlemoyer. Question-answer driven semantic role labeling: Using natural language to annotate natural language. In EMNLP, 2015.
243
+ Luheng He, Kenton Lee, Mike Lewis, and Luke S. Zettlemoyer. Deep semantic role labeling: What works and what’s next. In ACL, 2017.
244
+ Karl Moritz Hermann, Tomás Kociský, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa Suleyman, and Phil Blunsom. Teaching machines to read and comprehend. In NIPS, 2015.
245
+ Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9 8: 1735–80, 1997.
246
+ Sepp Hochreiter, A Steven Younger, and Peter R Conwell. Learning to learn using gradient descent. In International Conference on Artificial Neural Networks, pages 87–94. Springer, 2001.
247
+ Eduard H. Hovy, Mitchell P. Marcus, Martha Palmer, Lance A. Ramshaw, and Ralph M. Weischedel. Ontonotes: The 90 In HLT-NAACL, 2006.
248
+ Jeremy Howard and Sebastian Ruder. Fine-tuned language models for text classification. CoRR, abs/1801.06146, 2018.
249
+ Minghao Hu, Yuxing Peng, Zhen Huang, Xipeng Qiu, Furu Wei, and Ming Zhou. Reinforced mnemonic reader for machine reading comprehension. CoRR, abs/1705.02798, 2018.
250
+ Hsin-Yuan Huang, Chenguang Zhu, Yelong Shen, and Weizhu Chen. Fusionnet: Fusing via fullyaware attention with application to machine comprehension. CoRR, abs/1711.07341, 2017.
251
+ Po-Sen Huang, Chenglong Wang, Rishabh Singh, Wen-tau Yih, and Xiaodong He. Natural language to structured query generation via meta-learning. arXiv preprint arXiv:1803.02400, 2018.
252
+ Jinbae Im and Sungzoon Cho. Distance-based self-attention network for natural language inference. CoRR, abs/1712.02047, 2017.
253
+ Richard Johansson and Pierre Nugues. Dependency-based semantic role labeling of propbank. In EMNLP, 2008.
254
+ Melvin Johnson, Mike Schuster, Quoc V. Le, Maxim Krikun, Yonghui Wu, Zhifeng Chen, Nikhil Thorat, Fernanda B. Viégas, Martin Wattenberg, Gregory S. Corrado, Macduff Hughes, and Jeffrey Dean. Google’s multilingual neural machine translation system: Enabling zero-shot translation. TACL, 5:339–351, 2017.
255
+
256
+ Mandar Joshi, Eunsol Choi, Daniel S. Weld, and Luke S. Zettlemoyer. Triviaqa: A large scale distantly supervised challenge dataset for reading comprehension. In ACL, 2017.
257
+
258
+ Lukasz Kaiser, Aidan N. Gomez, Noam Shazeer, Ashish Vaswani, Niki Parmar, Llion Jones, and Jakob Uszkoreit. One model to learn them all. CoRR, abs/1706.05137, 2017.
259
+
260
+ Ronald Kemker, Angelina Abitino, Marc McClure, and Christopher Kanan. Measuring catastrophic forgetting in neural networks. CoRR, abs/1708.02072, 2017.
261
+
262
+ Seonhoon Kim, Jin-Hyuk Hong, Inho Kang, and Nojun Kwak. Semantic sentence matching with densely-connected recurrent and co-attentive information. arXiv preprint arXiv:1805.11360, 2018.
263
+
264
+ James Kirkpatrick, Razvan Pascanu, Neil C. Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A. Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, Demis Hassabis, Claudia Clopath, Dharshan Kumaran, and Raia Hadsell. Overcoming catastrophic forgetting in neural networks. Proceedings of the National Academy of Sciences of the United States of America, 114 13:3521–3526, 2017.
265
+
266
+ Ryan Kiros, Yukun Zhu, Ruslan Salakhutdinov, Richard S. Zemel, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. Skip-thought vectors. In NIPS, 2015.
267
+
268
+ D. Kotzias, M. Denil, N. De Freitas, and P. Smyth. From group to individual labels using deep features. In Proceedings of the 21th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pages 597–606. ACM, 2015.
269
+
270
+ Ankit Kumar, Ozan Irsoy, Peter Ondruska, Mohit Iyyer, James Bradbury, Ishaan Gulrajani, Victor Zhong, Romain Paulus, and Richard Socher. Ask me anything: Dynamic memory networks for natural language processing. In ICML, 2016.
271
+
272
+ S. Lee, J. Kim, J. Jun, J. Ha, and B. Zhang. Overcoming catastrophic forgetting by incremental moment matching. In Advances in Neural Information Processing Systems, pages 4655–4665, 2017.
273
+
274
+ Hector J Levesque, Ernest Davis, and Leora Morgenstern. The winograd schema challenge. In Aaai spring symposium: Logical formalizations of commonsense reasoning, volume 46, page 47, 2011.
275
+
276
+ Omer Levy, Minjoon Seo, Eunsol Choi, and Luke S. Zettlemoyer. Zero-shot relation extraction via reading comprehension. In CoNLL, 2017.
277
+
278
+ Chin-Yew Lin. Rouge: A package for automatic evaluation of summaries. In Proceedings of ACL workshop on Text Summarization, 2004.
279
+
280
+ Rui Liu, Wei Wei, Weiguang Mao, and Maria Chikina. Phase conductor on multi-layered attentions for machine comprehension. CoRR, abs/1710.10504, 2017a.
281
+
282
+ Xiaodong Liu, Yelong Shen, Kevin Duh, and Jianfeng Gao. Stochastic answer networks for machine reading comprehension. CoRR, abs/1712.03556, 2017b.
283
+
284
+ Minh-Thang Luong, Quoc V. Le, Ilya Sutskever, Oriol Vinyals, and Lukasz Kaiser. Multi-task sequence to sequence learning. CoRR, abs/1511.06114, 2015a.
285
+
286
+ Thang Luong, Hieu Pham, and Christopher D. Manning. Effective approaches to attention-based neural machine translation. In EMNLP, 2015b.
287
+
288
+ Bill MacCartney and Christopher D. Manning. An extended model of natural logic. In IWCS, 2009.
289
+
290
+ A. Mallya and S. Lazebnik. Packnet: Adding multiple tasks to a single network by iterative pruning. arXiv preprint arXiv:1711.05769, 2017.
291
+
292
+ Diego Marcheggiani, Anton Frolov, and Ivan Titov. A simple and accurate syntax-agnostic neural model for dependency-based semantic role labeling. In CoNLL, 2017.
293
+
294
+ Bryan McCann, James Bradbury, Caiming Xiong, and Richard Socher. Learned in translation: Contextualized word vectors. In NIPS, 2017.
295
+
296
+ Michael McCloskey and Neal J Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. In Psychology of learning and motivation, volume 24, pages 109–165. Elsevier, 1989.
297
+
298
+ Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. ICLR, 2017.
299
+
300
+ Tomas Mikolov, Kai Chen, Gregory S. Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. CoRR, abs/1301.3781, 2013a.
301
+
302
+ Tomas Mikolov, Ilya Sutskever, Kai Chen, Gregory S. Corrado, and Jeffrey Dean. Distributed representations of words and phrases and their compositionality. In NIPS, 2013b.
303
+
304
+ Sewon Min, Min Joon Seo, and Hannaneh Hajishirzi. Question answering through transfer learning from large fine-grained supervision data. In ACL, 2017.
305
+
306
+ Tom M. Mitchell. The need for biases in learning generalizations. In The Need for Biases in Learning Generalizations, 1980.
307
+
308
+ Nikola Mrkšic, Diarmuid O Séaghdha, Tsung-Hsien Wen, Blaise Thomson, and Steve Young. Neural ´ belief tracker: Data-driven dialogue state tracking. arXiv preprint arXiv:1606.03777, 2016.
309
+
310
+ Vinod Nair and Geoffrey E. Hinton. Rectified linear units improve restricted boltzmann machines. In ICML, 2010.
311
+
312
+ Ramesh Nallapati, Bowen Zhou, Cícero Nogueira dos Santos, Çaglar Gülçehre, and Bing Xiang. Abstractive text summarization using sequence-to-sequence RNNs and beyond. In CoNLL, 2016.
313
+
314
+ Boyuan Pan, Hao Li, Zhou Zhao, Bin Cao, Deng Cai, and Xiaofei He. Memen: Multi-layer embedding with memory networks for machine comprehension. CoRR, abs/1707.09098, 2017.
315
+
316
+ Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In ACL, 2002.
317
+
318
+ Ramakanth Pasunuru and Mohit Bansal. Multi-reward reinforced summarization with saliency and entailment. In NAACL, 2018.
319
+
320
+ Ramakanth Pasunuru, Han Guo, and Mohit Bansal. Towards improving abstractive summarization via entailment generation. In NFiS@EMNLP, 2017.
321
+
322
+ Romain Paulus, Caiming Xiong, and Richard Socher. A deep reinforced model for abstractive summarization. arXiv preprint arXiv:1705.04304, 2017.
323
+
324
+ Jeffrey Pennington, Richard Socher, and Christopher D. Manning. Glove: Global vectors for word representation. In EMNLP, 2014.
325
+
326
+ Matthew E. Peters, Mark Neumann, Mohit Iyyer, Matthew Gardner, Christopher Clark, Kenton Lee, and Luke S. Zettlemoyer. Deep contextualized word representations. CoRR, abs/1802.05365, 2018.
327
+
328
+ Adam Poliak, Yonatan Belinkov, James Glass, and Benjamin Van Durme. On the evaluation of semantic phenomena in neural machine translation using natural language inference. arXiv preprint arXiv:1804.09779, 2018a.
329
+
330
+ Adam Poliak, Aparajita Haldar, Rachel Rudinger, J Edward Hu, Ellie Pavlick, Aaron Steven White, and Benjamin Van Durme. Towards a unified natural language inference framework to evaluate sentence representations. arXiv preprint arXiv:1804.08207, 2018b.
331
+
332
+ Vasin Punyakanok, Dan Roth, and Wen tau Yih. The importance of syntactic parsing and inference in semantic role labeling. Computational Linguistics, 34:257–287, 2008.
333
+
334
+ Alec Radford, Rafal Józefowicz, and Ilya Sutskever. Learning to generate reviews and discovering sentiment. CoRR, abs/1704.01444, 2017.
335
+
336
+ Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: 100, $0 0 0 +$ questions for machine comprehension of text. In EMNLP, 2016.
337
+
338
+ Prajit Ramachandran, Peter J. Liu, and Quoc V. Le. Unsupervised pretraining for sequence to sequence learning. In EMNLP, 2017.
339
+
340
+ Rodney Mark Ratcliff. Connectionist models of recognition memory: constraints imposed by learning and forgetting functions. Psychological review, 97 2:285–308, 1990.
341
+
342
+ A. Robins. Catastrophic forgetting, rehearsal and pseudorehearsal. Connection Science, 7(2):123–146, 1995.
343
+
344
+ Sebastian Ruder, Joachim Bingel, Isabelle Augenstein, and Anders Sogaard. Sluice networks: Learning what to share between loosely related tasks. CoRR, abs/1705.08142, 2017.
345
+
346
+ Shimi Salant and Jonathan Berant. Contextualized word representations for reading comprehension. CoRR, abs/1712.03609, 2017.
347
+
348
+ Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy Lillicrap. Metalearning with memory-augmented neural networks. In International conference on machine learning, pages 1842–1850, 2016.
349
+
350
+ Jürgen Schmidhuber. Evolutionary principles in self-referential learning, or on learning how to learn: the meta-meta-... hook. PhD thesis, Technische Universität München, 1987.
351
+
352
+ Jürgen Schmidhuber. Learning to control fast-weight memories: An alternative to dynamic recurrent networks. Neural Computation, 4(1):131–139, 1992.
353
+
354
+ Abigail See, Peter J. Liu, and Christopher D. Manning. Get to the point: Summarization with pointer-generator networks. In ACL, 2017.
355
+
356
+ Rico Sennrich, Alexandra Birch, Anna Currey, Ulrich Germann, Barry Haddow, Kenneth Heafield, Antonio Valerio Miceli Barone, and Philip Williams. The university of edinburgh’s neural mt systems for wmt17. In WMT, 2017.
357
+
358
+ Minjoon Seo, Aniruddha Kembhavi, Ali Farhadi, and Hannaneh Hajishirzi. Bidirectional attention flow for machine comprehension. ICLR, 2017.
359
+
360
+ Tao Shen, Tianyi Zhou, Guodong Long, Jing Jiang, Sen Wang, and Chengqi Zhang. Reinforced self-attention network: a hybrid of hard and soft attention for sequence modeling. CoRR, abs/1801.10296, 2018.
361
+
362
+ R. Socher, A. Perelygin, J. Wu, J. Chuang, C. Manning, A. Ng, and C. Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In EMNLP, 2013.
363
+
364
+ Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. Sequence to sequence learning with neural networks. In NIPS, 2014.
365
+
366
+ Jun Suzuki and Masaaki Nagata. Cutting-off redundant repeating generations for neural abstractive summarization. In EACL, 2017.
367
+
368
+ Kai Sheng Tai, Richard Socher, and Christopher D. Manning. Improved semantic representations from tree-structured long short-term memory networks. In ACL, 2015.
369
+
370
+ Zhixing Tan, Mingxuan Wang, Jun Xie, Yidong Chen, and Xiaodong Shi. Deep semantic role labeling with self-attention. CoRR, abs/1712.01586, 2017.
371
+
372
+ Yi Tay, Luu Anh Tuan, and Siu Cheung Hui. A compare-propagate architecture with alignment factorization for natural language inference. CoRR, abs/1801.00102, 2017.
373
+
374
+ Sebastian Thrun. Lifelong learning algorithms. In Learning to learn, pages 181–209. Springer, 1998.
375
+
376
+ Sebastian Thrun and Lorien Pratt. Learning to learn: Introduction and overview. In Learning to learn, pages 3–17. Springer, 1998.
377
+
378
+ Adam Trischler, Tong Wang, Xingdi Yuan, Justin Harris, Alessandro Sordoni, Philip Bachman, and Kaheer Suleman. Newsqa: A machine comprehension dataset. In Rep4NLP@ACL, 2017.
379
+
380
+ 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.
381
+
382
+ R. Vilalta and Y. Drissi. A perspective view and survey of meta-learning. Artificial Intelligence Review, 18(2):77–95, 2002.
383
+
384
+ Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In NIPS, 2015.
385
+
386
+ Alex Wang, Amapreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. arXiv preprint arXiv:1804.07461, 2018.
387
+
388
+ Shuohang Wang and Jing Jiang. Machine comprehension using Match-LSTM and answer pointer. In ICLR, 2017.
389
+
390
+ Wenhui Wang, Nan Yang, Furu Wei, Baobao Chang, and Ming Zhou. Gated self-matching networks for reading comprehension and question answering. In ACL, 2017a.
391
+
392
+ Zhiguo Wang, Wael Hamza, and Radu Florian. Bilateral multi-perspective matching for natural language sentences. In IJCAI, 2017b.
393
+
394
+ Dirk Weissenborn, Georg Wiese, and Laura Seiffe. Making neural qa as simple as possible but not simpler. In CoNLL, 2017.
395
+
396
+ Tsung-Hsien Wen, David Vandyke, Nikola Mrksic, Milica Gasic, Lina M Rojas-Barahona, Pei-Hao Su, Stefan Ultes, and Steve Young. A network-based end-to-end trainable task-oriented dialogue system. arXiv preprint arXiv:1604.04562, 2016.
397
+
398
+ Adina Williams, Nikita Nangia, and Samuel R. Bowman. A broad-coverage challenge corpus for sentence understanding through inference. CoRR, abs/1704.05426, 2017.
399
+
400
+ Terry Winograd. Understanding natural language. Cognitive psychology, 3(1):1–191, 1972.
401
+
402
+ Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V. Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, Jeff Klingner, Apurva Shah, Melvin Johnson, Xiaobing Liu, Lukasz Kaiser, Stephan Gouws, Yoshikiyo Kato, Taku Kudo, Hideto Kazawa, Keith Stevens, George Kurian, Nishant Patil, Wei Wang, Cliff Young, Jason Smith, Jason Riesa, Alex Rudnick, Oriol Vinyals, Gregory S. Corrado, Macduff Hughes, and Jeffrey Dean. Google’s neural machine translation system: Bridging the gap between human and machine translation. CoRR, abs/1609.08144, 2016.
403
+
404
+ Caiming Xiong, Stephen Merity, and Richard Socher. Dynamic Memory Networks for Visual and Textual Question Answering. In ICML, 2016.
405
+
406
+ Caiming Xiong, Victor Zhong, and Richard Socher. Dynamic coattention networks for question answering. ICLR, 2017.
407
+
408
+ Caiming Xiong, Victor Zhong, and Richard Socher. Dcn+: Mixed objective and deep residual coattention for question answering. ICLR, 2018.
409
+
410
+ Adams Wei Yu, David Dohan, Minh-Thang Luong, Rui Zhao, Kai Chen, Mohammad Norouzi, and Quoc V. Le. Qanet: Combining local convolution with global self-attention for reading comprehension. In ICLR, 2018a.
411
+
412
+ Hong Yu and Tsendsuren Munkhdalai. Neural semantic encoders. Proceedings of the conference. Association for Computational Linguistics. Meeting, 1:397–407, 2017a.
413
+
414
+ Hong Yu and Tsendsuren Munkhdalai. Neural tree indexers for text understanding. ACL, 2017b.
415
+
416
+ Tao Yu, Zifan Li, Zilin Zhang, Rui Zhang, and Dragomir Radev. Typesql: Knowledge-based type-aware neural text-to-sql generation. arXiv preprint arXiv:1804.09769, 2018b.
417
+
418
+ Yang Yu, Wei Zhang, Kazi Saidul Hasan, Mo Yu, Bing Xiang, and Bowen Zhou. End-to-end reading comprehension with dynamic answer chunk ranking. CoRR, abs/1610.09996, 2016.
419
+
420
+ Victor Zhong, Caiming Xiong, and Richard Socher. Seq2sql: Generating structured queries from natural language using reinforcement learning. CoRR, abs/1709.00103, 2017.
421
+
422
+ Victor Zhong, Caiming Xiong, and Richard Socher. Global-locally self-attentive dialogue state tracker. arXiv preprint arXiv:1805.09655, 2018.
423
+
424
+ Jie Zhou and Wei Xu. End-to-end learning of semantic role labeling using recurrent neural networks. In ACL, 2015.
425
+
426
+ Barret Zoph, Deniz Yuret, Jonathan May, and Kevin Knight. Transfer learning for low-resource neural machine translation. In EMNLP, 2016.
427
+
428
+ # A TASK MOTIVATIONS
429
+
430
+ The Natural Language Decathlon asks whether we have learned enough from single tasks to get a sense of how much of natural language current methods really understand. With this in mind, we have several intentions for models that attempt the Decathlon, and we have chosen the tasks in such a way that they reflect these intentions. Models should be able to:
431
+
432
+ 1. interact with people regardless of their natural language,
433
+ 2. work well across many different domains of natural language,
434
+ 3. extract information about mental states from natural language,
435
+ 4. summarize what is understood,
436
+ 5. answer questions about specific pieces of text and retrieve pertinent information,
437
+ 6. convey when they have insufficient information to answer questions,
438
+ 7. understand semantic relationships related to the roles and actions in the world,
439
+ 8. interact with other machines,
440
+ 9. perform linguistic-based reasoning that is easy for humans,
441
+ 10. interact with humans to achieve a goal,
442
+ 1. convey relevant information in a human readable format,
443
+ 12. learn relatedness of tasks to allow for zero-shot adjustment to new tasks
444
+
445
+ Noticeably, we do not include an intention for models to understand linguistic features explicitly. There are two reasons for this. First, humans demonstrate that it is possible to satisfy all of the above intentions without an explicit linguistic understanding of natural language. Second, it is already understood how tasks like part-of-speech tagging, parsing, chunking, etc. can contribute to models performing higher-level tasks (Hashimoto et al., 2016). For the latter reason, we highly encourage experimentation with intermediate tasks that might aid models in decaNLP.
446
+
447
+ The final intention deals more strongly with the specific approach to decaNLP used in this paper than it does with decaNLP itself. This is in line with our belief that we need to move away from hand-designed parameter sharing and transfer learning. In the same way that moving away from hand-crafted features to learned features made new things possible, we believe that we should let the model decide how to distribute its knowledge. This is in an effort to ensure that we are not limiting the model’s ability to generalize to new tasks by cutting off helpful signal from any previously learned tasks.
448
+
449
+ # B RELATED WORK
450
+
451
+ This section contains work related to aspects of decaNLP and MQAN that are not task-specific. See Appendix C for work related to each individual task.
452
+
453
+ Transfer Learning in NLP. Most success in making use of the relatedness between natural language tasks stem from transfer learning. Word2Vec (Mikolov et al., 2013a;b), skip-thought vectors (Kiros et al., 2015) and GloVe (Pennington et al., 2014) yield pretrained embeddings that capture useful information about natural language. The embeddings (Collobert and Weston, 2008; Collobert et al., 2011), intermediate representations (Peters et al., 2018), and weights of language models can be transferred to similar architectures (Ramachandran et al., 2017) and classification tasks (Howard and Ruder, 2018). Intermediate representations from supervised machine translation models improve performance on question answering, sentiment analysis, and natural language inference (McCann et al., 2017). Question answering datasets support each other as well as entailment tasks (Min et al., 2017), and high-resource machine translation can support low-resource machine translation (Zoph et al., 2016). This work shows that the combination of MQAN and decaNLP makes it possible to transfer an entire end-to-end model that can be adapted for any NLP task cast as question answering.
454
+
455
+ Multitask Learning in NLP. Unified architectures have arisen for chunking, POS tagging, NER, and SRL (Collobert et al., 2011) as well as dependency parsing, semantic relatedness, and natural language inference (Hashimoto et al., 2016). Multitask learning over different machine translation language pairs can enable zero-shot translation (Johnson et al., 2017), and sequence-to-sequence architectures can be used to multitask across translation, parsing, and image captioning (Luong et al., 2015a) using varying numbers of encoders and decoders. These tasks can also be learned with image classification and speech recognition with careful modularization (Kaiser et al., 2017), and the success of this approach extends to visual and textual question answering (Xiong et al., 2016). Learning such modularization can further mitigate interference between tasks (Ruder et al., 2017).
456
+
457
+ More generally, multitask learning has been successful when models are able to capitalize on relatedness amongst tasks while mitigating interference from dissimilarities (Caruana, 1997). When tasks are sufficiently related, they can provide an inductive bias (Mitchell, 1980) that forces models to learn more generally useful representations. By unifying tasks under a single perspective, it is possible to explore these relationships (Wang et al., 2018; Poliak et al., 2018a;b).
458
+
459
+ MQAN trained on decaNLP is the first, single model to achieve reasonable performance on such a wide variety of complex NLP tasks without task-specific modules or parameters, with little evidence of catastrophic interference, and without parse trees, chunks, POS tags, or other intermediate representations. This sets the foundation for general question answering models.
460
+
461
+ Optimization and Catastrophic Forgetting. Multitask learning presents a set of optimization problems that extend beyond the NLP setting. Multi-objective optimization (Deb, 2014) naturally connects to multitask learning and typically involves querying a decision-maker who weighs different objectives. Much effort has gone into mitigating catastrophic forgetting (McCloskey and Cohen, 1989; Ratcliff, 1990; Kemker et al., 2017) by penalizing the norm of parameters when training on a new task (Kirkpatrick et al., 2017), the norm of the difference between parameters for previously learned tasks during parameter updates (Hashimoto et al., 2016), incrementally matching modes (Lee et al., 2017), rehearsing on old tasks (Robins, 1995), using adaptive memory buffers (Gepperth and Karaoguz, 2016), finding task-specific paths through networks (Fernando et al., 2017), and packing new tasks into already trained networks (Mallya and Lazebnik, 2017).
462
+
463
+ MQAN is able to perform nearly as well or better in the multitask setting as in the single-task setting for each task despite being capped at the same number of trainable parameters in both. A collection of MQANs trained for each task individually would use far more trainable parameters than a single MQAN trained jointly on decaNLP. This suggests that MQAN successfully uses trainable parameters more efficiently in the multitask setting by learning to pack or share parameters in a way that limits catastrophic forgetting.
464
+
465
+ Meta-Learning Meta-learning attempts to train models on a variety of tasks so that they can easily learn new tasks (Thrun and Pratt, 1998; Thrun, 1998; Vilalta and Drissi, 2002). Past work has shown how to learn rules for learning (Schmidhuber, 1987; Bengio et al., 1992), train meta-agents that control parameter updates (Hochreiter et al., 2001; Andrychowicz et al., 2016), augment models with special memory mechanisms (Santoro et al., 2016; Schmidhuber, 1992), and maximize the degree to which models can learn new tasks (Finn et al., 2017).
466
+
467
+ # C TASK-SPECIFIC RELATED WORK
468
+
469
+ Question Answering. Early success on the SQuAD dataset exploited the fact that all answers can be found verbatim in the context. State-of-the-art models point to start and end tokens in the document (Seo et al., 2017; Xiong et al., 2017; Yu et al., 2016; Weissenborn et al., 2017). This allowed deterministic answer extraction to overtake sequential token generation (Wang and Jiang, 2017). This quirk of the dataset does not hold for question answering in general, so recent models for SQuAD are not necessarily general question answering models (Yu et al., 2018a; Hu et al., 2018; Wang et al., 2017a; Liu et al., 2017b; Huang et al., 2017; Xiong et al., 2018; Liu et al., 2017a; Pan et al., 2017; Salant and Berant, 2017). While datasets like TriviaQA (Joshi et al., 2017) and NewsQA (Trischler et al., 2017) could also represent question answering, SQuAD is particularly interesting because the human level performance of SQuAD models in the single-task setting depends on a quirk that does not generalize to all forms of question answering. Including SQuAD in decaNLP challenges models to integrate techniques learned from a single-task approach into a more general approach while evaluation remains grounded in the document. Many of the alternatives are larger and can be used as additional training data or incorporated into future iterations of the decaNLP once the more well-understood SQuAD dataset has been mastered in the multitask setting.
470
+
471
+ Machine Translation. Until recently, the standard approach trained recurrent models with attention (Luong et al., 2015b; Bahdanau et al., 2014) on a single source-target language pair (Wu et al., 2016; Sennrich et al., 2017). Models that use only convolution (Gehring et al., 2017) or attention (Vaswani et al., 2017) have shown that recurrence is not essential for the task, but recurrence can contribute to the strongest models (Chen et al., 2018). While training these models on many source and target languages at the same time remains difficult, limiting models to one source language and many target languages or vice versa can lead to strong performance when resources are limited or null (Johnson et al., 2017).
472
+
473
+ While much larger corpora and many other language pairs exist, the English-German IWSLT dataset provides the same order of magnitude of training data as the other tasks in decaNLP. We encourage the use of larger corpora or multiple language pairs to improve performance, but we did not want to skew the first iteration of the challenge too far towards machine translation.
474
+
475
+ Summarization Recent approaches combine recurrent neural networks with pointer networks to generate output sequences that contain key words copied from the document (Nallapati et al., 2016). Coverage mechanisms (Nallapati et al., 2016; See et al., 2017; Suzuki and Nagata, 2017) and temporal attention (Paulus et al., 2017) improve problems with redundancy in long summaries. Reinforcement learning has pushed performance using common summarization metrics (Paulus et al., 2017) as well as alternative metrics that transfer knowledge from another task (Pasunuru et al., 2017; Pasunuru and Bansal, 2018).
476
+
477
+ While new corpora like NEWSROOM (Grusky et al., 2018) are even larger, CNN/DM remains the current standard benchmark, so we include it in decaNLP and encourage augmentation with datasets like NEWSROOM.
478
+
479
+ Natural Language Inference NLI has a long history playing roles in tasks like information retrieval and semantic parsing (Fyodorov et al., 2000; Condoravdi et al., 2003; Bos and Markert, 2005; Dagan et al., 2005; MacCartney and Manning, 2009). The introduction of the Stanford Natural Language Inference Corpus (SNLI) by (Bowman et al., 2015) spurred a new wave of interest in NLI, its connections to other tasks, and general sentence representations. The most successful approaches make use of attentional models that match and align words in the premise to those in the hypothesis (Tay et al., 2017; Peters et al., 2018; Ghaeini et al., 2018; Chen et al., 2017; Wang et al., 2017b; McCann et al., 2017), but recent non-attentional models designed to extract useful sentence representations have nearly closed the gap (Liu et al., 2017b; Im and Cho, 2017; Shen et al., 2018; Choi et al., 2017).
480
+
481
+ The dataset we use, the Multi-Genre Natural Language Inference Corpus (MNLI) introduced by (Williams et al., 2017), is the successor to SNLI. Recent approaches to MNLI use methods developed on SNLI and have even pointed out the similarities between models for question answering and NLI (Huang et al., 2017).
482
+
483
+ Sentiment Analysis Because SST came with parse trees for every example, some approaches use all of the sub-tree labels by modeling trees explicitly (Yu and Munkhdalai, 2017b; Tai et al., 2015) as in the original paper. Others use sub-tree labels implicitly (Yu and Munkhdalai, 2017a; McCann et al., 2017; Peters et al., 2018), and still others do not use the sub-trees at all (Radford et al., 2017). This suggests that while the many sub-tree labels might facilitate learning, they are not necessary to train state-of-the-art models.
484
+
485
+ Semantic Role Labeling Traditionally, models have made use of syntactic parsing information Punyakanok et al. (2008), but recent methods have demonstrated that it is not necessary to use syntactic information as additional input (Zhou and Xu, 2015; Marcheggiani et al., 2017). State-of-the-art approaches treat SRL as a tagging problem (He et al., 2017), make use of that specific structure to constrain decoding, and mix recurrent and self-attentive layers (Tan et al., 2017).
486
+
487
+ Because QA-SRL treats SRL as question answering (He et al., 2015), it abstracts away the many task-specific constraints of treating SRL as a tagging problem with hand-designed verb-specific roles or grammars. This preserves much of the structure extracted by prior formulations while also allowing models to extract structure that is not syntax-based.
488
+
489
+ Relation Extraction QA-ZRE introduced a similar idea for relation extraction (Levy et al., 2017). By associating natural language questions with relations, this dataset reduces relation extraction to question answering. This makes it possible to use question answering models in place of more traditional relation extraction models that often do not make use of the linguistic similarities amongst relations. This in turn makes it possible to do zero-shot relation extraction.
490
+
491
+ Goal-Oriented Dialogue Dialogue state tracking requires a system to estimate a users goals and and requests given the dialogue context, and it plays a crucial role in goal-oriented dialogue systems. Most models use a structured approach (Mrkšic et al., 2016), with the most recent work making use ´ of both global and local modules to learns representations of the user utterance and previous system actions (Zhong et al., 2018).
492
+
493
+ Semantic Parsing Similarly, recent approaches to the semantic parsing WikiSQL dataset have made use of structured approaches that move from coarse sketches of the input to fine-grained structured outputs (Dong and Lapata, 2018), direclty employing a type system (Yu et al., 2018b), or making use of dependency graphs (Huang et al., 2018).
494
+
495
+ # D PREPROCESSING AND TRAINING DETAILS
496
+
497
+ All data is lowercased as is common for SQuAD, IWSLT, CNN/DM, and WikiSQL; casing is irrelevant for the evaluation of the other tasks. We use the RevTok tokenizer4 to provide simple, yet completely reversible tokenization, which is crucial for detokenizing generated sequences for evaluation. The generative vocabulary in Eq. 11 contains the most frequent 50000 words in the combined training sets for all tasks in decaNLP. SQuAD examples with context longer than 400 tokens were excluded during training and CNN/DM examples had contexts truncated to 400 tokens during training and evaluation. Only MNLI examples with a label other than ‘-’ were included during training and evaluation as is standard. For WOZ, we train turn-by-turn to predict the change in belief state including user requests as an additional slot, but during evaluation we only consider the cumulative belief state as is standard. We do not perform any form of beam search or otherwise refine greedily sampled outputs for any tasks to avoid task-specific post-processing where possible.
498
+
499
+ The MQAN defined in Section 3 takes 300-dimensional GloVe embeddings trained on CommonCrawl (Pennington et al., 2014) as input. Words that do not have corresponding GloVe embeddings are assigned zero vectors instead. We concatenate 100-dimensional character n-gram embeddings (Hashimoto et al., 2016) to the GloVe embeddings. This corresponds to setting $d _ { e m b } = 4 0 0$ in Section 3. Internal model dimension $d = 2 0 0$ , hidden dimension $f = 1 5 0$ , and the number of heads in multi-head attention $p = 3$ . MQAN uses 2 self-attention and multi-head decoder attention layers. We use a dropout of 0.2 on inputs to LSTMs, layers following coattention, and decoder layers, before multiplying by $\tilde { Z }$ in Eq. 22, before adding $X$ in Eq. 25, and generally after any linear transformation. The models are trained using Adam with $( \bar { \beta } _ { 1 } , \bar { \beta } _ { 2 } , \epsilon ) = ( \bar { 0 } . 9 , 0 . 9 \bar { 8 } , 1 0 ^ { - 9 } )$ and a warmup schedule (Vaswani et al., 2017), which increases the learning rate linearly from 0 to $2 . 5 \times 1 0 ^ { - 3 }$ over 800 iterations before decaying it as $\scriptstyle { \frac { 1 } { \sqrt { k } } }$ , where $k$ is the iteration count. Batches consist entirely of examples from one task and are dynamically constructed to fit as many examples as possible so that the sum of the number of tokens in the context and question and five times the number of tokens in the asnwer does not exceed 10000.
500
+
501
+ # E MULTITASK QUESTION ANSWERING NETWORK (MQAN) ENCODER
502
+
503
+ Recall from Section 3 that the encoder has three input sequences during training: a context $c$ with $l$ tokens, a question $q$ with $m$ tokens, and an answer $a$ with $n$ tokens. Each of these is represented by a matrix where the ith row of the matrix corresponds to a $d _ { e m b }$ -dimensional embedding (such as word or character vectors) for the $i$ th token in the sequence:
504
+
505
+ $$
506
+ C \in \mathbb { R } ^ { l \times d _ { e m b } } \qquad Q \in \mathbb { R } ^ { m \times d _ { e m b } } \qquad A \in \mathbb { R } ^ { n \times d _ { e m b } }
507
+ $$
508
+
509
+ Independent Encoding. A linear layer projects input matrices onto a common $d$ -dimensional space.
510
+
511
+ $$
512
+ C W _ { 1 } = C _ { p r o j } \in \mathbb { R } ^ { l \times d } \qquad Q W _ { 1 } = Q _ { p r o j } \in \mathbb { R } ^ { m \times d }
513
+ $$
514
+
515
+ These projected representations are fed into a shared, bidirectional Long Short-Term Memory Network (BiLSTM) (Hochreiter and Schmidhuber, 1997; Graves and Schmidhuber, 2005) 5
516
+
517
+ $$
518
+ \mathrm { B i L S T M } _ { i n d } ( C _ { p r o j } ) = C _ { i n d } \in \mathbb { R } ^ { l \times d } \qquad \mathrm { B i L S T M } _ { i n d } ( Q _ { p r o j } ) = Q _ { i n d } \in \mathbb { R } ^ { m \times d }
519
+ $$
520
+
521
+ Alignment. We obtain coattended representations by first aligning encoded representations of each sequence. We add separate trained, dummy embeddings to $C _ { i n d }$ and $Q _ { i n d }$ ( $\mathbf { \bar { \rho } } _ { \mathrm { n o w } } \in \mathbb { R } ^ { ( l + 1 ) \times d }$ and $\mathbb { R } ^ { ( \bar { m } + 1 ) \times d } )$ ) so that tokens are not forced to align with any token in the other sequence.
522
+
523
+ Let softmax $X$ denote a column-wise softmax that normalizes each column of the matrix $X$ to have entries that sum to 1. We obtain alignments by normalizing dot-product similarity scores between representations of one sequence with those of the other:
524
+
525
+ $$
526
+ \mathrm { s o f t m a x } C _ { i n d } Q _ { i n d } ^ { \top } = S _ { c q } \in \mathbb { R } ^ { ( l + 1 ) \times ( m + 1 ) } \qquad \mathrm { s o f t m a x } Q _ { i n d } C _ { i n d } ^ { \top } = S _ { q c } \in \mathbb { R } ^ { ( m + 1 ) \times ( l + 1 ) }
527
+ $$
528
+
529
+ Dual Coattention. These alignments are used to compute weighted summations of the information from one sequence that is relevant to a single token in the other.
530
+
531
+ $$
532
+ \begin{array} { r l r } { S _ { c q } ^ { \top } C _ { i n d } = C _ { s u m } \in \mathbb { R } ^ { ( m + 1 ) \times d } } & { { } } & { S _ { q c } ^ { \top } Q _ { i n d } = Q _ { s u m } \in \mathbb { R } ^ { ( l + 1 ) \times d } } \end{array}
533
+ $$
534
+
535
+ The coattended representations use the same weights to transfer information gained from alignments back to the original sequences:
536
+
537
+ $$
538
+ S _ { q c } ^ { \top } C _ { s u m } = C _ { c o a } \in \mathbb { R } ^ { ( l + 1 ) \times d } \qquad S _ { c q } ^ { \top } Q _ { s u m } = Q _ { c o a } \in \mathbb { R } ^ { ( m + 1 ) \times d }
539
+ $$
540
+
541
+ The first column of the summation and coattentive representations correspond to the dummy embeddings. This information is not needed, so we drop that column of the matrices to get $C _ { c o a } \in \mathbb { R } ^ { l \times d }$ and $Q _ { c o a } \in \mathbb { R } ^ { m \times d }$ .
542
+
543
+ Compression. In order to compress information from dual coattention back to the more manageable dimension $d$ , we concatenate all four prior representations for each sequence along the last dimension and feed into separate BiLSTMs:
544
+
545
+ $$
546
+ \begin{array} { r l r } & { } & { \mathrm { B i L S T M } _ { c o m C } ( [ C _ { p r o j } ; C _ { i n d } ; Q _ { s u m } ; C _ { c o a } ] ) = C _ { c o m } \in \mathbb { R } ^ { l \times d } } \\ & { } & { \mathrm { B i L S T M } _ { c o m Q } ( [ Q _ { p r o j } ; Q _ { i n d } ; C _ { s u m } ; Q _ { c o a } ] ) = Q _ { c o m } \in \mathbb { R } ^ { m \times d } } \end{array}
547
+ $$
548
+
549
+ Self-Attention. Next, we use multi-head, scaled dot-product attention (Vaswani et al., 2017) to capture long distance dependencies within each sequence. Let
550
+
551
+ $$
552
+ \operatorname { A t t e n t i o n } ( { \tilde { X } } , { \tilde { Y } } , { \tilde { Z } } ) = \operatorname { s o f t m a x } \left( { \frac { { \tilde { X } } { \tilde { Y } } ^ { \top } } { \sqrt { d } } } \right) { \tilde { Z } }
553
+ $$
554
+
555
+ MultiHe $\operatorname { a d } ( X , Y , Z ) = [ h _ { 1 } ; \cdots ; h _ { p } ] W _ { o } \qquad \operatorname { w h e r e } h _ { j } = \operatorname { A t t e n t i o n } ( X W _ { j } ^ { X } , Y W _ { j } ^ { Y } , Z W _ { j } ^ { Z } )$ (23) All linear transformations in Eq. equation 23 project to $d$ so that multi-head attention representations maintain dimensionality:
556
+
557
+ $$
558
+ \mathbf { M u l t i H e a d } _ { C } ( C _ { c o m } , C _ { c o m } , C _ { c o m } ) = C _ { m h a } \qquad \mathbf { M u l t i H e a d } _ { Q } ( Q _ { c o m } , Q _ { c o m } , Q _ { c o m } ) = Q _ { m h a }
559
+ $$
560
+
561
+ We then use projected, residual feedforward networks (FFN) with ReLU activations (Nair and Hinton, 2010; Vaswani et al., 2017) and layer normalization (Ba et al., 2016) on the inputs and outputs. With parameters $U \in \mathbb { R } ^ { d \times f }$ and $V \in \bar { \mathbb { R } ^ { f \times d } }$ :
562
+
563
+ $$
564
+ F F N ( X ) = \operatorname* { m a x } ( 0 , X U ) V + X
565
+ $$
566
+
567
+ $$
568
+ F F N _ { C } ( C _ { c o m } + C _ { m h a } ) = C _ { s e l f } \in \mathbb { R } ^ { l \times d } \qquad F F N _ { Q } ( Q _ { c o m } + Q _ { m h a } ) = Q _ { s e l f } \in \mathbb { R } ^ { m \times d }
569
+ $$
570
+
571
+ Final Encoding. Finally, we aggregate all of this information across time with two BiLSTMs:
572
+
573
+ $$
574
+ \mathrm { B i L S T M } _ { f i n C } ( C _ { s e l f } ) = C _ { f i n } \in \mathbb { R } ^ { l \times d } \qquad \mathrm { B i L S T M } _ { f i n Q } ( Q _ { s e l f } ) = Q _ { f i n } \in \mathbb { R } ^ { m \times d }
575
+ $$
576
+
577
+ These matrices are given to the decoder to generate the answer.
578
+
579
+ # F CURRICULUM LEARNING
580
+
581
+ For multitask training, we experiment with various round-robin batch-level sampling strategies.
582
+
583
+ The first strategy we consider is fully joint. In this strategy, batches are sampled round-robin from all tasks in a fixed order from the start of training to the end. This strategy performed well on tasks that required fewer iterations to converge during single-task training (see Table 3), but the model struggles to reach single-task performance for several other tasks. In fact, we found a correlation between the performance gap between single and multitasking settings of any given task and number of iterations required for convergence for that task in the single-task setting.
584
+
585
+ With this in mind, we experimented with several anti-curriculum schedules Bengio et al. (2009). These training strategies all consist of two phases. In the first phase, only a subset of the tasks are trained jointly, and these are typically the ones that are more difficult. In the second phase, all tasks are trained according to the fully joint strategy.
586
+
587
+ We first experimented with isolating SQuAD in the first phase, and the switching to fully joint training over all tasks. Since we take a question answering approach to all tasks, we were motivated by the idea of pretraining on SQuAD before being exposed to other kinds of question answering. This would teach the model how to use the multi-context decoder to properly retrieve information from the context before needing to learn how to switch between tasks or generate words on its own. Additionally, pretraining on SQuAD had already been shown to improve performance for NLI (Min et al., 2017). Empirically, we found that this motivation is well-placed and that this strategy outperforms all others that we considered in terms of the decaScore. This strategy sacrificed performance on IWSLT but recovered the lost decaScore on other tasks, especially those which use pointers.
588
+
589
+ To explore if adding additional tasks to the initial curriculum would improve performance further, we experimented with adding IWSLT and CNN/DM to the first phase and in another experiment, adding IWSLT, CNN/DM and MNLI. These are tasks with a large number of training examples relative to the other tasks, and they contain the longest answer sequences. Further, they form a diverse set since they encourage the model to decode in different ways such as the vocabulary for IWSLT, context-pointer for SQuAD and CNN/DM, and question-pointer for MNLI. In our results, we however found no improvement by adding these tasks. In fact, in the case when we added SQuAD, IWSLT, CNN/DM and MNLI to the initial curriculum, we observed a marked degradation in performance of some other tasks including QA-SRL, WikiSQL and MWSC. This suggests that it is concordance between the question answering nature of the task and SQuAD that enabled improved outcomes and not necessarily the richness of the task.
590
+
591
+ Finally, as a check to our hypothesis, we also tried a curriculum schedule that used SST, QA-SRL, QA-ZRE, WOZ, WikiSQL and MWSC in the initial curriculum. This effectively takes the easiest tasks and trains on those first. This was indubitably an inferior strategy; not only does the model perform worse on tasks that were not in the initial curriculum, especially SQuAD and IWSLT, it also performs worse on the tasks that were. Finding that anti-curriculum learning benefited models in the decaNLP also validated intuitions outlined in (Caruana, 1997): tasks that are easily learned may not lead to development of internal representations that are useful to other tasks. Our results actually suggest a stronger claim: including easy tasks early on in training makes it more difficult to learn internal representations that are useful to other tasks.
592
+
593
+ We note in passing that the results above underscores the challenges and trade-offs in the multitasking setting. By ordering the tasks differently, it is possible to improve performance on some of the tasks but that improvement is not without a concomitant drop in performance for others. Indeed, a gap still exists between single-task performance and the results above. The question of how this gap can be bridged is a topic of continued research.
594
+
595
+ Table 3: Validation metrics for MQAN using various training strategies. The first is fully joint, which samples batches round-robin from all tasks. Others first use a curriculum or anti-curriculum schedule over a subset of tasks before switching to fully joint over all tasks. Curriculum first trains tasks that take relatively few iterations to converge when trained alone. This omits SQuAD, IWSLT, CNN/DM, and MNLI. The remaining strategies are anti-curriculum. They include in the first phase either SQuAD alone, SQuAD, IWSLT, and CNN/DM, or SQuAD, IWSLT, CNN/DM, and MNLI.
596
+
597
+ <table><tr><td colspan="3"></td><td colspan="3">Anti-Curriculum</td></tr><tr><td>Dataset</td><td>Fully Joint</td><td>Curriculum</td><td>SQuAD</td><td>+IWSLT+CNN/DM</td><td>+MNLI</td></tr><tr><td> SQuAD</td><td>70.8</td><td>43.4</td><td>74.3</td><td>74.5</td><td>74.6</td></tr><tr><td>IWSLT</td><td>16.1</td><td>4.3</td><td>13.7</td><td>18.7</td><td>19.0</td></tr><tr><td>CNN/DM</td><td>23.9</td><td>21.3</td><td>24.6</td><td>20.8</td><td>21.6</td></tr><tr><td>MNLI</td><td>70.5</td><td>58.9</td><td>69.2</td><td>69.6</td><td>72.7</td></tr><tr><td>SST</td><td>86.2</td><td>84.5</td><td>86.4</td><td>83.6</td><td>86.8</td></tr><tr><td>QA-SRL</td><td>75.8</td><td>70.6</td><td>77.6</td><td>77.5</td><td>75.1</td></tr><tr><td>QA-ZRE</td><td>28.0</td><td>24.6</td><td>34.7</td><td>30.1</td><td>37.7</td></tr><tr><td>WOZ</td><td>80.6</td><td>81.9</td><td>84.1</td><td>81.7</td><td>85.6</td></tr><tr><td>WikiSQL</td><td>62.0</td><td>68.6</td><td>58.7</td><td>54.8</td><td>42.6</td></tr><tr><td>MWSC</td><td>48.8</td><td>41.5</td><td>48.4</td><td>34.9</td><td>41.5</td></tr><tr><td>decaScore</td><td>562.7</td><td>499.6</td><td>571.7</td><td>546.2</td><td>557.2</td></tr></table>
598
+
599
+ G EXPANDED RESULTS
600
+
601
+ <table><tr><td>dreeeTS 4181 4 30 0&#x27;611 10 260 40 34 10 1I JSMS 20 00 00 0 30 3 1 00 1 3555 WTPTI 00 00 00 00 00 00 00 0 1 00 ZOM</td></tr><tr><td>00 00 00 00 00 00 00 32 00 0 88 3 00 0 n 4 40 1 0 4 4</td></tr><tr><td>DAZ-AE 30 DAS-SI 5 8 5 00 00 2 34 1 8 0 3 ST 00 00 00 30 8 00 00 00 0 50 38</td></tr><tr><td>IINW 00 00 00 4 3 00 00 00 8 40 JI/NNN 6 3 2 9 00 7 4 00 40 00 4 JISMI 24 2 0 00 00 0 00 00 3 00 10</td></tr></table>
602
+
603
+ <table><tr><td>1181 2 0 7 8.444 2 55.59 8 £&#x27;801 3 IeveN</td></tr><tr><td>1 00 00 00 30 59 n 00 00 8 8</td></tr><tr><td>00 0 00 00 00 00 00 00 35 0 48</td></tr><tr><td>00 00 00 00 00 00 00 8 00 00 8</td></tr><tr><td>36 00 00 00 30 23 00 0 4 3</td></tr><tr><td>51 8 2 00 00 24 4 5 0 34</td></tr><tr><td>00 00 00 3 8 00 00 00 00 50 8 ss 00 00 00 30 8 8 00 00 00 21 15 3</td></tr></table>
604
+
605
+ # H MODEL VISUALIZATION
606
+
607
+ Given that our networks are trained jointly, it is unclear whether the capacity of the network is implicitly provisioned for each task, or if there is sharing of neurons across tasks. To investigate this question, in Figure 5 we plot the activations of neurons at two encoder layers for both the context and question arms. For this experiment, we pick one representative example for 6 tasks and plot activations for all neurons at two layers: the output of the co-attention, and the final activations which are fed to the decoder. We use a trained MQAN model for this inference. As can be seen from the figure, there is a discernible pattern in the activations for the first layer of both arms but not for the deeper layer. The former is expected given that the co-attention tends to underscore weights that appear in both question and context. However, the lack of a discernible pattern in the deeper layer alludes to the notion that the capacity is not provisioned but shared.
608
+
609
+ ![](images/87625576614a33cc7ae541fa59c628337ee0467eb83809651f1b13a198548268.jpg)
610
+ Figure 5: Visualization of encoder activations for a set of 6 (question, answer) pairs in the order: question answering, machine translation, summarization, natural language inference, and commonsense reasoning. x-axis for each block represents time, and y-axis denotes neurons in the layer.
611
+
612
+ In Figures 6 and 7, we plot the attention weights of the model over the context and question. The results are as one would expect, and are similar to those when training in single-task mode. It is evident from the figure that for most classification problems, there is a hard attention weight over the chosen (correct) answer.
613
+
614
+ ![](images/58435ded05ffe4f314a1b6ee59586eb2a0b2b5dfe7c1bbd778a5591dbd8aaa87.jpg)
615
+
616
+ (a) Attention weights over the context at timestep 0 (b) Attention weights over the context at timestep 1 (a) Attention weights over the question at timestep 0 (b) Attention weights over the question at timestep 1
617
+
618
+ ![](images/11b82375b968907545723bd8434ebb9cf53437afbc2b8cfc47c1a772aad15b47.jpg)
619
+
620
+ ![](images/f6b699f88f2fc2c0e0ac6d72fd8958ad25f843fe68b63990a2e222bcd2344ac7.jpg)
621
+ (c) Attention weights over the context at timestep 2
622
+ Figure 6: Visualization of attention weights over the context for a set of 6 (question, answer) pairs in the order: question answering, machine translation, summarization, natural language inference, and commonsense reasoning. $\mathbf { X } ^ { } -$ -axis for each block represents time.
623
+
624
+ ![](images/dfc0a0f9dd0b241122868921d57ee02f31d091ea4e5f75c1a1d9009c3bd1e174.jpg)
625
+
626
+ ![](images/5bca99347dbcc0cdbf213c006420673a94bbc80cc0dd7f9f02eb505f6fa899d1.jpg)
627
+
628
+ ![](images/656d42ac5267340e86c209f901ead5d6239f6c67614b833e8971a0d58f8dd6e2.jpg)
629
+ (c) Attention weights over the question at timestep 2
630
+ Figure 7: Visualization of attention weights over the question for a set of 6 (question, answer) pairs in the order: question answering, machine translation, summarization, natural language inference, and commonsense reasoning. x-axis for each block represents time.
md/train/B1x8anVFPr/B1x8anVFPr.md ADDED
@@ -0,0 +1,617 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ON LAYER NORMALIZATION IN THE TRANSFORMERARCHITECTURE
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ The Transformer architecture is popularly used in natural language processing tasks. To train a Transformer model, a carefully designed learning rate warm-up stage is usually needed: the learning rate has to be set to an extremely small value at the beginning of the optimization and then gradually increases in some given number of iterations. Such a stage is shown to be crucial to the final performance and brings more hyper-parameter tunings. In this paper, we study why the learning rate warm-up stage is important in training the Transformer and theoretically show that the location of layer normalization matters. It can be proved that at the beginning of the optimization, for the original Transformer, which places the layer normalization between the residual blocks, the expected gradients of the parameters near the output layer are large. Then using a large learning rate on those gradients makes the training unstable. The warm-up stage is practically helpful to avoid this problem. Such an analysis motivates us to investigate a slightly modified Transformer architecture which locates the layer normalization inside the residual blocks. We show that the gradients in this Transformer architecture are well-behaved at initialization. Given these findings, we are the first to show that this Transformer variant is easier and faster to train. The learning rate warm-up stage can be safely removed, and the training time can be largely reduced on a wide range of applications.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ The Transformer is one of the most commonly used neural network architectures in natural language processing, and layer normalization is one of the key components in the Transformer. The originally designed Transformer places the layer normalization between the residual blocks, which is usually referred to as the Transformer with Post-Layer Normalization (Post-LN). This architecture has achieved state-of-the-art performance in many tasks including language modeling (Dai et al., 2019; Al-Rfou et al., 2018) and machine translation (Vaswani et al., 2017; Dehghani et al., 2018; Edunov et al., 2018). Unsupervised pre-trained models based on the Post-LN Transformer architecture also show impressive performance in many downstream tasks (Radford et al., 2019; Devlin et al., 2018; Yang et al., 2019).
12
+
13
+ Although it achieves great success, people usually need to deal with the optimization of the PostLN Transformer more carefully than convolutional networks (He et al., 2016; Tan & Le, 2019) or other sequence-to-sequence models (Sutskever et al., 2014; Gehring et al., 2017). In particular, to train the model from scratch, any gradient-based optimization approach requires a learning rate warm-up stage: The optimization starts from using an extremely small learning rate, e.g., $1 e ^ { - \tilde { 7 } }$ , an d then gradually increases it to a pre-defined maximum value in a pre-defined number of iterations. After that, the learning rate decays similar to the optimization of other architectures. Both previous works (Vaswani et al., 2017; Popel & Bojar, 2018), as well as our empirical study, show that such a warm-up stage is essential in training the models. Furthermore, the final model performance is quite sensitive to the value of the maximum learning rate and the number of warm-up iterations. Tuning such sensitive hyper-parameters is costly in training large-scale models, e.g., BERT (Devlin et al., 2018) or XLNet (Yang et al., 2019).
14
+
15
+ In this paper, we study why the learning rate warm-up stage is essential in the optimization of the Post-LN Transformer and find it is closely related to the position of the layer normalization. As the warm-up stage happens in the first several iterations, we investigate the optimization behavior at initialization of the Post-LN Transformer. According to our theoretical analysis, when putting the layer normalization between the residual blocks, the expected gradients of the parameters near the output layer are large. Therefore, without the warm-up stage, directly using a large learning rate to those parameters may not lead to an improved model and can even make the optimization process unstable. Using a warm-up stage and training the model from small learning rates practically avoid this problem.
16
+
17
+ As the location of the layer normalization plays a crucial role in controlling the gradient scales, we investigate whether there are some other ways of positioning the layer normalization that lead to better-normalized gradients. In particular, we study another variant, the Transformer with Pre-Layer Normalization (Pre-LN) (Klein et al., 2018). The Pre-LN Transformer puts the layer normalization inside the residual connection and equips with an additional finallayer normalization before prediction (Please see Figure 1 for the differences between the two variants of the Transformer architectures). In this paper, we show that the gradients are wellbehaved without any exploding or vanishing at initialization for the Pre-LN Transformer both theoretically and empirically.
18
+
19
+ Given the gradients are well-behaved in the PreLN Transformer, it is natural to consider removing the learning rate warm-up stage during training. We conduct extensive experiments, including IWSLT14 German-English translation, WMT14 English-German translation, and BERT pre-training tasks. We show that, in all tasks, the learning rate warm-up stage can be safely removed and thus, the number of hyper
20
+
21
+ ![](images/e2f42f6b933e8c8133b631ba833589f3d8d9cc973ab1faf038b728f3e21c1800.jpg)
22
+ Figure 1: (a) Post-LN Transformer layer; (b) PreLN Transformer layer.
23
+
24
+ parameter is reduced. Furthermore, we observe that the loss decays faster for the Pre-LN Transformer model. It can achieve comparable final performances but use much less training time. This is particularly important for training large-scale models on large-scale datasets.
25
+
26
+ Our contributions are summarized as follows: First, we investigate two Transformer variants, the Post-LN Transformer and the Pre-LN Transformer. By studying the gradients at initialization, we show why the learning rate warm-up stage is essential in training the Post-LN Transformer. Second, we are the first to show that the learning-rate warm-up stage can be removed for the Pre-LN Transformer. By using proper learning rate schedulers, the training time can be largely reduced.
27
+
28
+ # 2 RELATED WORK
29
+
30
+ Gradient descent-based methods (Kingma & Ba, 2014; Zeiler, 2012; Duchi et al., 2011; Tieleman & Hinton, 2012) are popularly used in optimizing deep neural networks. For convolutional neural networks and recurrent neural networks, a relatively large learning rate is usually set in the beginning, and then decays along with the optimization process (He et al., 2016; 2017; Sutskever et al., 2014; Gehring et al., 2017; He et al., 2019). The learning rate warm-up stage has been shown to be essential in dealing with some specific problems, e.g., the large-batch training. Goyal et al. (2017); He et al. (2019) and You et al. (2018) showed that when training neural networks with extremely large batch sizes (e.g., 8k in ImageNet), optimizing the model with a large learning rate in the beginning usually leads to poor performance. Training with a learning rate warm-up stage can eliminate the performance gap.
31
+
32
+ However, when optimizing the Post-LN Transformer models, as far as we know, in almost all previous works (Vaswani et al., 2017; Devlin et al., 2018; Dai et al., 2019; Radford et al., 2019; Lu et al., 2019), the learning rate warm-up stage is essential and critical for training. Popel & Bojar (2018) investigated the influence of different warm-up strategies for the optimization of the Post-LN Transformer model and found that without or with relatively less warm-up iterations (e.g., 12k in $\mathbf { C } \mathbf { Z }$ -En translation), the optimization diverges.
33
+
34
+ In a concurrent and independent work (Liu et al., 2019a), the authors claimed that the benefit of the warm-up stage comes from reducing the variance for the adaptive learning rate in the Adam optimizer (Kingma & Ba, 2014). They proposed to rectify the variance of adaptive learning rate by a new variant of Adam called RAdam. However, we identify the problem from the parameter initialization. We show that for the Post-LN Transformer, the scales of gradients of some parameters at initialization are large. First-order optimizers take the gradients as input. Using such gradients on these optimizers (not limit to Adam) with a large learning rate may make the optimization unstable and hurt the final performance.
35
+
36
+ # 3 OPTIMIZATION FOR THE TRANSFORMER
37
+
38
+ # 3.1 THE TRANSFORMER ARCHITECTURE WITH POST-LAYER NORMALIZATION
39
+
40
+ The Transformer architecture usually consists of stacked Transformer layers (Vaswani et al., 2017; Devlin et al., 2018), each of which takes a sequence of vectors as input and outputs a new sequence of vectors with the same shape. A Transformer layer has two sub-layers: the (multi-head) selfattention sub-layer and the position-wise feed-forward network sub-layer. Residual connection (He et al., 2016) and layer normalization (Lei Ba et al., 2016) are applied for both sub-layers individually. We first introduce each component of the Transformer layer and then present the entire architecture.
41
+
42
+ Self-attention sub-layer An attention function can be formulated as querying an entry with keyvalue pairs (Vaswani et al., 2017). The self-attention sub-layer uses scaled dot-product attention, which is defined as: Attention $\begin{array} { r } { ( Q , K , V ) = \mathrm { s o f t m a x } ( \frac { Q K ^ { T } } { \sqrt { d } } ) V } \end{array}$ , where $d$ is the dimensionality of the hidden representations, and $Q$ (Query), $K$ (Key), $V$ (Value) are specified as the hidden representations of the previous layer. The multi-head variant of the self-attention sub-layer is popularly used which allows the model to jointly attend to information from different representation sub-spaces, and is defined as
43
+
44
+ $$
45
+ \begin{array} { r } { \begin{array} { r } { \mathbf { M u l t i - h e a d } ( Q , K , V ) = \mathbf { C o n c a t } ( \mathrm { h e a d } _ { 1 } , \cdot \cdot \cdot , \mathrm { h e a d } _ { H } ) W ^ { O } , } \\ { \mathbf { h e a d } _ { k } = \mathbf { A t t e n t i o n } ( Q W _ { k } ^ { Q } , K W _ { k } ^ { K } , V W _ { k } ^ { V } ) , } \end{array} } \end{array}
46
+ $$
47
+
48
+ where $W _ { k } ^ { Q } \in \mathbb { R } ^ { d \times d _ { K } } , W _ { k } ^ { K } \in \mathbb { R } ^ { d \times d _ { K } } , W _ { k } ^ { V } \in \mathbb { R } ^ { d \times d _ { V } }$ , and $W ^ { O } \in \mathbb { R } ^ { H d _ { V } \times d }$ are project parameter matrices, $H$ is the number of heads. $d _ { K }$ and $d _ { V }$ are the dimensionalities of Key and Value. Without any confusion, given a sequence of vectors $( x _ { 1 } , . . . , x _ { n } )$ , we use MultiHeadA $\operatorname { t t } ( x _ { i } , [ x _ { 1 } , x _ { 2 } , \cdot \cdot \cdot , x _ { n } ] )$ as the multi-head self-attention mechanism on position $i$ which considers the attention from $x _ { i }$ to the entire sequence.
49
+
50
+ Position-wise FFN sub-layer In addition to the self-attention sub-layer, each Transformer layer contains a fully connected network, which is applied to each position separately and identically. This sub-layer is a two-layer feed-forward network with a ReLU activation function. Given a sequence of vectors $h _ { 1 } , . . . , h _ { n }$ , the computation of a position-wise FFN sub-layer on any $h _ { i }$ is defined as:
51
+
52
+ $$
53
+ \begin{array} { r } { \mathrm { F F N } ( h _ { i } ) = \mathrm { R e L U } ( h _ { i } W ^ { 1 } + b ^ { 1 } ) W ^ { 2 } + b ^ { 2 } , } \end{array}
54
+ $$
55
+
56
+ where $W ^ { 1 } , W ^ { 2 } ,$ $b ^ { 1 }$ and $b ^ { 2 }$ are parameters.
57
+
58
+ Residual connection and layer normalization Besides the two sub-layers described above, the residual connection and layer normalization are also key components to the Transformer. For any vector $v$ , the layer normalization is computed as LayerNorm $\begin{array} { r } { \dot { \mathbf { \rho } } ( v ) = \gamma \frac { v - \mu } { \sigma } + \beta } \end{array}$ , in which $\mu , \sigma$ are the mean and standard deviation of the elements in $v$ , i.e., $\begin{array} { r } { \mu = \frac { 1 } { d } \sum _ { k = 1 } ^ { d } v _ { k } } \end{array}$ σ and $\begin{array} { r } { \sigma ^ { 2 } = \frac { 1 } { d } \sum _ { k = 1 } ^ { d } ( v _ { k } - \mu ) ^ { 2 } } \end{array}$ Scale $\gamma$ and bias vector $\beta$ are parameters.
59
+
60
+ Different orders of the sub-layers, residual connection and layer normalization in a Transformer layer lead to variants of Transformer architectures. One of the original and most popularly used architecture for the Transformer and BERT (Vaswani et al., 2017; Devlin et al., 2018) follows “selfattention (FFN) sub-layer residual connection layer normalization”, which we call the Transformer with Post-Layer normalization (Post-LN Transformer), as illustrated in Figure 1.
61
+
62
+ Table 1: Post-LN Transformer v.s. Pre-LN Transformer
63
+
64
+ <table><tr><td>Post-LN Transformer</td><td>Pre-LN Transformer</td></tr><tr><td>post , , xi post +xi post,1</td><td>=LayerNorm( ,xi,n pre,1j) ,</td></tr><tr><td>=LayerNorm(: +b1,)W2, +62,l</td><td>= xi rpre +x pre,2</td></tr><tr><td>=ReLU(</td><td></td></tr><tr><td>w LayerNorm(</td><td>二 ReLU(a m</td></tr></table>
65
+
66
+ Post-LN Transformer Denote $x _ { l , i }$ as the input of the $l$ -th Transformer layer at position $i$ , where $x _ { l , i }$ is a real-valued vector of dimension d, $i = 1 , 2 , . . . , n$ , $l = 1 , 2 , . . . , L$ . $n$ is the length of the sequence and $L$ is the number of layers. For completeness, we define $x _ { 0 , i }$ as the input embedding at position $i$ which is usually a combination of word embedding and positional embedding. The computations inside the $l$ -th Post-LN Transformer layer are composed of several steps, and we use super-scripts on $x$ to present the input(output) of different steps as in Table 1 (left), where $W ^ { 1 , l }$ , $W ^ { 2 , l }$ , $b ^ { 1 , l }$ and $b ^ { 2 , l }$ are parameters of the FFN sub-layer in the $l$ -th layer.
67
+
68
+ # 3.2 THE IMPORTANCE OF THE WARM-UP STAGE IN TRAINING THE POST-LN TRANSFORMER
69
+
70
+ We are interested in the learning rate warm-up stage in the optimization of the Post-LN Transformer. Different from the optimization of many other architectures in which the learning rate starts from a relatively large value and then decays (Bahdanau et al., 2017; He et al., 2016; Dauphin et al., 2017), a learning rate warm-up stage for the Post-LN Transformer is critical. Specifically, denote the learning rate of the $t$ -th iteration as $\mathbf { l r } ( t )$ . Denote the maximum learning rate during training as $\mathrm { l r } _ { m a x }$ . Given a predefined time frame $T _ { \mathrm { w a r m u p } }$ , the learning rate scheduler for the first $T _ { \mathrm { w a r m u p } }$ iterations is defined as (Vaswani et al., 2018)
71
+
72
+ $$
73
+ \mathbf { l r } ( t ) = \frac { t } { T _ { \mathrm { w a r m u p } } } \mathbf { l r } _ { m a x } , t \leq T _ { \mathrm { w a r m u p } } .
74
+ $$
75
+
76
+ After this warm-up stage, the learning rate will be set by classical learning rate schedulers, such as the linear decay, the inverse square-root decay, or forced decay at particular iterations. As we can see from Eqn (4) , at the beginning of the training, the learning rate starts from zero1 and then linearly increases to $\mathrm { l r } _ { m a x }$ in $T _ { \mathrm { w a r m u p } }$ iterations. We conduct experiments to show that this learning rate warm-up stage is essential for training Post-LN Transformer models.
77
+
78
+ Setting We study the optimization process on the IWSLT14 German-to-English (De-En) machine translation task. We mainly investigate two aspects: whether the learning rate warm-up stage is essential and whether the final model performance is sensitive to the value of $T _ { \mathrm { w a r m u p } }$ . To study the first aspect, we train the model with the Adam optimizer (Kingma & Ba, 2014) and the vanilla SGD optimizer (Ruder, 2016) respectively. For both optimziers, we check whether the warm-up stage can be removed. We follow (Vaswani et al., 2017) to set hyper-parameter $\beta$ to be $( 0 . 9 , 0 . 9 8 )$ in Adam. We also test different $\mathrm { l r } _ { m a x }$ for both optimizers. For Adam, we set $\mathrm { l r } _ { m a x } = 5 \dot { e } ^ { - 4 }$ or $1 e ^ { - 3 }$ , and for SGD, we set $\mathrm { l r } _ { m a x } = 5 e ^ { - 3 }$ or $1 e ^ { - 3 }$ . When the warm-up stage is used, we set $T _ { \mathrm { w a r m u p } } = 4 0 0 0$ as suggested by the original paper (Vaswani et al., 2017). To study the second aspect, we set Twarmup to be $1 / 5 0 0 / 4 0 0 0$ (“1” refers to the no warm-up setting) and use $\mathrm { l r } _ { m a x } = 5 e ^ { - 4 }$ or $1 e ^ { - 3 }$ with Adam. For all experiments, a same inverse square root learning rate scheduler is used after the warm-up stage. We use both validation loss and BLEU (Papineni et al., 2002) as the evaluation measure of the model performance. All other details can be found in the Appendix.
79
+
80
+ ![](images/b378aaa2bb6ff9bc094809b6f4b44c07882e2ea21f91acd08031a4d73db0ee09.jpg)
81
+ Figure 2: Performances of the models optimized by Adam and SGD on the IWSLT14 De-En task.
82
+
83
+ Result We record the model checkpoints for every epoch during training and calculate the validation loss and BLEU score. The performance of the models trained with Adam and SGD are plotted in Figure 2(a) and Figure 2(b). The x-axis is the epoch number and the y-axis is the BLEU score/validation loss. ”w/o warm-up” indicates “without the warm-up stage” while ”w/ warm-up” indicates “with the warm-up stage”.
84
+
85
+ First, we can see that for both optimizers, the learning rate warm-up stage is essential. Without the warm-up stage, the BLEU score of the model trained with Adam optimizer can only achieve 8.45. As a comparison, the model trained using the warm-up stage can achieve around 34 in terms of BLEU score. The same trend can be also observed on the validation loss curves. Although the performance of the model trained with SGD is significantly worse than Adam, we can still see similar phenomena as Adam. The BLEU score is just above zero in 15 epochs without using the warm-up stage.
86
+
87
+ Second, we can see that the optimization process is sensitive to the value of $T _ { \mathrm { w a r m u p } }$ , which means $T _ { \mathrm { w a r m u p } }$ is an important hyper-parameter in training the Post-LN Transformer. For example, when setting $T _ { \mathrm { w a r m u p } } = 5 0 0$ , the learned models with Adam achieve only 31.16 and 2.77 in term of BLEU score for $l r _ { m a x } = 5 e ^ { - 4 }$ and $1 e ^ { - 3 }$ respectively 2 .
88
+
89
+ Discussion First, we can see that the learning rate warm-up stage significantly helps the optimization of the Post-LN Transformer and also significantly affects the final performance. Such a warm-up stage brings additional efforts on hyper-parameter tuning which is computationally expensive for large-scale NLP tasks. Second, at the beginning of the training, the loss value is usually large. Standard optimization algorithms usually start with a large learning rate for fast convergence. However, when using the warm-up stage, the learning rate has to gradually increase from zero, which may slow down the optimization process. Liu et al. (2019a) suggests that the warm-up stage plays a role in reducing the undesirably significant variance in Adam in the early stage of model training. Based on this, they design a new variant of Adam optimizer, RAdam. However, according to our results, the warm-up stage also helps the training of SGD. This suggests that the benefit of the warm-up stage may be not for a particular optimizer.
90
+
91
+ # 3.3 UNDERSTANDING THE TRANSFORMER AT INITIALIZATION
92
+
93
+ We can see that the Post-LN Transformer cannot be trained with a large learning rate from scratch. This motivates us to investigate what happens at the model initialization. We first introduce the parameter initialization setting for our theoretical analysis and then present our theoretical findings.
94
+
95
+ Notations We denote $\mathcal { L } ( \cdot )$ as the loss function of one position, $\tilde { \mathcal { L } } ( \cdot )$ as the loss function of the whole sequence, $\| \cdot \| _ { 2 }$ and $\| \cdot \| _ { F }$ as the $l _ { 2 }$ norm (spectral norm) and the Frobenius norm, $\operatorname { L N } ( x )$ as the standard layer normalization with scale $\gamma = 1$ and bias $\beta = 0$ , and $\begin{array} { r } { \mathbf { J } _ { L N } ( x ) = \frac { \partial \mathrm { L N } ( x ) } { \partial x } } \end{array}$ as the Jacobian matrix of $\operatorname { L N } ( x )$ . Let $\mathcal { O } ( \cdot )$ denote standard Big-O notation that suppress multiplicative constants.
96
+
97
+ Parameter Initialization There are multiple parameter matrices in each Transformer layer, and most of the parameter matrices are initialized by the Xavier initialization (Glorot & Bengio, 2010). Given a matrix of size $n _ { i n } \times n _ { o u t }$ , the Xavier initialization sets the value of each element by independently sampling from Gaussian distribution N (0, 2nin+nout ) . The bias vectors are usually initialized as zero vectors. The scale $\gamma$ in the layer normalization is set to one.
98
+
99
+ For theoretical analysis, we study a simpler setting. First, we focus on single-head attention instead of the multi-head variant and for all layers, we set the shape of $W ^ { Q , l }$ , $W ^ { K , l }$ , $W ^ { V , l }$ , $W ^ { 1 , l } , W ^ { 2 , l }$ to be $d \times d$ . Second, we initialize the parameter matrices in the self-attention sub-layer $W ^ { Q , l }$ and $W ^ { K , l }$ to be zeroultiHeadAt he attention is a unifcan be simplified as initialization. We test the $\mathfrak { t } ( x _ { l , i } ^ { 1 } , [ x _ { l , 1 } ^ { 1 } , x _ { l , 2 } ^ { 1 } , \cdot \cdot \cdot , x _ { l , n } ^ { 1 ^ { - } } ] )$ $\textstyle { \frac { 1 } { n } } \sum _ { j = 1 } ^ { n } x _ { l , j } W ^ { V , l }$ we assume the input vectors are also sampled from the same Gaussian distribution. This is reasonable since the inputs to the Transformer are linear combinations of word embeddings and learnable positional embeddings, both of which are initialized by Gaussian distributions.
100
+
101
+ Post-LN Transformer v.s. Pre-LN Transformer We compare the Post-LN Transformer with another variant of the Transformer architecture, the Transformer with Pre-Layer Normalization (PreLN). The Pre-LN Transformer was implemented in several systems (Vaswani et al., 2018; Klein et al., 2018; Liu et al., 2019b). Wang et al. (2019) suggested that when stacking more layers, the Pre-LN Transformer is better than its Post-LN counterpart. Different from the Post-LN Transformer that puts the layer normalization between the residual blocks, the Pre-LN Transformer puts the layer normalization inside the residual connection and places it before all other non-linear transformations. Additionally, the Pre-LN Transformer uses a final layer normalization right before the prediction. We provide the mathematical formulations and visualizations of the Post-LN Transformer and the Pre-LN Transformer in Table 1 and Figure 1.
102
+
103
+ For both architectures, each $x _ { L , i }$ passes through a softmax layer to produce a distribution over the dictionary $V$ . The loss function is defined on the softmax distribution. For example, in sequence prediction, the loss function is defined as $\begin{array} { r } { \mathcal { L } ( x _ { L + 1 , i } ^ { p o s t } ) = - \log ( \operatorname { s o f t m a x } _ { y _ { i } } ( W ^ { e m b } x _ { L + 1 , i } ^ { p o s t } ) ) } \end{array}$ bxpostL+1,i)) for the PostLN Trwhere and is t $\begin{array} { r } { \mathcal { L } ( x _ { F i n a l , i } ^ { p r e } ) = - \log ( \operatorname { s o f t m a x } _ { y _ { i } } ( W ^ { e m b } x _ { F i n a l , i } ^ { p r e } ) ) } \end{array}$ for the Pre-LN Transformer,d by the softmax distribution $\operatorname { s o f t m a x } _ { y _ { i } }$ $y _ { i }$
104
+ and $W ^ { e m b }$ is the word embedding matrix. The loss of the whole sequence is an average of the loss on each position. Without loss of generality, we assume that all the derivatives are bounded. We introduce the following concentration property of random variables which will be further used in the theorem.
105
+
106
+ Definition 1. A random variable $Z \ge 0$ is called $( \epsilon , \delta )$ -bounded if with probability at least $1 - \delta$ $\begin{array} { r } { \frac { Z - \mathbb { E } Z } { \mathbb { E } Z } \leq \epsilon , } \end{array}$ , where $\epsilon > 0$ and $0 < \delta < 1$ .
107
+
108
+ Intuitively, if the random variable $Z$ is $( \epsilon , \delta )$ -bounded, then with a high probability its realization will not get too far away from its expectation. For example, if $Y$ is a $d .$ -dimensional standard Gaussian random vector, then $Z = \| Y \| _ { 2 } ^ { 2 }$ is $( \epsilon , \delta )$ -bounded with $\delta = \exp ( - d \epsilon ^ { 2 } / 8 )$ , $0 < \epsilon < 1$ (see Appendix G for details). As parameter matrices in self-attention sub-layers and FFN sub-layers are initialized by Gaussian distributions, if the norm of the hidden states in the Transformer satisfies the concentrated condition above, we have the following theorem to characterize the scale of the gradients.
109
+
110
+ Theorem 1 (Gradients of the last layer 3 in the Transformer). Assume that $\| x _ { L , i } ^ { p o s t , 5 } \| _ { 2 } ^ { 2 } a n d \| x _ { L + 1 , i } ^ { p r e } \| _ { 2 } ^ { 2 }$ are $( \epsilon , \delta )$ -bounded for all $i$ , where $\epsilon$ and $\delta = \delta ( \epsilon )$ are small numbers. Then with probability at least $\begin{array} { r } { 0 . 9 9 - \delta - \frac { \epsilon } { 0 . 9 + \epsilon } } \end{array}$ , for the Post-LN Transformer with $L$ layers, the gradient of the parameters of the last layer satisfies
111
+
112
+ $$
113
+ \lVert \frac { \partial \tilde { \mathcal { L } } } { \partial W ^ { 2 , L } } \rVert _ { F } \leq \mathcal { O } ( d \sqrt { \ln d } )
114
+ $$
115
+
116
+ and for the Pre-LN Transformer with $L$ layers,
117
+
118
+ $$
119
+ \| \frac { \partial \tilde { \mathcal { L } } } { \partial W ^ { 2 , L } } \| _ { F } \leq \mathcal { O } \left( d \sqrt { \frac { \ln d } { L } } \right) .
120
+ $$
121
+
122
+ From Theorem 1, we can see that for the Post-LN Transformer, the scale of the gradients to the last√ FFN layer is of order $\mathcal { O } ( d \sqrt { \ln d } )$ which is independent of $L$ . For the Pre-LN Transformer, the scale of the gradients is much smaller. We first study the forward propagation of the Post-LN Transformer and the Pre-LN Transformer. Lemma 1 will be served as a basic tool to prove the main theorem and other lemmas.
123
+
124
+ Lemma 1. If $X \in \mathbb { R } ^ { d }$ is a Gaussian vector, $X \sim N ( 0 , \sigma ^ { 2 } \mathbf { I } _ { d } )$ , then $\begin{array} { r } { \mathbb { E } ( \| R e L U ( X ) \| _ { 2 } ^ { 2 } ) = \frac { 1 } { 2 } \sigma ^ { 2 } d . } \end{array}$
125
+
126
+ Based on Lemma 1, we have the following lemma to estimate the scale of the hidden states in different layers for the Post-LN Transformer and the Pre-LN Transformer.
127
+
128
+ Lemma 2. At initialization, for the Post-LN Transformer, $\mathbb { E } ( \| x _ { l , i } ^ { p o s t , 5 } \| _ { 2 } ^ { 2 } ) = \textstyle { \frac { 3 } { 2 } } d$ for all $l > 0$ and $i$ . For the Pre-LN Transformer, $\begin{array} { r } { ( 1 + \frac { l } { 2 } ) d \leq \mathbb { E } ( \| x _ { l , i } ^ { p r e } \| _ { 2 } ^ { 2 } ) \leq ( 1 + \frac { 3 l } { 2 } ) d } \end{array}$ for all $l > 0$ and i. Expectations are taken over the input and the randomness of initialization.
129
+
130
+ Lemma 2 studies the expected norm of the hidden states in both Post-LN/Pre-LN Transformer. It is obviously that in the Post-LN Transformer, the norm of $x _ { l , i } ^ { p o s t }$ is $\sqrt { d }$ and thus we study the norm of $x _ { l , i } ^ { p o s t , 5 }$ instead. As we can see from Lemma 2, the scale of the hidden states in the Post-LN Transformer keeps to be the same in expectation while the scale of the hidden states in the Pre-LN Transformer grows linearly along with the depth. The next lemma shows that the scale of the hidden states highly relates to the scale of the gradient in the architectures using layer normalization.
131
+
132
+ Lemma 3. For $x \in \mathbb { R } ^ { d }$ , we have $\begin{array} { r } { \| \mathbf { J } _ { L N } ( x ) \| _ { 2 } = \mathcal { O } ( \frac { \sqrt { d } } { \| x \| _ { 2 } } ) } \end{array}$ in which $\begin{array} { r } { \mathbf { J } _ { L N } ( x ) = \frac { \partial L N ( x ) } { \partial x } . } \end{array}$ .
133
+
134
+ The proof of Lemma 1, Lemma 2, Lemma 3, and Theorem 1 can be found in the Appendix. The main idea is that the layer normalization will normalize the gradients. In the Post-LN Transformer, the scale of the inputs to the layer normalization is independent of $L$ , and thus the gradients of parameters in the last layer are independent of $L$ . While in the Pre-LN Transformer, the scale of the input to the final layer normalization is linear in $L$ , and thus the gradients of all parameters will be normalized by $\sqrt { L }$ .
135
+
136
+ Extending to other layers/parameters We have provided a formal proof on the gradients of the last FFN sub-layer as above. In order to fully understand the optimization, we also make some preliminary analysis for other layers and other parameters. Our main result is that the gradient norm in the Post-LN Transformer is large for the parameters near the output and will be likely to decay as the layer index $l$ decreases. On the contrary, the gradient norm in the Pre- Transformer will be likely to stay the same for any layer $l$ . All the preliminary theoretical results are provided in Appendix F.
137
+
138
+ Empirical study We also conduct experiments to study the gradients at initialization for the PostLN/Pre-LN Transformer in real scenarios. The model and training configuration exactly follows Section 3.2. The experiments are repeated ten times using different random seeds. Given an initialized model, we record the hidden states in the Post-LN/Pre-LN Transformer and find that the norm of the hidden states satisfies the concentration property ((0.1,0.125)- bounded). We also record the gradient for each parameter for different mini-batches. For elements in a parameter matrix, we calculate their expected gradients and use the Frobenius norm of those values as the scale of the expected gradient of the matrix. Figure 3(a) and 3(b) shows those statistics for FFN sub-layers. The $\mathbf { X }$ -axis indexes different Transformer layers. It can be seen from the figure, the scale of the expected gradients grows along with the layer index for the Post-LN Transformer. On the contrary, the scale almost keeps the same for different layers in the Pre-LN Transformer. These observations are consistent with our theoretical findings. More analysis can be found in Appendix H.
139
+
140
+ ![](images/0540376f7c48f6872dc15c1cb7b97bac72957fb5ef0fe70921bb706da643a85a.jpg)
141
+ Figure 3: Norm of expected gradients for Pre-LN/Post-LN Transformer
142
+
143
+ We further study the gradient statistics for the Post-LN Transformer after the warm-up stage with Adam. It can be seen from the figure that the scale of the gradients are very small, and the model can be trained with large learning rates. We believe the gradient scale is one of the reasons that the PostLN Transformer needs a careful learning rate scheduling in the beginning. Since the gradients are large for some layers, using a large learning rate without warm-up may make the training unstable (see Appendix I). As the gradients are well-behaved for the Pre-LN Transformer, we will show that the learning rate warm-up stage can be removed for this model architecture in the next section.
144
+
145
+ # 4 EXPERIMENTS
146
+
147
+ The Pre-LN Transformer has been implemented in several systems (Liu et al., 2019b; Baevski & Auli, 2018), but most of them still follow Vaswani et al. (2017) to use the learning rate warm-up stage. We conduct experiments for the Pre-LN Transformer to test whether the learning rate warmup stage can be removed and how to set learning rate schedulers.
148
+
149
+ # 4.1 EXPERIMENT SETTINGS
150
+
151
+ Machine Translation We conduct our experiments on two widely used tasks: the IWSLT14 German-to-English (De-En) task and the WMT14 English-to-German (En-De) task. For the IWSLT14 De-En task, we use the same model configuration as in Section 3. For the WMT14 En-De task, we use the Transformer base setting. More details can be found in the Appendix.
152
+
153
+ For training the Pre-LN Transformer, we remove the learning rate warm-up stage. On the IWSLT14 De-En task, we set the initial learning rate to be $5 e ^ { - 4 }$ and decay the learning rate at the 8-th epoch by 0.1. On the WMT14 En-De task, we run two experiments in which the initial learning rates are set to be $7 e ^ { - 4 } / 1 . 5 e ^ { - 3 }$ respectively. Both learning rates are decayed at the 6-th epoch followed by the inverse square root learning rate scheduler.
154
+
155
+ We train the Post-LN Transformer using the learning rate warm-up stage as the baseline. In both IWSLT14 De-En task and WMT14 En-De task, we set the number of the warm-up stage to be 4000 following Vaswani et al. (2017) and then use the inverse square root learning rate scheduler. For all experiments above, we use the Adam optimizer and set the hyper-parameter $\beta$ to be (0.9, 0.98). We set $l r _ { m a x }$ as same as the initial learning rates of the Pre-LN Transformer in each corresponding experiment. Since Liu et al. (2019a) suggests that the learning rate warm-up stage can be removed using RAdam, we try this optimizer on the IWSLT14 De-En task. We use linear learning rate decay suggested by Liu et al. (2019a) and keep all other hyper-parameters to be the same as in other experiments.
156
+
157
+ ![](images/964bcf5f6ee10f2c5973ee03474a9bc0b42788e2e810e7a084c39c17cdac3b9b.jpg)
158
+ Figure 4: Performances of the models on the IWSLT14 De-En task and WMT14 En-De task
159
+
160
+ Unsupervised Pre-training (BERT) We follow (Devlin et al., 2018) to use English Wikipedia corpus and BookCorpus for pre-training. As the dataset BookCorpus (Zhu et al., 2015) is no longer freely distributed. We follow the suggestions from (Devlin et al., 2018) to crawl and collect BookCorpus4 on our own. The concatenation of two datasets contains roughly 3.4B words in total, which is comparable with the data corpus used in (Devlin et al., 2018). We randomly split documents into one training set and one validation set. The training-validation ratio for pre-training is 199:1.
161
+
162
+ We use base model configuration in our experiments. Similar to the translation task, we train the Pre-LN BERT without the warm-up stage and compare it with the Post-LN BERT. We follow the same hyper-parameter configuration in Devlin et al. (2018) to train the Post-LN BERT using 10k warm-up steps with $\mathrm { l r } _ { m a x } = \mathrm { 1 } e ^ { - 4 }$ . For the Pre-LN BERT, we use linear learning rate decay starting from $3 e ^ { - 4 }$ without the warm-up stage. We have tried to use a larger learning rate (such as $3 e ^ { - 4 }$ ) for the Post-LN BERT but found the optimization diverged. All experiments are conducted on 32 NVIDIA Tesla P40 GPUs.
163
+
164
+ # 4.2 EXPERIMENT RESULTS
165
+
166
+ Machine Translation We record the model checkpoints for every epoch during training and calculate the validation loss and BLEU score. The performance of the models at different checkpoints are plotted in Figure 4(a) - 4(d).
167
+
168
+ First, as we can see from the figure, the learning rate warm-up stage is not critical anymore for training the Pre-LN Transformer and the performance of the learned model is competitive. For example, on the IWSLT14 De-En task, the BLEU score and validation loss of the Pre-LN Transformer can achieve around 34 and 4, which are comparable with the performance of the Post-LN Transformer.
169
+
170
+ Second, the Pre-LN Transformer converges faster than the Post-LN Transformer using the same $\mathrm { l r } _ { m a x }$ . On the IWSLT14 De-En task, the 9-th checkpoint of the Pre-LN Transformer achieves nearly the same performance (validation loss/BLEU score) as 15-th checkpoint of the Post-LN Transformer. Similar observations can be found in the WMT14 En-De task. The first model checkpoint of the PreLN Transformer can achieve a BLEU score near 20. As a comparison, the BLEU score of the first checkpoint of the Post-LN Transformer is less than 10.
171
+
172
+ Third, compared with RAdam, we find that the change of the position of layer normalization “dominates” the change of the optimizer. According to our experiments on the IWSLT14 De-En task, we can see that although RAdam trains the Post-LN Transformer well without the warm-up stage, it has little difference with Adam when training the Pre-LN Transformer.
173
+
174
+ ![](images/94c6144c2116cfdf10de031fc57bc82b118344cdbee969e8adc45e53b2a07811.jpg)
175
+ Figure 5: Performances of the models on unsupervised pre-training (BERT) and downstream tasks
176
+
177
+ Unsupervised Pre-training (BERT) We record validation loss of the model checkpoints and plot them in Figure 5(a). Similar to the machine translation tasks, the learning rate warm-up stage can be removed for the Pre-LN model. The Pre-LN model can be trained faster. For example, the Post-LN model achieves 1.69 validation loss at $5 0 0 \mathrm { k }$ updates while the Pre-LN model achieves similar validation loss at $7 0 0 \mathrm { k }$ updates, which suggests there is a $40 \%$ speed-up rate. Note that $T _ { w a r m u p }$ (10k) is far less than the acceleration (200k) which suggests the Pre-LN Transformer is easier to optimize using larger learning rates. We also evaluate different model checkpoints on the downstream task MRPC and RTE (more details can be found in the appendix). The experiments results are plotted in Figure 5(b) and 5(c). We can see that the Pre-LN model also converges faster on the downstream tasks.
178
+
179
+ As a summary, the experiments on both machine translation and unsupervised pre-training tasks show that training the Pre-LN Transformer does not rely on the learning rate warm-up stage and can be trained much faster than the Post-LN Transformer.
180
+
181
+ # 5 CONCLUSION AND FUTURE WORK
182
+
183
+ In this paper, we study why the learning rate warm-up stage is important in training the Transformer and show that the location of layer normalization matters. We show that in the original Transformer, which locates the layer normalization outside the residual blocks, the expected gradients of the parameters near the output layer are large at the beginning of the optimization. This leads to an unstable training when using a large learning rate. We further show that the Transformer which locates the layer normalization inside the residual blocks, can be trained without the warm-up stage and converges much faster. In the future, we will investigate other strategies of positioning the layer normalization, as well as the advantage of layer normalization to the Transformer from a theoretical perspective.
184
+
185
+ # REFERENCES
186
+
187
+ Rami Al-Rfou, Dokook Choe, Noah Constant, Mandy Guo, and Llion Jones. Character-level language modeling with deeper self-attention. arXiv preprint arXiv:1808.04444, 2018.
188
+
189
+ Alexei Baevski and Michael Auli. Adaptive input representations for neural language modeling. arXiv preprint arXiv:1809.10853, 2018.
190
+
191
+ Dzmitry Bahdanau, KyungHyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. 2017.
192
+
193
+ Luisa Bentivogli, Ido Dagan, Hoa Trang Dang, Danilo Giampiccolo, and Bernardo. Magnini. The fifth PASCAL recognizing textual entailment challenge. 2009.
194
+
195
+ Zihang Dai, Zhilin Yang, Yiming Yang, William W Cohen, Jaime Carbonell, Quoc V Le, and Ruslan Salakhutdinov. Transformer-xl: Attentive language models beyond a fixed-length context. arXiv preprint arXiv:1901.02860, 2019.
196
+
197
+ Yann N Dauphin, Angela Fan, Michael Auli, and David Grangier. Language modeling with gated convolutional networks. In International Conference on Machine Learning, pp. 933–941, 2017.
198
+
199
+ Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit, and Łukasz Kaiser. Universal transformers. arXiv preprint arXiv:1807.03819, 2018.
200
+
201
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
202
+
203
+ William B Dolan and Chris. Brockett. Automatically constructing a corpus of sentential paraphrases. In Proceedings of the International Workshop on Paraphrasing., 2005.
204
+
205
+ 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.
206
+
207
+ Sergey Edunov, Myle Ott, Michael Auli, and David Grangier. Understanding back-translation at scale. arXiv preprint arXiv:1808.09381, 2018.
208
+
209
+ Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N Dauphin. Convolutional sequence to sequence learning. In International Conference on Machine Learning, pp. 1243– 1252, 2017.
210
+
211
+ Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In Proceedings of the thirteenth international conference on artificial intelligence and statistics, pp. 249–256, 2010.
212
+
213
+ Priya Goyal, Piotr Dollar, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, An-´ drew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch sgd: Training imagenet in 1 hour. arXiv preprint arXiv:1706.02677, 2017.
214
+
215
+ 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.
216
+
217
+ Kaiming He, Georgia Gkioxari, Piotr Dollar, and Ross Girshick. Mask r-cnn. In ´ Proceedings of the IEEE international conference on computer vision, pp. 2961–2969, 2017.
218
+
219
+ Tong He, Zhi Zhang, Hang Zhang, Zhongyue Zhang, Junyuan Xie, and Mu Li. Bag of tricks for image classification with convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 558–567, 2019.
220
+
221
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
222
+
223
+ Guillaume Klein, Yoon Kim, Yuntian Deng, Vincent Nguyen, Jean Senellart, and Alexander Rush. Opennmt: Neural machine translation toolkit. In Proceedings of the 13th Conference of the Association for Machine Translation in the Americas (Volume 1: Research Papers), volume 1, pp. 177–184, 2018.
224
+
225
+ Philipp Koehn, Hieu Hoang, Alexandra Birch, Chris Callison-Burch, Marcello Federico, Nicola Bertoldi, Brooke Cowan, Wade Shen, Christine Moran, Richard Zens, et al. Moses: Open source toolkit for statistical machine translation. In Proceedings of the 45th annual meeting of the association for computational linguistics companion volume proceedings of the demo and poster sessions, pp. 177–180, 2007.
226
+
227
+ Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
228
+
229
+ Liyuan Liu, Haoming Jiang, Pengcheng He, Weizhu Chen, Xiaodong Liu, Jianfeng Gao, and Jiawei Han. On the variance of the adaptive learning rate and beyond. arXiv preprint arXiv:1908.03265, 2019a.
230
+
231
+ 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, 2019b.
232
+
233
+ Yiping Lu, Zhuohan Li, Di He, Zhiqing Sun, Bin Dong, Tao Qin, Liwei Wang, and Tie-Yan Liu. Understanding and improving transformer from a multi-particle dynamic system point of view. arXiv preprint arXiv:1906.02762, 2019.
234
+
235
+ Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th annual meeting on association for computational linguistics, pp. 311–318. Association for Computational Linguistics, 2002.
236
+
237
+ Martin Popel and Ondˇrej Bojar. Training tips for the transformer model. The Prague Bulletin of Mathematical Linguistics, 110(1):43–70, 2018.
238
+
239
+ Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. 2019.
240
+
241
+ Sebastian Ruder. An overview of gradient descent optimization algorithms. arXiv preprint arXiv:1609.04747, 2016.
242
+
243
+ Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. arXiv preprint arXiv:1508.07909, 2015.
244
+
245
+ Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. In ACL, 2016.
246
+
247
+ 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.
248
+
249
+ Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2818–2826, 2016.
250
+
251
+ Mingxing Tan and Quoc V Le. Efficientnet: Rethinking model scaling for convolutional neural networks. arXiv preprint arXiv:1905.11946, 2019.
252
+
253
+ Tijmen Tieleman and Geoffrey Hinton. Lecture 6.5-rmsprop, coursera: Neural networks for machine learning. University of Toronto, Technical Report, 2012.
254
+
255
+ 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.
256
+
257
+ Ashish Vaswani, Samy Bengio, Eugene Brevdo, Francois Chollet, Aidan N. Gomez, Stephan Gouws, Llion Jones, Łukasz Kaiser, Nal Kalchbrenner, Niki Parmar, Ryan Sepassi, Noam Shazeer, and Jakob Uszkoreit. Tensor2tensor for neural machine translation. CoRR, abs/1803.07416, 2018. URL http://arxiv.org/abs/1803.07416.
258
+
259
+ Martin J Wainwright. High-dimensional statistics: A non-asymptotic viewpoint, volume 48. Cambridge University Press, 2019.
260
+
261
+ Qiang Wang, Bei Li, Tong Xiao, Jingbo Zhu, Changliang Li, Derek F Wong, and Lidia S Chao. Learning deep transformer models for machine translation. arXiv preprint arXiv:1906.01787, 2019.
262
+
263
+ Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, and Quoc V Le. Xlnet: Generalized autoregressive pretraining for language understanding. arXiv preprint arXiv:1906.08237, 2019.
264
+
265
+ Yang You, Zhao Zhang, Cho-Jui Hsieh, James Demmel, and Kurt Keutzer. Imagenet training in minutes. In Proceedings of the 47th International Conference on Parallel Processing, pp. 1. ACM, 2018.
266
+
267
+ Matthew D Zeiler. Adadelta: an adaptive learning rate method. arXiv preprint arXiv:1212.5701, 2012.
268
+
269
+ Yukun Zhu, Ryan Kiros, Richard Zemel, Ruslan Salakhutdinov, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. Aligning books and movies: Towards story-like visual explanations by watching movies and reading books. In arXiv preprint arXiv:1506.06724, 2015.
270
+
271
+ # Appendix
272
+
273
+ A EXPERIMENTAL SETTINGS
274
+
275
+ A.1 MACHINE TRANSLATION
276
+
277
+ Experiment on Section 3 The training/validation/test sets of the IWSLT14 German-to-English (De-En) task contain about 153K/7K/7K sentence pairs, respectively. We use a vocabulary of 10K tokens based on a joint source and target byte pair encoding (BPE) (Sennrich et al., 2015). All of our experiments use a Transformer architecture with a 6-layer encoder and 6-layer decoder. The size of embedding is set to 512, the size of hidden nodes in attention sub-layer and position-wise feed-forward network sub-layer are set to 512 and 1024, and the number of heads is set to 4. Label smoothed cross entropy is used as the objective function by setting $\epsilon = 0 . 1$ (Szegedy et al., 2016), and we apply dropout with a ratio 0.1. The batch size is set to be 4096 tokens. When we decode translation results from the model during inference, we set beam size as 5 and the length penalty as 1.2.
278
+
279
+ Experiment on Section 4 The configuration of IWLST14 De-En task is the same as in Section 3. For the WMT14 En-De task, we replicate the setup of (Vaswani et al., 2017), which consists of about $4 . 5 { \mathrm { M } }$ training parallel sentence pairs, and uses a 37K vocabulary based on a joint source and target BPE. Newstest2013 is used as the validation set, and Newstest2014 is used as the test set. One of the basic configurations of the Transformer architecture is the base setting, which consists of a 6-layer encoder and 6-layer decoder. The size of the hidden nodes and embeddings are set to 512. The number of heads is 8. Label smoothed cross entropy is used as the objective function by setting $\epsilon = 0 . 1$ . The batch size is set to be 8192 tokens per GPU on 16 NVIDIA Tesla P40 GPUs.
280
+
281
+ # A.2 UNSUPERVISED PRETRAINING
282
+
283
+ We follow Devlin et al. (2018) to use English Wikipedia corpus and BookCorpus for the pre-training. As the dataset BookCorpus (Zhu et al., 2015) is no longer freely distributed. We follow the suggestions from Devlin et al. (2018) to crawl and collect BookCorpus5 on our own. The concatenation of two datasets includes roughly 3.4B words in total, which is comparable with the data corpus used in Devlin et al. (2018). We first segment documents into sentences with Spacy6; Then, we normalize, lower-case, and tokenize texts using Moses (Koehn et al., 2007) and apply BPE(Sennrich et al., 2016). We randomly split documents into one training set and one validation set. The trainingvalidation ratio for pre-training is 199:1.
284
+
285
+ The base model in Devlin et al. (2018) consists of 12 Transformer layers. The size of hidden nodes and embeddings are set to 768, and the number of heads is set to 12.
286
+
287
+ # A.3 GLUE DATASET
288
+
289
+ MRPC The Microsoft Research Paraphrase Corpus (Dolan & Brockett, 2005) is a corpus of sentence pairs automatically extracted from online news sources, with human annotations for whether the sentences in the pair are semantically equivalent, and the task is to predict the equivalence. The performance is evaluated by the accuracy.
290
+
291
+ RTE The Recognizing Textual Entailment (RTE) datasets come from a series of annual textual entailment challenges (Bentivogli et al., 2009). The task is to predict whether sentences in a sentence pair are entailment. The performance is evaluated by the accuracy.
292
+
293
+ Fine-tuning on GLUE tasks We use the validation set for evaluation. To fine-tune the models, following Devlin et al. (2018); Liu et al. (2019b), we search the optimization hyper-parameters in a search space including different batch sizes (16/32), learning rates $( 1 e ^ { - 5 } - \mathrm { i } \overline { { e } } ^ { - 4 } )$ and number of epochs (3-8). We find that the validation accuracy are sensitive to random seeds, so we repeat fine-tuning on each task for 6 times using different random seeds and compute the $9 5 \%$ confidence interval of validation accuracy.
294
+
295
+ # B PROOF OF LEMMA 1
296
+
297
+ Proof. Denote $\boldsymbol { X } = ( X _ { 1 } , X _ { 2 } , . . . , X _ { d } )$ in which $X _ { i }$ are i.i.d. Gaussian random variables with distri$N ( 0 , \sigma ^ { 2 } )$ $\rho _ { X } ( x )$ $X _ { 1 }$ $\mathbb { E } ( \| \mathbf { R e L U } ( X ) \| _ { 2 } ^ { 2 } ) =$ $\begin{array} { r } { \sum _ { i = 1 } ^ { d } \mathbb { E } [ { \mathrm { R e L U } } ( X _ { i } ) ^ { 2 } ] = \sum _ { i = 1 } ^ { d } \mathbb { E } [ { \mathrm { R e L U } } ( X _ { i } ) ^ { 2 } | X _ { i } \geq 0 ] \mathbb { P } ( X _ { i } \geq 0 ) = \frac { d } { 2 } \mathbb { E } [ { \mathrm { R e L U } } ( X _ { 1 } ) ^ { 2 } | X _ { 1 } \geq 0 ] = } \end{array}$ $\begin{array} { r } { \frac { d } 2 \mathbb { E } [ X _ { 1 } ^ { 2 } | X _ { 1 } \geq 0 ] = \frac { d } { 2 } \int _ { - \infty } ^ { + \infty } x ^ { 2 } \rho _ { X | X > 0 } ( x ) d x = \frac { d } { 2 } \int _ { 0 } ^ { + \infty } x ^ { 2 } 2 \rho _ { X } ( x ) d x = \frac { 1 } { 2 } \sigma ^ { 2 } d } \end{array}$ .
298
+
299
+ # C PROOF OF LEMMA 2
300
+
301
+ Proof. At initialization, the layer normalization is computed as $\textstyle \operatorname { L N } ( v ) = { \frac { v - \mu } { \sigma } }$ . It is easy to see that layer normalization at initialization projects any vector $v$ onto the $d - 1$ -sphere of radius $\sqrt { d }$ since kLN(v)k22 = k v−µσ k22 = Pdk=1(vk−µ)2σ2 .
302
+
303
+ We first estimate the expected $l _ { 2 }$ norm of each intermediate output $x _ { l , i } ^ { p o s t , 1 } , \cdot \cdot \cdot , x _ { l , i } ^ { p o s t , 5 }$ for $l > 0$ . Using Xavier initialization, the elements in are i.i.d. Gaussian random variables sampled from $N ( 0 , 1 / d )$ . Since $\| x _ { l , i } ^ { p o s t } \| _ { 2 } ^ { 2 } = d$ by the definition of Layer Normalization when $l > 0$ , we have
304
+
305
+ $$
306
+ \begin{array} { r l } & { \mathbb { E } ( \| x _ { l , i } ^ { p o s t , 2 } \| _ { 2 } ^ { 2 } ) = \mathbb { E } ( \| x _ { l , i } ^ { p o s t } \| _ { 2 } ^ { 2 } ) + \mathbb { E } ( \| x _ { l , i } ^ { p o s t , 1 } \| _ { 2 } ^ { 2 } ) + 2 \mathbb { E } ( x _ { l , i } ^ { p o s t , 1 } x _ { l , i } ^ { p o s t } ^ { \top } ) } \\ & { \qquad = \mathbb { E } ( \| x _ { l , i } ^ { p o s t } \| _ { 2 } ^ { 2 } ) + \mathbb { E } ( \| x _ { l , i } ^ { p o s t , 1 } \| _ { 2 } ^ { 2 } ) + \displaystyle \frac { 2 } { n } \mathbb { E } ( \sum _ { j = 1 } ^ { n } x _ { l , j } ^ { p o s t } W ^ { V , l } x _ { l , i } ^ { p o s t } ^ { \top } ) } \\ & { \qquad = \mathbb { E } ( \| x _ { l , i } ^ { p o s t } \| _ { 2 } ^ { 2 } ) + \mathbb { E } ( \| x _ { l , i } ^ { p o s t , 1 } \| _ { 2 } ^ { 2 } ) = \mathbb { E } ( \| x _ { l , i } ^ { p o s t } \| _ { 2 } ^ { 2 } ) + \mathbb { E } ( \| \frac { 1 } { n } \sum _ { i = 1 } ^ { n } x _ { l , i } ^ { p o s t } \| _ { 2 } ^ { 2 } ) \leq 2 d } \end{array}
307
+ $$
308
+
309
+ and $\begin{array} { r } { \mathbb { E } ( \| x _ { l , i } ^ { p o s t , 2 } \| _ { 2 } ^ { 2 } ) = \mathbb { E } ( \| x _ { l , i } ^ { p o s t } \| _ { 2 } ^ { 2 } ) + \mathbb { E } ( \| x _ { l , i } ^ { p o s t , 1 } \| _ { 2 } ^ { 2 } ) = \mathbb { E } ( \| x _ { l , i } ^ { p o s t } \| _ { 2 } ^ { 2 } ) + \mathbb { E } ( \| \frac { 1 } { n } \sum _ { i = 1 } ^ { n } x _ { l , i } ^ { p o s t } \| _ { 2 } ^ { 2 } ) \geq } \end{array}$ $\mathbb { E } ( \| x _ { l , i } ^ { p o s t } \| _ { 2 } ^ { 2 } ) = d$ .
310
+
311
+ Similarly, we have $\| x _ { l , i } ^ { p o s t , 3 } \| _ { 2 } ^ { 2 } = d$ by the definition of Layer Normalization. Again, for the ReLU activation function, the elements in $W ^ { 1 , l }$ and $W ^ { 2 , l }$ are i.i.d. Gaussian random variables sampled from $N ( 0 , 1 / d )$ . According to Lemma 1, we have
312
+
313
+ $$
314
+ \begin{array} { r l } & { \mathbb { E } ( \| x _ { l , i } ^ { p o s t , 4 } \| _ { 2 } ^ { 2 } ) = \mathbb { E } ( \| \mathrm { R e L U } ( x _ { l , i } ^ { p o s t , 3 } W ^ { 1 , l } ) W ^ { 2 , l } \| _ { 2 } ^ { 2 } ) } \\ & { \qquad = \mathbb { E } ( \mathbb { E } ( \mathbb { E } ( \| \mathrm { R e L U } ( x _ { l , i } ^ { p o s t , 3 } W ^ { 1 , l } ) W ^ { 2 , l } \| _ { 2 } ^ { 2 } | x _ { l , i } ^ { p o s t , 3 } , W ^ { 1 , l } ) | x _ { l , i } ^ { p o s t , 3 } ) ) } \\ & { \qquad = \mathbb { E } ( \mathbb { E } ( \| \mathrm { R e L U } ( x _ { l , i } ^ { p o s t , 3 } W ^ { 1 , l } ) \| _ { 2 } ^ { 2 } | x _ { l , i } ^ { p o s t , 3 } ) ) = \mathbb { E } ( \frac { 1 } { 2 } \| x _ { l , i } ^ { p o s t , 3 } \| _ { 2 } ^ { 2 } ) = \frac { d } { 2 } } \end{array}
315
+ $$
316
+
317
+ Based on this, we can estimate the scale of $\mathbb { E } ( \| x _ { l , i } ^ { p o s t , 5 } \| _ { 2 } ^ { 2 } )$ as follows.
318
+
319
+ $$
320
+ \begin{array} { l } { \mathbb { E } ( \| x _ { l , i } ^ { p o s t , 5 } \| _ { 2 } ^ { 2 } ) = \mathbb { E } ( \| x _ { l , i } ^ { p o s t , 3 } \| _ { 2 } ^ { 2 } ) + \mathbb { E } ( \| x _ { l , i } ^ { p o s t , 4 } \| _ { 2 } ^ { 2 } ) + 2 \mathbb { E } ( x _ { l , i } ^ { p o s t , 3 } x _ { l , i } ^ { p o s t , 4 } ^ { \top } ) } \\ { = \mathbb { E } ( \| x _ { l , i } ^ { p o s t , 3 } \| _ { 2 } ^ { 2 } ) + \mathbb { E } ( \| x _ { l , i } ^ { p o s t , 4 } \| _ { 2 } ^ { 2 } ) + \displaystyle \frac { 2 } { n } \mathbb { E } ( \displaystyle \sum _ { j = 1 } ^ { n } \mathrm { R e } { \mathrm { L U } ( x _ { l , j } ^ { p o s t , 3 } W ^ { 1 , l } ) W ^ { 2 , l } x _ { l , i } ^ { p o s t , 3 } } ^ { \top } ) } \\ { \quad \quad \quad \quad \quad \quad ( 1 2 ) } \\ { = \mathbb { E } ( \| x _ { l , i } ^ { p o s t , 3 } \| _ { 2 } ^ { 2 } ) + \mathbb { E } ( \| x _ { l , i } ^ { p o s t , 4 } \| _ { 2 } ^ { 2 } ) = d + \displaystyle \frac { d } { 2 } = \frac { 3 } { 2 } d } \end{array} ( 1 2 )
321
+ $$
322
+
323
+ Using similar technique we can bound $\mathbb { E } ( \| x _ { l , i } ^ { p r e } \| _ { 2 } ^ { 2 } )$ for the Pre-LN Transformer. Since
324
+
325
+ $$
326
+ \begin{array} { l } { \displaystyle \mathbb { E } ( \| x _ { l , i } ^ { p r e , 3 } \| _ { 2 } ^ { 2 } ) = \mathbb { E } ( \| x _ { l , i } ^ { p r e } \| _ { 2 } ^ { 2 } ) + \mathbb { E } ( \| x _ { l , i } ^ { p r e , 2 } \| _ { 2 } ^ { 2 } ) + 2 \mathbb { E } ( x _ { l , i } ^ { p r e , 2 } x _ { l , i } ^ { p r e \top } ) } \\ { \displaystyle \qquad = \mathbb { E } ( \| x _ { l , i } ^ { p r e } \| _ { 2 } ^ { 2 } ) + \mathbb { E } ( \| x _ { l , i } ^ { p r e , 2 } \| _ { 2 } ^ { 2 } ) + \frac { 2 } { n } \mathbb { E } ( \sum _ { j = 1 } ^ { n } x _ { l , j } ^ { p r e , 1 } W ^ { V , l } x _ { l , i } ^ { p r e \top } ) } \\ { \displaystyle \qquad = \mathbb { E } ( \| x _ { l , i } ^ { p r e } \| _ { 2 } ^ { 2 } ) + \mathbb { E } ( \| x _ { l , i } ^ { p r e , 2 } \| _ { 2 } ^ { 2 } ) = \mathbb { E } ( \| x _ { l , i } ^ { p r e } \| _ { 2 } ^ { 2 } ) + \mathbb { E } ( \| \frac { 1 } { n } \sum _ { i = 1 } ^ { n } x _ { l , i } ^ { p r e , 1 } \| _ { 2 } ^ { 2 } ) } \end{array}
327
+ $$
328
+
329
+ It is easy to see that we have $\mathbb { E } ( \| x _ { l , i } ^ { p r e } \| _ { 2 } ^ { 2 } ) \leq \mathbb { E } ( \| x _ { l , i } ^ { p r e , 3 } \| _ { 2 } ^ { 2 } ) \leq \mathbb { E } ( \| x _ { l , i } ^ { p r e } \| _ { 2 } ^ { 2 } ) + d$ . And similar to (11)-(13),
330
+
331
+ $$
332
+ \begin{array} { r l } & { \mathbb { E } ( \| x _ { l + 1 , i } ^ { p r e } \| _ { 2 } ^ { 2 } ) = \mathbb { E } ( \| x _ { l , i } ^ { p r e , 3 } \| _ { 2 } ^ { 2 } ) + \mathbb { E } ( \| x _ { l , i } ^ { p r e , 5 } \| _ { 2 } ^ { 2 } ) + 2 \mathbb { E } ( x _ { l , i } ^ { p r e , 3 } x _ { l , i } ^ { p r e , 5 } ^ { \top } ) } \\ & { \qquad = \mathbb { E } ( \| x _ { l , i } ^ { p r e , 3 } \| _ { 2 } ^ { 2 } ) + \mathbb { E } ( \| x _ { l , i } ^ { p r e , 5 } \| _ { 2 } ^ { 2 } ) } \\ & { \qquad = \mathbb { E } ( \| x _ { l , i } ^ { p r e , 3 } \| _ { 2 } ^ { 2 } ) + \displaystyle \frac { 1 } { 2 } d } \end{array}
333
+ $$
334
+
335
+ Combining both, we have $\begin{array} { r } { \mathbb { E } ( \| x _ { l , i } ^ { p r e } \| _ { 2 } ^ { 2 } ) + \frac { 1 } { 2 } d \leq \mathbb { E } ( \| x _ { l + 1 , i } ^ { p r e } \| _ { 2 } ^ { 2 } ) \leq \mathbb { E } ( \| x _ { l , i } ^ { p r e } \| _ { 2 } ^ { 2 } ) + \frac { 3 } { 2 } d . } \end{array}$ . Then we have $\begin{array} { r } { ( 1 + \frac { l } { 2 } ) d \leq \mathbb { E } ( \| x _ { l , i } ^ { p r e } \| _ { 2 } ^ { 2 } ) \leq ( 1 + \frac { 3 l } { 2 } ) d } \end{array}$ by induction.
336
+
337
+ # D PROOF OF LEMMA 3
338
+
339
+ The proof of Lemma 3 is based on Lemma 4:
340
+
341
+ Lemma 4. Let $\boldsymbol { \alpha } \in \mathbb { R } ^ { d }$ be a vector such that $\| \alpha \| _ { 2 } = 1$ , then the eigenvalue of $I - \alpha ^ { \top } \alpha$ is either 1 or $O$ .
342
+
343
+ Proof. Let $\{ e _ { 1 } , . . . , e _ { d } \}$ be unit vectors such that $e _ { 1 } = \alpha$ and $e _ { i } \bot e _ { j }$ for all $( i , j )$ . Then we have $e _ { 1 } ( I - \alpha ^ { \top } \alpha ) = e _ { 1 } - e _ { 1 } \alpha ^ { \top } \alpha = \underline { { e } } _ { 1 } - \alpha = 0$ and $e _ { i } ( I - \alpha ^ { \top } \alpha ) = e _ { i } - e _ { i } \alpha ^ { \top } \alpha = e _ { i }$ for $i \neq 1$ . So $e _ { i }$ are all the eigenvectors of $I - \alpha ^ { \top } \alpha$ , and their corresponding eigenvalues are $( 0 , 1 , 1 , . . . , 1 )$ . Hence we complete our proof. □
344
+
345
+ Proof of Lemma 3. Denote $\begin{array} { r } { y = x ( I - \frac { 1 } { d } \mathbf { 1 } ^ { \top } \mathbf { 1 } ) } \end{array}$ , where $\mathbf { 1 } = ( 1 , 1 , . . . , 1 ) \in \mathbb { R } ^ { d }$ , then the layer normalization can be rewritten as
346
+
347
+ $$
348
+ \mathrm { L N } ( x ) _ { i } = \frac { y _ { i } } { \sqrt { \frac { 1 } { d } \sum _ { j = 1 } ^ { d } y _ { j } ^ { 2 } } }
349
+ $$
350
+
351
+ We explicitly calculate the Jacobian of layer normalization as
352
+
353
+ $$
354
+ \begin{array} { r l } & { \frac { \partial \mathrm { L N } ( x ) _ { i } } { \partial y _ { j } } = \frac { \partial } { \partial y _ { j } } ( \frac { y _ { i } } { \sqrt { \frac { 1 } { d } \sum _ { k = 1 } ^ { n } y _ { k } ^ { 2 } } } ) = \frac { \delta _ { i j } \sqrt { \frac { 1 } { d } \sum _ { k = 1 } ^ { n } y _ { k } ^ { 2 } } - y _ { i } \frac { \frac { 1 } { d } y _ { j } } { \sqrt { \frac { 1 } { d } \sum _ { k = 1 } ^ { n } y _ { k } ^ { 2 } } } } { \frac { 1 } { d } \sum _ { k = 1 } ^ { n } y _ { k } ^ { 2 } } } \\ & { \qquad = \sqrt { d } \frac { \delta _ { i j } \| y \| _ { 2 } ^ { 2 } - y _ { i } y _ { j } } { \| y \| _ { 2 } ^ { \frac { 3 } { 2 } } } = \frac { \sqrt { d } } { \| y \| _ { 2 } } ( \delta _ { i j } - \frac { y _ { i } y _ { j } } { \| y \| _ { 2 } ^ { 2 } } ) } \end{array}
355
+ $$
356
+
357
+ where $\delta _ { i j } = 1$ when $i = j$ and $\delta _ { i j } = 0$ when $i \neq j$ . In the matrix form,
358
+
359
+ $$
360
+ \frac { \partial \mathbf { L N } ( x ) } { \partial y } = \frac { \sqrt { d } } { \| y \| _ { 2 } } ( I - \frac { y ^ { \top } y } { \| y \| _ { 2 } ^ { 2 } } )
361
+ $$
362
+
363
+ and
364
+
365
+ $$
366
+ \begin{array} { l } { \displaystyle { \mathbf { J } _ { L N } ( x ) = \frac { \partial { \mathbf { L N } ( x ) } } { \partial x } } } \\ { \displaystyle { \quad = \frac { \partial { \mathbf { L N } ( x ) } } { \partial y } \frac { \partial y } { \partial x } } } \\ { \displaystyle { \quad = \sqrt { d } \frac { 1 } { \| y \| _ { 2 } } ( I - \frac { y ^ { \top } y } { \| y \| _ { 2 } ^ { 2 } } ) ( I - \frac { 1 } { d } \mathbf { 1 } ^ { \top } \mathbf { 1 } ) } . } \end{array}
367
+ $$
368
+
369
+ Since the eigenvalue of the matrix $\begin{array} { r } { ( I - \frac { \boldsymbol { y } ^ { \top } \boldsymbol { y } } { \| \boldsymbol { y } \| _ { 2 } ^ { 2 } } ) } \end{array}$ and $\begin{array} { r } { \left( I - \frac { 1 } { d } \mathbf { 1 } ^ { \top } \mathbf { 1 } \right) } \end{array}$ are either 1 or 0 (by Lemma 4), we have $\begin{array} { r } { \| ( I - \frac { y ^ { \top } y } { \| y \| _ { 2 } ^ { 2 } } ) \| _ { 2 } = \mathcal { O } ( 1 ) } \end{array}$ and $\begin{array} { r } { \| ( I - \frac { 1 } { d } \mathbf { 1 } ^ { \top } \mathbf { 1 } ) \| _ { 2 } = \mathcal { O } ( 1 ) } \end{array}$ . So the spectral norm of $\mathbf { J } _ { L N } ( x )$ is
370
+
371
+ $$
372
+ \| \mathbf { J } _ { L N } ( x ) \| _ { 2 } = \mathcal { O } ( \frac { \sqrt { d } } { \| y \| _ { 2 } } ) = \mathcal { O } ( \frac { \sqrt { d } } { \| x \| _ { 2 } } )
373
+ $$
374
+
375
+ # E PROOF OF THEOREM 1
376
+
377
+ The proof of Theorem 1 is based on Lemma 5:
378
+
379
+ Lemma 5. Let $Y$ be a random variable that is never larger than $B$ . Then for all $a < B$ ,
380
+
381
+ $$
382
+ \operatorname* { P r } [ Y \leq a ] \leq { \frac { \mathbb { E } [ B - Y ] } { B - a } }
383
+ $$
384
+
385
+ Proof. Let $X = B - Y$ , then $X \geq 0$ and Markov’s inequality tells us that
386
+
387
+ $$
388
+ \operatorname { P r } [ X \geq B - a ] \leq { \frac { \mathbb { E } [ X ] } { B - a } }
389
+ $$
390
+
391
+ Hence
392
+
393
+ $$
394
+ \operatorname* { P r } [ Y \leq a ] \leq { \frac { \mathbb { E } [ B - Y ] } { B - a } }
395
+ $$
396
+
397
+ Proof of Theorem 1. We prove Theorem 1 by estimating each element of the gradient matrix. Namely, we will analyze $\frac { \partial \tilde { \mathcal { L } } } { \partial W _ { p q } ^ { 2 , L } }$ for $p , q \in \{ 1 , . . . , d \}$ . The loss of the post-LN Transformer can be written as
398
+
399
+ $$
400
+ \tilde { \mathcal { L } } ( x _ { L + 1 , 1 } ^ { p o s t } , . . . , x _ { L + 1 , n } ^ { p o s t } ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathcal { L } ( x _ { L + 1 , i } ^ { p o s t } )
401
+ $$
402
+
403
+ Through back propagation, for each $i \in \{ 1 , 2 , . . . , n \}$ the gradient of $\mathcal { L } ( \boldsymbol { x } _ { L + 1 , i } )$ with respect to the last layer’s parameter $W ^ { 2 , L }$ in the post-LN setting can be written as:
404
+
405
+ $$
406
+ \begin{array} { r l } & { \frac { \partial \mathcal { L } ( \boldsymbol { x } _ { L + 1 , i } ^ { p o s t } ) } { \partial W _ { p q } ^ { 2 , L } } = \frac { \partial \mathcal { L } ( \boldsymbol { x } _ { L + 1 , i } ^ { p o s t } ) } { \partial \boldsymbol { x } _ { L + 1 , i } ^ { p o s t } } \frac { \partial \boldsymbol { x } _ { L + 1 , i } ^ { p o s t } } { \partial \boldsymbol { x } _ { L , i } ^ { p o s t , 5 } } \frac { \partial \boldsymbol { x } _ { L , i } ^ { p o s t , 5 } } { \partial \boldsymbol { x } _ { L , i } ^ { p o s t , 4 } } \frac { \partial \boldsymbol { x } _ { L , i } ^ { p o s t , 4 } } { \partial W _ { p q } ^ { 2 , L } } } \\ & { \qquad = \frac { \partial \mathcal { L } ( \boldsymbol { x } _ { L + 1 , i } ^ { p o s t } ) } { \partial \boldsymbol { x } _ { L + 1 , i } ^ { p o s t } } \mathbf { J } _ { L N } ( \boldsymbol { x } _ { L , i } ^ { p o s t , 5 } ) \frac { \partial \boldsymbol { x } _ { L , i } ^ { p o s t , 4 } } { \partial W _ { p q } ^ { 2 , L } } } \\ & { \qquad = \frac { \partial \mathcal { L } ( \boldsymbol { x } _ { L + 1 , i } ^ { p o s t } ) } { \partial \boldsymbol { x } _ { L + 1 , i } ^ { p o s t } } \mathbf { J } _ { L N } ( \boldsymbol { x } _ { L , i } ^ { p o s t , 5 } ) ( 0 , 0 , . . . , [ \mathrm { R e L U } ( \boldsymbol { x } _ { L , i } ^ { p o s t , 3 } W ^ { 1 , L } ) ] _ { p } , . . . , 0 ) ^ { \top } } \end{array}
407
+ $$
408
+
409
+ Heof $\mathrm { [ R e L U ( } x _ { L , i } ^ { p o s t , 3 } W ^ { 1 , L } ) ] _ { p }$ means the d by $p$ -th element of $\mathrm { R e L U } ( x _ { L , i } ^ { p o s t , 3 } W ^ { 1 , L } )$ . So the absolute value $\frac { \partial \mathcal { L } ( x _ { L + 1 , i } ^ { p o s t } ) } { \partial W _ { p q } ^ { 2 , L } }$
410
+
411
+ $$
412
+ | \frac { \partial \mathcal { L } ( x _ { L + 1 , i } ^ { p o s t } ) } { \partial W _ { p q } ^ { 2 , L } } | \leq \| \frac { \partial \mathcal { L } ( x _ { L + 1 , i } ^ { p o s t } ) } { \partial x _ { L + 1 , i } ^ { p o s t } } \| _ { 2 } \| \mathbf { J } _ { L N } ( x _ { L , i } ^ { p o s t , 5 } ) \| _ { 2 } \| ( 0 , 0 , . . . , [ \mathrm { R e L U } ( x _ { L , i } ^ { p o s t , 3 } W ^ { 1 , L } ) ] _ { p } , . . . , 0 ) ^ { \top } \| _ { 2 }
413
+ $$
414
+
415
+ $$
416
+ = \| \frac { \partial \mathcal { L } ( x _ { L + 1 , i } ^ { p o s t } ) } { \partial x _ { L + 1 , i } ^ { p o s t } } \| _ { 2 } \| \mathbf { J } _ { L N } ( x _ { L , i } ^ { p o s t , 5 } ) \| _ { 2 } | [ \mathrm { R e L U } ( x _ { L , i } ^ { p o s t , 3 } W ^ { 1 , L } ) ] _ { p } |
417
+ $$
418
+
419
+ which implies
420
+
421
+ $$
422
+ | \frac { \partial \mathcal { L } ( x _ { L + 1 , i } ^ { p o s t } ) } { \partial W _ { p q } ^ { 2 , L } } | ^ { 2 } \leq \| \frac { \partial \mathcal { L } ( x _ { L + 1 , i } ^ { p o s t } ) } { \partial x _ { L + 1 , i } ^ { p o s t } } \| _ { 2 } ^ { 2 } \| \mathbf { J } _ { L N } ( x _ { L , i } ^ { p o s t , 5 } ) \| _ { 2 } ^ { 2 } | [ \operatorname { R e L U } ( x _ { L , i } ^ { p o s t , 3 } W ^ { 1 , L } ) ] _ { p } | ^ { 2 }
423
+ $$
424
+
425
+ Since we assume that all the derivatives are bounded, we have $\| \frac { \partial \mathcal { L } ( x _ { L + 1 , i } ^ { p o s t } ) } { \partial x _ { L + 1 , i } ^ { p o s t } } \| _ { 2 } ^ { 2 } = \mathcal { O } ( 1 )$ . So
426
+
427
+ $$
428
+ | \frac { \partial \mathcal { L } ( x _ { L + 1 , i } ^ { p o s t } ) } { \partial W _ { p q } ^ { 2 , L } } | ^ { 2 } = \mathcal { O } ( \left[ | | \mathbf { J } _ { L N } ( x _ { L , i } ^ { p o s t , 5 } ) | | _ { 2 } ^ { 2 } | [ \operatorname { R e L U } ( x _ { L , i } ^ { p o s t , 3 } W ^ { 1 , L } ) ] _ { p } | ^ { 2 } \right] )
429
+ $$
430
+
431
+ Since $\| x _ { L , i } ^ { p o s t , 3 } \| _ { 2 } ^ { 2 } = d , [ x _ { L , i } ^ { p o s t , 3 } W ^ { 1 , L } ] _ { p }$ has distribution $N ( 0 , 1 )$
432
+
433
+ $$
434
+ \left. \operatorname* { P r } [ | [ x _ { L , i } ^ { p o s t , 3 } W ^ { 1 , L } ] _ { p } | \geq a _ { 0 } ] \leq \exp ( - \frac { a _ { 0 } ^ { 2 } } { 2 } ) . \right.
435
+ $$
436
+
437
+ So
438
+
439
+ $$
440
+ \operatorname* { P r } [ \operatorname { R e L U } ( [ x _ { L , i } ^ { p o s t , 3 } W ^ { 1 , L } ] _ { p } ) ^ { 2 } \geq 2 \ln 1 0 0 d ] \leq \frac { 0 . 0 1 } { d } .
441
+ $$
442
+
443
+ Thus with probability at least 0.99, for all p = 1, 2, ..., d we have ReLU([xpost,L,i $\mathrm { R e L U } ( [ x _ { L , i } ^ { p o s t , 3 } W ^ { 1 , L } ] _ { p } ) ^ { 2 } \ \leq$ $2 \ln 1 0 0 d$ .
444
+
445
+ Since with probability $\begin{array} { r l r } { 1 - \delta ( \epsilon ) , \frac { | \| x _ { L , i } ^ { p o s t , 5 } \| _ { 2 } ^ { 2 } - \mathbb { E } \| x _ { L , i } ^ { p o s t , 5 } \| _ { 2 } ^ { 2 } | } { \mathbb { E } \| x _ { L , i } ^ { p o s t , 5 } \| _ { 2 } ^ { 2 } } } & { \le } & { \epsilon , } \end{array}$ , we have $\| x _ { L , i } ^ { p o s t , 5 } \| _ { 2 } ^ { 2 } ~ \leq ~ ( 1 ~ +$ $\epsilon ) \mathbb { E } \| x _ { L , i } ^ { p o s t , 5 } \| _ { 2 } ^ { 2 }$ . Using Lemma 5, we have
446
+
447
+ $$
448
+ \operatorname* { P r } [ \| x _ { L , i } ^ { p o s t , 5 } \| _ { 2 } ^ { 2 } \leq \alpha _ { 0 } \mathbb { E } \| x _ { L , i } ^ { p o s t , 5 } \| _ { 2 } ^ { 2 } ] \leq \frac { ( 1 + \epsilon ) \mathbb { E } \| x _ { L , i } ^ { p o s t , 5 } \| _ { 2 } ^ { 2 } - \mathbb { E } \| x _ { L , i } ^ { p o s t , 5 } \| _ { 2 } ^ { 2 } } { ( 1 + \epsilon - \alpha _ { 0 } ) \mathbb { E } \| x _ { L , i } ^ { p o s t , 5 } \| _ { 2 } ^ { 2 } } = \frac { \epsilon } { 1 + \epsilon - \alpha _ { 0 } }
449
+ $$
450
+
451
+ for an arbitrary constant $\alpha _ { 0 } > 0$ , which equals
452
+
453
+ $$
454
+ \operatorname* { P r } [ \| x _ { L , i } ^ { p o s t , 5 } \| _ { 2 } ^ { 2 } \geq \alpha _ { 0 } \mathbb { E } \| x _ { L , i } ^ { p o s t , 5 } \| _ { 2 } ^ { 2 } ] \geq 1 - \frac { \epsilon } { 1 + \epsilon - \alpha _ { 0 } }
455
+ $$
456
+
457
+ So according to union bound, with probability at least $\begin{array} { r } { 0 . 9 9 - \delta ( \epsilon ) - \frac { \epsilon } { 1 + \epsilon - \alpha _ { 0 } } } \end{array}$ we have $\Big | \frac { \partial \mathcal { L } ( x _ { L + 1 , i } ^ { p o s t } ) } { \partial W _ { p q } ^ { 2 , L } } | ^ { 2 } =$ $\begin{array} { r } { \mathcal { I } \Big ( \Big \vert \| \mathbf { J } _ { L N } ( x _ { L , i } ^ { p o s t , 5 } ) \| _ { 2 } ^ { 2 } \vert [ \mathbf { R e L U } ( x _ { L , i } ^ { p o s t , 3 } W ^ { 1 , L } ) ] _ { p } \vert ^ { 2 } \Big ] \Big ) \leq \mathcal { O } ( \frac { 2 d \ln 1 0 0 d } { \| x _ { L , i } ^ { p o s t , 5 } \| _ { 2 } ^ { 2 } } ) \leq \mathcal { O } ( \frac { d \ln d } { \alpha _ { 0 } \mathbb { E } \| x _ { L , i } ^ { p o s t , 5 } \| _ { 2 } ^ { 2 } } ) = \mathcal { O } ( \frac { \ln d } { \alpha _ { 0 } } ) . } \end{array}$ So we have
458
+
459
+ $$
460
+ | \frac { \partial \tilde { \mathcal { L } } } { \partial W _ { p q } ^ { 2 , L } } | ^ { 2 } = | \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \frac { \partial \mathcal { L } ( x _ { L + 1 , i } ^ { p o s t } ) } { \partial W _ { p q } ^ { 2 , L } } | ^ { 2 } \leq \frac { 1 } { n } \sum _ { i = 1 } ^ { n } | \frac { \partial \mathcal { L } ( x _ { L + 1 , i } ^ { p o s t } ) } { \partial W _ { p q } ^ { 2 , L } } | ^ { 2 } = \mathcal { O } ( \frac { \ln d } { \alpha _ { 0 } } )
461
+ $$
462
+
463
+ and
464
+
465
+ $$
466
+ \| \frac { \partial \tilde { \mathcal { L } } } { \partial W ^ { 2 , L } } \| _ { F } = \sqrt { \sum _ { p , q = 1 } ^ { d } | \frac { \partial \tilde { \mathcal { L } } } { \partial W _ { p q } ^ { 2 , L } } | ^ { 2 } } = \mathcal { O } ( \sqrt { \frac { d ^ { 2 } \ln d } { \alpha _ { 0 } } } )
467
+ $$
468
+
469
+ The loss of the pre-LN Transformer can be written as
470
+
471
+ $$
472
+ \tilde { \mathcal { L } } ( x _ { F i n a l , 1 } ^ { p r e } , . . . , x _ { F i n a l , n } ^ { p r e } ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathcal { L } ( x _ { F i n a l , i } ^ { p r e } )
473
+ $$
474
+
475
+ Using the same technique, in the pre-LN setting the gradient of $\mathcal { L } ( x _ { F i n a l , i } ^ { p r e } )$ with respect to the last layer’s parameter $W ^ { 2 , L }$ can be written as
476
+
477
+ $$
478
+ \begin{array} { r l } & { \frac { \partial \mathcal { L } ( x _ { F i n a l , i } ^ { p r e } ) } { \partial W _ { p q } ^ { 2 , L } } = \frac { \partial \mathcal { L } ( x _ { F i n a l , i } ^ { p r e } ) } { \partial x _ { F i n a l , i } ^ { p r e } } \frac { \partial x _ { F i n a l , i } ^ { p r e } } { \partial x _ { L + 1 , i } ^ { p r e } } \frac { \partial x _ { L + 1 , i } ^ { p r e } } { \partial x _ { L , i } ^ { p r e , 5 } } \frac { \partial x _ { L , i } ^ { p r e , 5 } } { \partial W _ { p q } ^ { 2 , L } } } \\ & { \quad \quad \quad \quad \quad \quad \quad = \frac { \partial \mathcal { L } ( x _ { F i n a l , i } ^ { p r e } ) } { \partial x _ { F i n a l , i } ^ { p r e } } \mathbf { J } _ { L N } ( x _ { L + 1 , i } ^ { p r e } ) ( 0 , 0 , . . . , [ \operatorname { R e L U } ( x _ { L , i } ^ { p r e , 4 } W ^ { 1 , L } ) ] _ { p } , . . . , 0 ) ^ { \top } } \end{array}
479
+ $$
480
+
481
+ So the absolute value of each component of the gradient is bounded by
482
+
483
+ $$
484
+ \begin{array} { r l r } { { \vert \frac { \partial \mathcal { L } ( x _ { F i n a l , i } ^ { p r e } ) } { \partial W _ { p q } ^ { 2 , L } } \vert \leq \| \frac { \partial \mathcal { L } ( x _ { F i n a l , i } ^ { p r e } ) } { \partial x _ { F i n a l , i } ^ { p r e } } \| _ { 2 } \| \mathbf { J } _ { L N } ( x _ { L + 1 , i } ^ { p r e } ) \| _ { 2 } \| ( 0 , 0 , . . . , [ \operatorname { R e L U } ( x _ { L , i } ^ { p r e , 4 } W ^ { 1 , L } ) ] _ { p } , . . . , 0 ) \| _ { 2 } } } \\ & { } & { ( 4 ) } \\ & { } & { = \| \frac { \partial \mathcal { L } ( x _ { F i n a l , i } ^ { p r e } ) } { \partial x _ { F i n a l , i } ^ { p r e } } \| _ { 2 } \| \mathbf { J } _ { L N } ( x _ { L + 1 , i } ^ { p r e } ) \| _ { 2 } \| [ \operatorname { R e L U } ( x _ { L , i } ^ { p r e , 4 } W ^ { 1 , L } ) ] _ { p } \| } \end{array}
485
+ $$
486
+
487
+ $\| x _ { L , i } ^ { p r e , 4 } \| _ { 2 } ^ { 2 } = d$ and $[ x _ { L , i } ^ { p r e , 4 } W ^ { 1 , L } ] _ { p }$ obeys distribution $N ( 0 , 1 )$ , using Chernoff bound we have
488
+
489
+ $$
490
+ \operatorname* { P r } [ | [ x _ { L , i } ^ { p r e , 4 } W ^ { 1 , L } ] _ { p } | \geq a _ { 0 } ] \leq \exp ( - \frac { a _ { 0 } ^ { 2 } } { 2 } ) .
491
+ $$
492
+
493
+ So
494
+
495
+ $$
496
+ \operatorname* { P r } [ \operatorname { R e L U } ( [ x _ { L , i } ^ { p r e , 4 } W ^ { 1 , L } ] _ { p } ) ^ { 2 } \geq 2 \ln 1 0 0 d ] \leq \frac { 0 . 0 1 } { d } .
497
+ $$
498
+
499
+ So with probability at least 0.99, for all $p = 1 , 2 , . . . , d$ we have R $\mathrm { . L U } ( [ x _ { L , i } ^ { p r e , 4 } W ^ { 1 , L } ] _ { p } ) ^ { 2 } \leq 2 \ln 1 0 0 d .$
500
+
501
+ Since with probability $1 - \delta ( \epsilon )$ , $\begin{array} { r l r } { \frac { | \| x _ { L + 1 , i } ^ { p r e } \| _ { 2 } ^ { 2 } - \mathbb { E } \| x _ { L + 1 , i } ^ { p r e } \| _ { 2 } ^ { 2 } | } { \mathbb { E } \| x _ { L + 1 , i } ^ { p r e } \| _ { 2 } ^ { 2 } } } & { \leq } & { \epsilon . } \end{array}$ , we have $\| x _ { L + 1 , i } ^ { p r e } \| _ { 2 } ^ { 2 } ~ \leq ~ ( 1 ~ +$ $\epsilon ) \mathbb { E } \lVert x _ { L + 1 , i } ^ { p r e } \rVert _ { 2 } ^ { 2 }$ . Using Lemma 5, we have
502
+
503
+ $$
504
+ \small \operatorname* { P r } [ \| x _ { L + 1 , i } ^ { p r e } \| _ { 2 } ^ { 2 } \leq \alpha _ { 0 } \mathbb { E } \| x _ { L + 1 , i } ^ { p r e } \| _ { 2 } ^ { 2 } ] \leq \frac { ( 1 + \epsilon ) \mathbb { E } \| x _ { L + 1 , i } ^ { p r e } \| _ { 2 } ^ { 2 } - \mathbb { E } \| x _ { L + 1 , i } ^ { p r e } \| _ { 2 } ^ { 2 } } { ( 1 + \epsilon - \alpha _ { 0 } ) \mathbb { E } \| x _ { L + 1 , i } ^ { p r e } \| _ { 2 } ^ { 2 } } = \frac { \epsilon } { 1 + \epsilon - \alpha _ { 0 } }
505
+ $$
506
+
507
+ which equals
508
+
509
+ $$
510
+ \operatorname* { P r } [ \| x _ { L + 1 , i } ^ { p r e } \| _ { 2 } ^ { 2 } \geq \alpha _ { 0 } \mathbb { E } \| x _ { L + 1 , i } ^ { p r e } \| _ { 2 } ^ { 2 } ] \geq 1 - \frac { \epsilon } { 1 + \epsilon - \alpha _ { 0 } }
511
+ $$
512
+
513
+ According to union bound, with probability $\begin{array} { r } { 0 . 9 9 - \delta ( \epsilon ) - \frac { \epsilon } { 1 + \epsilon - \alpha _ { 0 } } } \end{array}$ we have $| \frac { \partial \mathcal { L } ( { x } _ { F i n a l , i } ^ { p r e } ) } { \partial W _ { p q } ^ { 2 , L } } | ^ { 2 } =$ $\begin{array} { r } { \mathcal { D } \big ( \Big [ \| \mathbf { J } _ { L N } ( x _ { L + 1 , i } ^ { p r e } ) \| _ { 2 } ^ { 2 } \big | [ \mathbf { R e L U } ( x _ { L , i } ^ { p r e , 4 } W ^ { 1 , L } ) ] _ { p } | ^ { 2 } \Big ] \big ) \leq \mathcal { O } \big ( \frac { 2 d \ln 1 0 0 d } { \| x _ { L + 1 , i } ^ { p r e } \| _ { 2 } ^ { 2 } } \big ) \leq \mathcal { O } \big ( \frac { d \ln d } { \alpha _ { 0 } \mathbb { E } \| x _ { L + 1 , i } ^ { p r e } \| _ { 2 } ^ { 2 } } \big ) = \mathcal { O } ( \frac { \ln d } { \alpha _ { 0 } L } ) . } \end{array}$ So we have
514
+
515
+ $$
516
+ | \frac { \partial \tilde { \mathcal { L } } } { \partial W _ { p q } ^ { 2 , L } } | ^ { 2 } = | \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \frac { \partial \mathcal { L } ( x _ { F i n a l , i } ^ { p r e } ) } { \partial W _ { p q } ^ { 2 , L } } | ^ { 2 } = \mathcal { O } ( \frac { \ln d } { \alpha _ { 0 } L } )
517
+ $$
518
+
519
+ $\begin{array} { r } { \| \frac { \partial \tilde { \mathcal { L } } } { \partial W ^ { 2 , L } } \| _ { F } = \sqrt { \sum _ { p , q = 1 } ^ { d } | \frac { \partial \tilde { \mathcal { L } } } { \partial W _ { p q } ^ { 2 , L } } | ^ { 2 } } \leq \mathcal { O } ( \sqrt { \frac { d ^ { 2 } \ln d } { \alpha _ { 0 } L } } ) . } \end{array}$
520
+
521
+ Take $\textstyle \alpha _ { 0 } = { \frac { 1 } { 1 0 } }$ , we have that with probability at least √ $\begin{array} { r } { 0 . 9 9 - \delta ( \epsilon ) - \frac { \epsilon } { 0 . 9 + \epsilon } } \end{array}$ , for the Post-LN Transformer we have $\| \frac { \partial \tilde { \mathcal { L } } } { \partial W ^ { 2 , L } } \| _ { F } \leq \mathcal { O } ( d \sqrt { \ln d } )$ and for the Pre-LN Transformer we have $\| \frac { \partial \tilde { \mathcal { L } } } { \partial W ^ { 2 , L } } \| _ { F } \leq$ $\begin{array} { r } { \mathcal { O } ( d \sqrt { \frac { \ln d } { L } } ) } \end{array}$ □
522
+
523
+ # F EXTENSION TO OTHER LAYERS
524
+
525
+ For simplicity, we denote $x _ { l } = { \mathrm { C o n c a t } } ( x _ { l , 1 } , . . . , x _ { l , n } ) \in \mathbb { R } ^ { n d }$ and $\boldsymbol { x } _ { l } ^ { k } = \operatorname { C o n c a t } ( \boldsymbol { x } _ { l , 1 } ^ { k } , . . . , \boldsymbol { x } _ { l , n } ^ { k } ) \in \mathbb { R } ^ { n d }$ for $k = \{ 1 , 2 , 3 , 4 , 5 \}$ . Then in the Post-LN Transformer, the gradient of the parameters in the $l$ -th layer (take $W ^ { 2 , l }$ as an example) can be written as
526
+
527
+ $$
528
+ \frac { \partial \tilde { \mathcal { L } } } { \partial W ^ { 2 , l } } = \frac { \partial \tilde { \mathcal { L } } } { \partial x _ { L + 1 } ^ { p o s t } } ( \prod _ { j = l + 1 } ^ { L } \frac { \partial x _ { j + 1 } ^ { p o s t } } { \partial x _ { j } ^ { p o s t } } ) \frac { \partial x _ { l + 1 } ^ { p o s t } } { \partial W ^ { 2 , l } } , \mathrm { w h e r e } \frac { \partial x _ { j + 1 } ^ { p o s t } } { \partial x _ { j } ^ { p o s t } } = \frac { \partial x _ { j + 1 } ^ { p o s t } } { \partial x _ { j } ^ { p o s t , 5 } } \frac { \partial x _ { j } ^ { p o s t , 5 } } { \partial x _ { j } ^ { p o s t , 3 } } \frac { \partial x _ { j } ^ { p o s t , 3 } } { \partial x _ { j } ^ { p o s t , 2 } } \frac { \partial x _ { j } ^ { p o s t , 2 } } { \partial x _ { j } ^ { p o s t } } .
529
+ $$
530
+
531
+ The Jacobian matrices of the Post-LN Transformer layers are:
532
+
533
+ $$
534
+ \begin{array} { r l } & { \frac { \partial x _ { j + 1 } ^ { p o s t } } { \partial x _ { j } ^ { p o s t , 5 } } = \left( \begin{array} { l l l } { { \bf J } _ { L N } ( x _ { j , 1 } ^ { p o s t , 5 } ) } & & \\ & { \ddots } & \\ & & { \ddots } & \\ & & { { \bf J } _ { L N } ( x _ { j , n } ^ { p o s t , 5 } ) } \end{array} \right) } \\ { \frac { \partial x _ { j } ^ { p o s t , 5 } } { \partial x _ { j } ^ { p o s t , 3 } } = \left( \begin{array} { l l l } { I } & & \\ & { \ddots } & \\ & & { I } \end{array} \right) + \left( \begin{array} { l l l } { W ^ { 2 , j } } & & \\ & { \ddots } & \\ & & { W ^ { 2 , j } } \end{array} \right) \left( \begin{array} { l l l } { { \bf J } _ { 1 } ^ { j } } & & \\ & { \ddots } & \\ & & { { \bf J } _ { n } ^ { j } } \end{array} \right) \left( \begin{array} { l l l } { W ^ { 1 , l } } & & \\ & { \ddots } & \\ & & { { \bf J } _ { n } ^ { j } } \end{array} \right) } \end{array}
535
+ $$
536
+
537
+ $$
538
+ \mathbf { J } _ { i } ^ { j } = \operatorname { d i a g } \left( \sigma ^ { \prime } \left( x _ { j , i } ^ { p o s t , 3 } \left( \mathbf { w } _ { 1 } ^ { 1 , j } \right) ^ { \top } \right) , \ldots , \sigma ^ { \prime } \left( x _ { j , i } ^ { p o s t , 3 } \left( \mathbf { w } _ { d } ^ { 1 , j } \right) ^ { \top } \right) \right) \in \mathbb { R } ^ { d \times d } .
539
+ $$
540
+
541
+ $$
542
+ \begin{array} { c } { { \displaystyle \frac { \partial x _ { j } ^ { p o s t , 3 } } { \partial x _ { j } ^ { p o s t , 2 } } = \left( \begin{array} { c c c } { { \bf J } _ { L N } ( x _ { j , 1 } ^ { p o s t , 2 } ) } & { { } } & { { } } \\ { { } } & { { \ddots } } & { { } } \\ { { } } & { { } } & { { { \bf J } _ { L N } ( x _ { j , n } ^ { p o s t , 2 } ) } } \end{array} \right) } } \\ { { \displaystyle \frac { \partial x _ { j } ^ { p o s t , 2 } } { \partial x _ { j } ^ { p o s t } } = \left( \begin{array} { c c c } { { I } } & { { } } & { { } } \\ { { } } & { { \ddots } } & { { } } \\ { { } } & { { } } & { { I } } \end{array} \right) + \left( \begin{array} { c c c } { { \frac { 1 } { n } W ^ { V , j } } } & { { \cdots } } & { { \frac { 1 } { n } W ^ { V , j } } } \\ { { \vdots } } & { { \ddots } } & { { \vdots } } \\ { { \frac { 1 } { n } W ^ { V , j } } } & { { \cdots } } & { { \frac { 1 } { n } W ^ { V , j } } } \end{array} \right) } } \end{array}
543
+ $$
544
+
545
+ Using Holder’s inequality, we have ¨
546
+
547
+ $$
548
+ \begin{array} { r l } & { \mathbb { E } \| \frac { \partial x _ { j + 1 } ^ { p o s t } } { \partial x _ { j } ^ { p o s t } } \| _ { 2 } \leq \mathbb { E } \left[ \| \frac { \partial x _ { j + 1 } ^ { p o s t } } { \partial x _ { j } ^ { p o s t , 5 } } \| _ { 2 } \| \frac { \partial x _ { j } ^ { p o s t , 5 } } { \partial x _ { j } ^ { p o s t , 3 } } \| _ { 2 } \| \frac { \partial x _ { j } ^ { p o s t , 3 } } { \partial x _ { j } ^ { p o s t , 2 } } \| _ { 2 } \| \frac { \partial x _ { j } ^ { p o s t , 2 } } { \partial x _ { j } ^ { p o s t } } \| _ { 2 } \right] } \\ & { \qquad \leq \sqrt { \mathbb { E } \left[ \| \frac { \partial x _ { j + 1 } } { \partial x _ { j } ^ { p o s t , 5 } } \| _ { 2 } ^ { 2 } \right] } \mathbb { E } \left[ \| \frac { \partial x _ { j } ^ { p o s t , 5 } } { \partial x _ { j } ^ { p o s t , 3 } } \| _ { 2 } ^ { 2 } \| \frac { \partial x _ { j } ^ { p o s t , 3 } } { \partial x _ { j } ^ { p o s t , 2 } } \| _ { 2 } ^ { 2 } \| \frac { \partial x _ { j } ^ { p o s t , 2 } } { \partial x _ { j } ^ { p o s t } } \| _ { 2 } ^ { 2 } \right] } \end{array}
549
+ $$
550
+
551
+ Since $\begin{array} { r l r l r } { \frac { \partial x _ { j + 1 } } { \partial x _ { j } ^ { p o s t , 5 } } } & { = } & { d i a g ( \mathbf { J } _ { L N } ( x _ { j , 1 } ^ { p o s t , 5 } ) , . . . , \mathbf { J } _ { L N } ( x _ { j , n } ^ { p o s t , 5 } ) ) , } & { \mathrm { w e } } & { \mathrm { h a v e } } & { \sqrt { \mathbb { E } \left[ \| \frac { \partial x _ { j + 1 } ^ { p o s t } } { \partial x _ { j } ^ { p o s t , 5 } } \| _ { 2 } ^ { 2 } \right] } \quad \approx } \end{array}$ $\begin{array} { r } { \sqrt { \mathbb { E } \frac { d } { \| x _ { j , 1 } ^ { p o s t , 5 } \| _ { 2 } ^ { 2 } } } \approx \sqrt { \frac { 2 } { 3 } } } \end{array}$ when $\| x _ { j , 1 } ^ { p o s t , 5 } \| _ { 2 } ^ { 2 }$ concentrates around its expectation $\mathbb { E } \| x _ { j , 1 } ^ { p o s t , 5 } \| _ { 2 } ^ { 2 }$ which equals $\textstyle { \frac { 3 } { 2 } } d$ according to Lemma 2. Therefore, when we estimate the norm of $\frac { \partial \tilde { \mathcal { L } } } { \partial W ^ { 2 , l } }$ for post-LN transformer, there exists a term $\mathcal { O } ( \frac { 2 } { 3 } ^ { ( L - l ) / 2 } )$ , which exponentially decreases as $l$ goes smaller. Similarly, in the pre-LN Transformer, the gradient can be written as
552
+
553
+ $$
554
+ \frac { \partial \tilde { \mathcal { L } } } { \partial W ^ { 2 , l } } = \frac { \partial \tilde { \mathcal { L } } } { \partial x _ { F i n a l } ^ { p r e } } \frac { \partial x _ { F i n a l } ^ { p r e } } { \partial x _ { L + 1 } ^ { p r e } } ( \prod _ { j = l + 1 } ^ { L } \frac { \partial x _ { j + 1 } ^ { p r e } } { \partial x _ { j } ^ { p r e } } ) \frac { \partial x _ { l + 1 } ^ { p r e } } { \partial W ^ { V , l } } , \mathrm { w h e r e } \frac { \partial x _ { j + 1 } ^ { p r e } } { \partial x _ { j } ^ { p r e } } = \frac { \partial x _ { j + 1 } ^ { p r e } } { \partial x _ { j } ^ { p r e , 3 } } \frac { \partial x _ { j } ^ { p r e , 3 } } { \partial x _ { j } ^ { p r e } } .
555
+ $$
556
+
557
+ The Jacobian matrices of the Pre-LN Transformer layers are:
558
+
559
+ $$
560
+ \begin{array} { r l } & { \frac { \partial x _ { j + 1 } ^ { p e s } } { \partial x _ { j } ^ { p e s , 3 } } = \left( \begin{array} { l l l } { I } & & \\ & { \ddots } & \\ & & { I } \end{array} \right) + \left( \begin{array} { l l l } { W ^ { - 2 , j } } & & \\ & { \ddots } & \\ & & { W ^ { - 2 , j } } \end{array} \right) \left( \begin{array} { l l l } { \mathbf { J } _ { 1 } ^ { ( k ) } } & & \\ & { \ddots } & \\ & & { \mathbf { J } _ { n } ^ { ( k ) } } \end{array} \right) } \\ & { \qquad \left( \begin{array} { l l l } { W ^ { 1 , j } } & & \\ & { \ddots } & \\ & & { W ^ { 1 , j } } \end{array} \right) \left( \begin{array} { l l l } { \mathbf { J } _ { L N } ( x _ { j + 1 } ^ { p e s , 3 } ) } & & \\ & { \ddots } & \\ & & { \mathbf { J } _ { L N } ( x _ { j , n } ^ { p e s , 3 } ) } \end{array} \right) } \\ & { \frac { \partial x _ { j } ^ { p e s , 3 } } { \partial x _ { j } ^ { p e s } } = \left( \begin{array} { l l l } { I } & & \\ & { \ddots } & \\ & & { I } \end{array} \right) + \left( \begin{array} { l l l } { \frac { 1 } { n } W ^ { 1 , j } } & { \cdots } & { \frac { 1 } { n } W ^ { V , j } } \\ & { \vdots } & { \ddots } & \\ & { \frac { 1 } { n } W ^ { V , j } } & { \cdots } & { \frac { 1 } { n } W ^ { V , j } } \end{array} \right) \left( \begin{array} { l l l } { \mathbf { J } _ { L N } ( x _ { j , 1 } ^ { p e r } ) } & & \\ & & { \ddots } & \\ & & { \mathbf { J } _ { L N } ( x _ { j , n } ^ { p e } ) } \end{array} \right) } \end{array}
561
+ $$
562
+
563
+ If $l$ is sufficiently large, the norm of $\mathbf { J } _ { L N } ( x _ { j , i } ^ { p r e } )$ and $\mathbf { J } _ { L N } ( x _ { j , i } ^ { p r e , 3 } )$ are very small (of order $\begin{array} { r } { \mathcal { O } ( \frac { 1 } { \sqrt { j } } ) ) } \end{array}$ ) as $j$ is between $l + 1$ and $L$ , which means the eigenvalues of matrix $\frac { \partial x _ { j + 1 } ^ { p r e } } { \partial x _ { j } ^ { p r e , 3 } }$ and ∂xpre,3j are close to 1. Then we can see that k j+1∂xpre,3j k2 and Ek $\mathbb { E } \Vert \frac { \partial x _ { j } ^ { p r e , 3 } } { \partial x _ { j } ^ { p r e } } \Vert _ { 2 }$ are nearly 1, and the norm of $\frac { \partial \tilde { \mathcal { L } } } { \partial W ^ { 2 , l } }$ for pre-LN transformer is independent of $l$ when $l$ is large.
564
+
565
+ # G EXAMPLES OF $( \epsilon , \delta )$ -BOUNDED RANDOM VARIABLES
566
+
567
+ In this section we give an example of $( \epsilon , \delta )$ -bounded random variable. This example comes from Example 2.5 in (Wainwright, 2019) and we give a short description below.
568
+
569
+ If $Z = ( Z _ { 1 } , . . . , Z _ { n } )$ is a Gaussian vector with distribution $N ( 0 , I _ { n } )$ , then $\begin{array} { r } { Y = \| Z \| _ { 2 } ^ { 2 } = \sum _ { k = 1 } ^ { n } Z _ { k } ^ { 2 } } \end{array}$ has distribution $\chi _ { n } ^ { 2 }$ . And $\begin{array} { r } { \mathbb { E } Y = \sum _ { k = 1 } ^ { n } \mathbb { E } Z _ { k } ^ { 2 } = n } \end{array}$ 1S
570
+
571
+ A random variable $X$ with mean $\mu \ : = \ : \mathbb { E } [ X ]$ is called sub-exponential if there are non-negative parameters $( \nu , \alpha )$ such that $\mathbb { E } [ \exp ( \lambda ( X - \mu ) ) ] \leq \exp ( \frac { \nu ^ { 2 } \lambda ^ { 2 } } { 2 } )$ for all $\textstyle | \lambda | < { \frac { 1 } { \alpha } }$ . The next proposition comes from Proposition 2.2 in (Wainwright, 2019).
572
+
573
+ Proposition 1 (Sub-exponential tail bound). Suppose that $X$ is sub-exponential with parameters $( \nu , \alpha )$ . Then
574
+
575
+ $$
576
+ \begin{array} { r } { \mathbb { P } [ X - \mu \geq t ] \leq \left\{ \begin{array} { l l } { \exp \bigl ( - \frac { t ^ { 2 } } { 2 \nu ^ { 2 } } \bigr ) } & { \mathrm { ~ } i f 0 \leq t \leq \frac { \nu ^ { 2 } } { \alpha } , \ : a n d } \\ { \exp \bigl ( - \frac { t } { 2 \alpha } \bigr ) } & { \mathrm { ~ } f o r \ : t > \frac { \nu ^ { 2 } } { \alpha } } \end{array} \right. } \end{array}
577
+ $$
578
+
579
+ and from Example 2.5 in (Wainwright, 2019), the √ $\chi ^ { 2 }$ variable $Y$ is sub-exponential with parameters $( \nu , \bar { \alpha } ) = ( 2 \sqrt { n } , 4 )$ . So we can derive the one-sided bound
580
+
581
+ $$
582
+ \begin{array} { r } { \mathbb { P } \left[ { Y } - n \ge n \epsilon \right] \le \exp ( - n \epsilon ^ { 2 } / 8 ) , \quad f o r a l l \epsilon \in ( 0 , 1 ) } \end{array}
583
+ $$
584
+
585
+ So $Y$ is $( \epsilon , \delta )$ -bounded with $\epsilon \in ( 0 , 1 )$ and $\delta = \mathrm { e x p } ( - n \epsilon ^ { 2 } / 8 )$ .
586
+
587
+ # H EMPIRICAL VERIFICATION OF THE THEORETICAL FINDINGS
588
+
589
+ As our theory is derived based on several simplifications of the problem, we conduct experiments to study whether our theoretical insights on the gradients are consistent with what we observe in real scenarios. We empirically study the gradients at initialization for both Post-LN/Pre-LN Transformer on the IWSLT14 De-En task. The general model and training configuration exactly follow Section 3.2. The experiments are repeated ten times using different random seeds.
590
+
591
+ Empirical verification of concentration property Given an initialized model, we record the hidden states in the Post-LN/Pre-LN Transformer and find that the norm of the hidden states satisfies the concentration property ((0.1,0.125)-bounded).
592
+
593
+ ![](images/b6cca0e1da0ae68d6488bfbcc4fe850b85b8a9c3fb66d7b171beed273eb2f6a4.jpg)
594
+ Figure 6: Norm of expected gradients of $W ^ { 2 }$ in the last FFN sub-layer in different size of the Transformer architecture
595
+
596
+ Empirical verification of Theorem 1 In Theorem 1, the theory suggests that for any sizes of the Post-LN Transformer, the scale of the gradient norm in the last FFN sub-layer remains the same. On the contrary, the scale of the gradient norm in the last FFN sub-layer of the Pre-LN Transformer decreases as the size (total depth) of the model grows.
597
+
598
+ We conduct experiments to study the gradient norm in the last FFN sub-layer in different sizes of the Transformer architecture at initialization to verify Theorem 1. We train 6-6/8-8/10-10/12-12/14- 14 Post-LN/Pre-LN Transformer models, and record the gradient norm of the final FFN layer in different Transformer models. The results are plotted in Figure 6. The $\mathbf { X }$ -axis is the size of the model, and the y-axis is the value of the gradient norm of $W ^ { \overline { { 2 } } }$ in the final FFN sub-layer. It can be seen from the figure when the number of layers grows, the gradient norm remains in the Post-LN Transformer (around 1.6) and decreases in the Pre-LN Transformer. This observation is consistent well with our theory.
599
+
600
+ Empirical verification of extended theory We record the gradient for each parameter for different mini-batches. For elements in a parameter matrix, we calculate their expected gradients and use the Frobenius norm of those values as the scale of the expected gradient of the matrix. Figure 3(a) and 3(b) shows those statistics for FFN sub-layers. The $\mathbf { X }$ -axis indexes different Transformer layers. It can be seen from the figure, the scale of the expected gradients grows along with the layer index for the Post-LN Transformer. On the contrary, the scale almost keeps the same for different layers in the Pre-LN Transformer. These observations are consistent with our theoretical findings.
601
+
602
+ Given the analysis above, we think our derived theory at the initialization stage is useful and consistent with the empirical studies above.
603
+
604
+ # I LARGE GRADIENTS IN POST-LN TRANSFORMER HURTS THE OPTIMIZATION
605
+
606
+ Theoretically, we find that the gradients of the parameters near the output layers are very large for the Post-LN Transformer and suggest using large learning rates to those parameters makes the training unstable. To verify whether using small-step updates mitigates the issue, we conduct a set of experiments that follows the setting in Section 3.3. There are two simple ways of “small-step updates”, gradient norm clipping, and using small learning rates.
607
+
608
+ Experiments on using small learning rates We find using a very small but fixed learning rate can optimize the Post-LN Transformer (without the learning rate warm-up step) to a certain extent. We use a fixed learning rate of $1 e ^ { - 4 }$ at the beginning of the optimization, which is much smaller than the $\operatorname { l r } _ { m a x } = 1 e ^ { - 3 }$ in the paper. Please note that as the learning rates during training are small, the training converges slowly, and this setting is not very practical in real large-scale tasks. We plot the validation curve together with other baseline approaches in Figure 7. We can see from the figure, the validation loss (pink curve) is around 4.3 in 27 epochs. This loss is much lower than that of the
609
+
610
+ ![](images/36ef75c4654a34194ba0c0653933f763594ab67db816c08332af966b0993ccbe.jpg)
611
+ Figure 7: Performances of the models on the IWSLT14 De-En task.
612
+
613
+ Post-LN Transformer trained using a large learning rate (blue curve). But it is still worse than the SOTA performance (green curve).
614
+
615
+ Experiments on using gradient norm clipping We find that using a small value of clip-norm can also optimize the Post-LN Transformer (without the learning rate warm-up stage). In the experiments, we find the gradient norm at initialization is about 5.00 and thus we clip the norm of the gradient update to 0.5. We plot the validation curve in Figure 7 (see gray curve). It can be seen from the figure that the performance is similar to the “small learning rate” experiment.
616
+
617
+ Discussions We think the experiments above help to verify our conclusion. Using a small learning rate/clip norm mitigates the instability of updating models with large gradient values. Although the theory we prove is based on some simplifications of the problem, the theoretical insights help us understand the optimization of different networks in practice.
md/train/BJxbOlSKPr/BJxbOlSKPr.md ADDED
@@ -0,0 +1,394 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING COMPACT EMBEDDING LAYERS VIA DIFFERENTIABLE PRODUCT QUANTIZATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Embedding layers are commonly used to map discrete symbols into continuous embedding vectors that reflect their semantic meanings. Despite their effectiveness, the number of parameters in an embedding layer increases linearly with the number of symbols and poses a critical challenge on memory and storage constraints. In this work, we propose a generic and end-to-end learnable compression framework termed differentiable product quantization (DPQ). We present two instantiations of DPQ that leverage different approximation techniques to enable differentiability in end-to-end learning. Our method can readily serve as a drop-in alternative for any existing embedding layer. Empirically, DPQ offers significant compression ratios (14-238x) at negligible or no performance cost on 10 datasets across three different language tasks.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ The embedding layer is a basic neural network module which maps a discrete symbol/word into a continuous hidden vector. It is widely used in NLP related applications, including language modeling, machine translation and text classification. With large vocabulary sizes, embedding layers consume large amounts of storage and memory. For example, in the medium-sized LSTM-based model on the PTB dataset (Zaremba et al., 2014), the embedding table accounts for more than $9 5 \%$ of the total number of parameters. Even with sub-words encoding (e.g. Byte-pair encoding), the size of the embedding layer is still very significant. In addition to words/sub-words models in the text domain (Mikolov et al., 2013; Devlin et al., 2018), embedding layers are also used in a wide range of applications such as knowledge graphs (Bordes et al., 2013; Socher et al., 2013) and recommender systems (Koren et al., 2009), where the vocabulary sizes are even larger.
12
+
13
+ Recent efforts to reduce the size of embedding layers have been made (Chen et al., 2018b; Shu and Nakayama, 2017), where the authors proposed to first learn to encode symbols/words with K-way D-dimensional discrete codes (KD codes, such as 5-1-2-4 for “cat” and 5-1-2-3 for “dog”), and then compose the codes to form the output symbol embedding. However, in Shu and Nakayama (2017), the discrete codes are fixed before training and are therefore non-adaptive and limited to downstream tasks. Chen et al. (2018b) proposes to learn codes in an end-to-end fashion which leads to better task performance. However, their method employs an expensive embedding composition function to turn KD codes into embedding vectors, and requires a distillation procedure which incorporates a pre-trained embedding table as guidance, in order to match the performance of the full embedding baseline.
14
+
15
+ In this work, we propose a novel differentiable product quantization (DPQ) framework. The proposal is based on the observation that the discrete codes (KD codes) are naturally derived through the process of quantization (product quantization by Jegou et al. (2010) in particular). We also provide two concrete approximation techniques that allow differentiable learning. By making the quantization process differentiable, we are able to learn the KD codes in an end-to-end fashion. Compared to the existing methods (Chen et al., 2018b; Shu and Nakayama, 2017), our framework 1) brings a new and general perspective on how the discrete codes can be obtained in a differentiable manner; 2) allows more flexible model designs (e.g. distance functions and approximation algorithms), and 3) achieves better task performance as well as compression efficiency (by leveraging the sizes of product keys and values) while avoiding the cumbersome distillation procedure.
16
+
17
+ We conduct experiments on ten different datasets across three tasks, by simply replacing the original embedding layer with DPQ. The results show that DPQ can learn compact discrete embeddings with higher compression ratios than the existing methods, at the same time achieving the same performance as the original full embeddings. Furthermore, our results are obtained from end-to-end training where no extra procedures such as distillation are required. To the best of our knowledge, this is the first work to train compact discrete embeddings in an end-to-end fashion without distillation.
18
+
19
+ # 2 METHOD
20
+
21
+ Problem setup. An embedding function can be defined as $\mathcal { F } _ { \mathcal { W } } : \mathcal { V } \mathbb { R } ^ { d }$ , where $\nu$ denotes the vocabulary of discrete symbols, and $\boldsymbol { \mathcal { W } } \in \mathbb { R } ^ { n \times d }$ is the embedding table with $n = | \mathcal { V } |$ . In standard end-to-end training, the embedding function is jointly trained with other neural net parameters to optimize a given objective. The goal of this work is to learn a compact embedding function $\mathcal { F } _ { \mathcal { W } ^ { \prime } }$ in the same end-to-end fashion, but the number of bits used for the new parameterization $\mathcal { W } ^ { \prime }$ is substantially smaller than the original full embedding table $\mathcal { W }$ .
22
+
23
+ Motivation. To represent the embedding table in a more compact way, we can first associate each symbol with a K-way D-dimensional discrete code (KD code), and then use an embedding composition function that turns the KD code into a continuous embedding vector (Chen et al., 2018b). However, it is not clear where the discrete KD codes come from. One could directly optimize them as free parameters, but it is both ad-hoc and restrictive. Our key insight in this work is that discrete codes are naturally derived from the process of quantization (product quantization (Jegou et al., 2010) in particular) of a continuous space. It is flexible to specify the quantization process in various ways, and by making this quantization process differentiable, we enable end-to-end learning of discrete codes via optimizing some task-specific objective.
24
+
25
+ # 2.1 DIFFERENTIABLE PRODUCTION QUANTIZATION FRAMEWORK
26
+
27
+ The proposed differentiable production quantization (DPQ) function is a mapping between continuous spaces, i.e. $\mathcal { T } : \mathbb { R } ^ { d } \dot { \mathbb { R } } ^ { d }$ . In between the two continuous spaces, there is a discrete space $\bar { \{ 1 , \cdots , K \} } ^ { D }$ which can be seen as discrete bottleneck. To transform from continuous space to discrete space and back, two major functions are used: 1) a discretization function $\phi ( \cdot ) : \bar { \mathbb { R } ^ { d } } \to $ $\{ 1 , \cdots , \bar { K } \} ^ { D }$ that maps a continuous vector into a K-way D-dimensional discrete code (KD code), and 2) a reverse-discretization function $\pmb \rho ( \cdot ) : \{ 1 , \cdot \cdot \cdot , \dot { K } \} ^ { D } \mathbb { R } ^ { d }$ that maps the KD code into a continuous embedding vector. In other words, the general DPQ mapping is $\mathcal { T } ( \cdot ) = \rho \circ \phi ( \cdot )$ .
28
+
29
+ Compact embedding layer via DPQ. In order to obtain a compact embedding layer, we first take a raw embedding and put it through DPQ function. More specifically, the raw embedding matrix can be presented as a Query matrix $\bar { \mathbf { Q } } \in \mathbb { R } ^ { n \times d }$ where the number of rows equals to the vocabulary size. The discretization function of DPQ computes discrete codes $\mathbf { C } = \phi ( \mathbf { Q } )$ where $\mathbf { C } \in \{ 1 , \cdots , K \} ^ { n \times D }$ is the KD codebook. To construct the final embedding table for all symbols, the reverse-discretization function of DPQ is applied, i.e. $\mathbf { H } = \rho ( \mathbf { C } )$ where $\breve { \mathbf { H } } \in \mathbb { R } ^ { n \times d }$ is the final symbol embedding matrix. In order to make it compact for the inference, we will discard the original embedding matrix $\mathbf { Q }$ and only store the codebook C and small parameters needed in the reverse-discretization function. They are sufficient to (re)construct partial or whole embedding table. In below, we specify the discretization function $\phi ( \cdot )$ and reverse-discretization function $\rho ( \cdot )$ via product keys and values.
30
+
31
+ Product keys for discretization function $\phi ( \cdot )$ . Given the query matrix $\mathbf { Q }$ , the discretization function computes the KD codebook C. While it is possible to use a complicated transformation, in order to make it efficient, we simply leverage a Key matrix $\mathbf { K } \in \mathbb { R } ^ { K \times d }$ with $K$ rows where $K$ is the number of choices for each code bit. In the spirit of product keys in product quantization, we further split columns of $\mathbf { K }$ and $\mathbf { Q }$ into $D$ groups/subspace, such that $\dot { \mathbf { K } } ^ { ( j ) } \in \mathbb { R } ^ { K \times d / \bar { D } }$ and $\mathbf { Q } ^ { ( j ) } \in \mathbb { R } ^ { n \times d / D }$
32
+
33
+ We can compute each of $D$ dimensional KD codes separately. The $j$ -th dimension of a KD code $\mathbf { C } _ { i }$ for the $i$ -th symbol is computed as follows.
34
+
35
+ $$
36
+ \mathbf { C } _ { i } ^ { ( j ) } = \underset { k } { \arg \operatorname* { m i n } } \mathrm { d i s t } \bigg ( \mathbf { Q } _ { i } ^ { ( j ) } , \mathbf { K } _ { k } ^ { ( j ) } \bigg )
37
+ $$
38
+
39
+ ![](images/2356c5563bc22aa6a7ea130125cb17286075194d8ed084ed80ec5070ca0a0a21.jpg)
40
+ Figure 1: The DPQ embedding framework. During training, differentiable product quantization is used to approximate the raw embedding table (i.e. the Query Matrix). At inference, only the codebook $\mathbf { C } \in \{ 1 , { \overset { \cdot \cdot } { \dots } } , K \} ^ { n \times D }$ and the Value matrix $\mathbf { V } \in \mathbb { R } ^ { K \times d }$ are needed to construct the embedding table.
41
+
42
+ The $\mathrm { d i s t } ( \cdot , \cdot )$ computes distance measure between two vectors, and use it to decide which discrete code to take.
43
+
44
+ Product values for reverse-discretization function $\rho ( \cdot )$ . Given the codebook $\mathbf { C }$ , the reversediscretization function computes the final continuous embedding vectors. While this can be another sophisticated transformation, we again opt for the most efficient design and employee a single Value matrix $\mathbf { V } \in \mathbb { R } ^ { K \times d }$ as the parameter. Similarly, we leverage product keys, and split the columns of $\mathbf { V }$ into $D$ groups/subspaces the same way as $\mathbf { K }$ and $\mathbf { Q }$ , i.e. $\mathbf { V } ^ { ( j ) } \in \mathbb { R } ^ { K \times d / D }$ . We use the code in each of $D$ dimension to index the subspace in $\mathbf { V }$ , and concatenate the results to form the final embedding vector as follows.
45
+
46
+ $$
47
+ \mathbf { H } _ { i } = [ \mathbf { V } _ { \pmb { c } _ { i } ^ { ( 1 ) } } ^ { ( 1 ) } , \cdots , \mathbf { V } _ { \pmb { c } _ { i } ^ { ( j ) } } ^ { ( j ) } , \cdots , \mathbf { V } _ { \pmb { c } _ { i } ^ { ( D ) } } ^ { ( D ) } ]
48
+ $$
49
+
50
+ We note that this is a simplification, both conceptually and computationally, of the ones used in (Chen et al., 2018b; Shu and Nakayama, 2017), which reduces the computation overhead and eases the optimization.
51
+
52
+ Figure 1 illustrates the proposed framework. The proposed method can also be seen as a learned hash function of finite input into a set of KD codes, and use lookup during the inference instead of re-compute the codes.
53
+
54
+ Storage complexity. Assuming the default 32-bit floating point is used, the original full embedding table requires $3 2 n d$ bits. As for DPQ embedding, we only need to store the codebook and the Value matrix: 1) codebook $\mathbf { C }$ requires $n D \log _ { 2 } K$ bits, which is the only thing that depends on vocabulary size $n$ , and 2) Value matrix $\mathbf { V }$ requires $3 2 K d$ bits1, which does not explicitly depend on $n$ and is ignoble when $n$ is large. Since typically $n D \log _ { 2 } K < 3 2 n d$ , the DPQ embedding is more compact.
55
+
56
+ Inference complexity. Since only indexing and concatenation (Eq. 2) are used during inference, both the extra computation complexity and memory footprint are usually negligible compared to the regular full embedding (which directly indexes an embedding table).
57
+
58
+ Expressiveness. Although the DPQ embedding is more compact than full embedding, it is not achieved by reducing the rank of the matrix (as in traditional low-rank factorization). Instead, it introduces sparsity into the embedding matrix in two axis: (1) the product keys/values, and (2) top-1 selection in each group/subspace.
59
+
60
+ Theorem 1. The DPQ embedding matrix $\mathbf { H }$ is full rank given the following constraints are satisfied.
61
+
62
+ 1) One-hot encoded $\mathbf { C } \in \{ 1 , . . . , K \} ^ { n \times D }$ , denoted as $\mathbf { B } \in \{ 0 , 1 \} ^ { n \times K D }$ , is full-rank.
63
+
64
+ 2) Sub-matrices of splitted $\mathbf { V }$ , i.e. $\mathbf { V } ^ { ( j ) } \in \mathbb { R } ^ { K \times d / D } , \forall j ,$ , are all full-rank.
65
+
66
+ 3) $K D \geq d .$
67
+
68
+ The proof is given in the appendix B. Note that it is easy to keep $\mathbf { H }$ full-rank while achieving good compression ratio, since it is easy to achieve $n D \log _ { 2 } K < 3 2 n d$ with $K D = d$ .
69
+
70
+ So far we have not specified some designs of the discretization function such as the distance function in Eq 1. More importantly, how can we compute gradients through the arg min function in Eq. 1? While there could be many instantiations with different design choices, below we introduce two DPQ instantiations that use two different approximation schemes.
71
+
72
+ # 2.2 SOFTMAX-BASED APPROXIMATION
73
+
74
+ The first instantiation of DPQ (named DPQ-SX) approximates the non-differentiable arg max operation with a differentiable softmax function. To do so, we first specify the distance function in Eq. 1 with a softmax function as follows.
75
+
76
+ $$
77
+ \mathbf { C } _ { i } ^ { ( j ) } = \arg \operatorname* { m a x } _ { k } \frac { \exp ( \langle \mathbf { Q } _ { i } ^ { ( j ) } , \mathbf { K } _ { k } ^ { ( j ) } \rangle ) } { \sum _ { k ^ { \prime } } \exp ( \langle \mathbf { Q } _ { i } ^ { ( j ) } , \mathbf { K } _ { k ^ { \prime } } ^ { ( j ) } \rangle ) }
78
+ $$
79
+
80
+ where $\langle \cdot , \cdot \rangle$ denotes dot product of two vectors (alternatively, other metrics such as Euclidean distance, cosine distance can also be used). To approximate the arg max, similar to (Chen et al., 2018b; Jang et al., 2016), we relax the softmax function with temperature $\tau$ :
81
+
82
+ $$
83
+ \tilde { \mathbf { C } } _ { i } ^ { ( j ) } = \exp ( \langle \mathbf { Q } _ { i } ^ { ( j ) } , \mathbf { K } _ { k } ^ { ( j ) } \rangle / \tau ) / Z
84
+ $$
85
+
86
+ where $\begin{array} { r } { Z = \sum _ { k ^ { \prime } } \exp ( \langle \mathbf { Q } _ { i } ^ { ( j ) } , \mathbf { K } _ { k ^ { \prime } } ^ { ( j ) } \rangle / \tau ) } \end{array}$ . Note that now $\tilde { \mathbf { C } } _ { i } ^ { ( j ) } \in \Delta ^ { K }$ is a probabilistic vector (i.e. soft one-hot vector) instead of an integer $\mathbf { C } _ { i } ^ { ( j ) }$ . And one_h $\cot ( \mathbf { C } _ { i } ^ { ( j ) } ) \approx \tilde { \mathbf { C } } _ { i } ^ { ( j ) }$ , or $\mathbf { C } _ { i } ^ { ( j ) } = \arg \operatorname* { m a x } \tilde { \mathbf { C } } _ { i } ^ { ( j ) }$ With a one-hot code relaxed into soft one-hot vector, we can replace index operation V(j)C˜ (j) with dot product to compute the output embedding vector, i.e. H(j)i = C˜ (j)i V(j).
87
+
88
+ The softmax approximated computation defined above is fully differentiable when $\tau \neq 0$ . However, to compute discrete codes during the forward pass, we have to set $\tau 0$ , which turns the softmax function into a spike concentrated on the $\mathbf { C } _ { i } ^ { ( j ) }$ -th dimension. This is equivalent to the arg max operation which does not have gradient.
89
+
90
+ To enable a pseudo gradient while still be able to output discrete codes, we use a different temperatures during forward and backward pass, i.e. set $\tau 0$ in forward pass, and $\tau 1$ in the backward pass. So the final DPQ function can be expressed as follows.
91
+
92
+ $$
93
+ \mathbf { H } _ { i } = { \mathcal { T } } ( \mathbf { Q } _ { i } | \tau = 1 ) - \operatorname { s g } { \bigg ( } { \mathcal { T } } ( \mathbf { Q } _ { i } | \tau = 1 ) - { \mathcal { T } } ( \mathbf { Q } _ { i } | \tau = 0 ) { \bigg ) }
94
+ $$
95
+
96
+ Where sg is the stop gradient operator, which is identity function in forward pass, but drops gradient for variables inside it during the backward pass.
97
+
98
+ # 2.3 CENTROID-BASED APPROXIMATION
99
+
100
+ The second instantiation of DPQ (named DPQ-VQ) uses a centroid-based approximation, which directly pass the gradient straight-through (Bengio et al., 2013) a small set of centroids. In order to do so, we need to put $\mathbf { Q } , \mathbf { K } , \mathbf { V }$ into the same space.
101
+
102
+ First, we treat rows in Key matrix $\mathbf { K }$ as centroids, and use them to approximate Query matrix $\mathbf { Q }$ . The approximation is based on the Euclidean distance as follows.
103
+
104
+ $$
105
+ \mathbf { C } _ { i } ^ { ( j ) } = \underset { k } { \arg \operatorname* { m i n } } \| \mathbf { Q } _ { i } ^ { ( j ) } - \mathbf { K } _ { k } ^ { ( j ) } \| ^ { 2 }
106
+ $$
107
+
108
+ Secondly, we tie the Key and Value matrices, i.e. $\mathbf { V } = \mathbf { K }$ , so that we can pass the gradient through.
109
+
110
+ We still have the non-differentiable arg min operation, and the input query $\mathbf { Q } _ { i } ^ { ( j ) }$ are different from selected output centroid V(j)C(j) . However, since they are in the same space, it allows us to directly pass the gradient straight-through as follows.
111
+
112
+ $$
113
+ \mathbf { H } _ { i } = \mathbf { Q } _ { i } - \operatorname { s g } ( \mathbf { Q } _ { i } - { \mathcal { T } } ( \mathbf { Q } _ { i } ) )
114
+ $$
115
+
116
+ ![](images/955d58594e2f5dc3d0427ddfee8079bb6df092feb76ab2e75b96e2abba756092.jpg)
117
+ Figure 2: Illustration of two types of approximation to enable differentiability in DPQ.
118
+
119
+ Table 1: Summary of differences between VQ and SX. DPQ-SX allows more flexibility in distance metrics and whether to tie the Key and Value metrices. DPQ-VQ is more efficient during training and therefore is more scalable to larger $K , D$ values.
120
+
121
+ <table><tr><td>Method</td><td>Dist. Metric</td><td>Key/Value matrices</td><td>Train</td><td>Inference</td></tr><tr><td>DPQ-SX</td><td>Dot product and more</td><td>Not tied,allows different sizes</td><td>Efficient</td><td>Efficient</td></tr><tr><td>DPQ-VQ</td><td>Euclidean only</td><td>Tied</td><td>More efficient</td><td>Efficient</td></tr></table>
122
+
123
+ Where sg is again the stop gradient operation. During the forward pass, the selected centroid is emitted, but during the backward pass, the gradient is pass to the query directly. This provides a way to compute discrete codes in the forward pass (which are the indexes of the centroids), and update the Query matrix during the backward pass.
124
+
125
+ However, it is worth noting that the Eq. 7 only approximates gradient for Query matrix, but does not updates the centroids, i.e. the tied Key/Value matrix. Similar to van den Oord et al. (2017), we add a regularization term: $\begin{array} { r } { \mathcal { L } _ { r e g } = \sum _ { i } \Vert \dot { T } ( \mathbf { Q } _ { i } ) - \mathrm { s g } ( \mathbf { Q } _ { i } ) \Vert ^ { 2 } } \end{array}$ , which makes entries of the Key/Value matrix arithmetic mean of their members. Alternatively, one can also use Exponential Moving Average (Kaiser et al., 2018) to update the centroids.
126
+
127
+ A comparison between DPQ-SX and DPQ-VQ. DPQ-VQ and DPQ-SX only differ during training. They are very different in how they approximate the gradient for the non-differentiable arg min function: DPQ-SX approximates the one-hot vector with softmax, while DPQ-VQ approximates the continuous vector using a set of centroids. Figure 2 illustrates this difference. This suggests that when there is a large gap between one-hot and probabilistic vectors (large $K$ ), DPQ-SX approximation could be poor; and when there is a large gap between the continuous vector and the selected centroid (large subspace dimension, i.e. small $D$ ), DPQ-VQ could have a big approximation error.
128
+
129
+ Table 1 summarizes the comparisons between DPQ-SX and DPQ-VQ. DPQ-SX is more flexible as it does not constrain the distance metric, nor does it tie the Key/Value matrices as in DPQ-VQ. Thus one could use different sizes of Key and Value matrices. Regarding to the computational cost during training, DPQ-SX back-propagates through the whole distribution of $K$ choices, while DPQ-VQ only back-propagates through the nearest centroid, making it more scalable (to large $K , D$ , and batch sizes).
130
+
131
+ # 3 EXPERIMENTS
132
+
133
+ We conduct experiments on ten datasets across three tasks: language modeling (LM), neural machine translation (NMT) and text classification (TextC) 2 We adopt existing architectures for these tasks as base models and only replace the input embedding layer with DPQ embeddings. The details of datasets and base models are summarized in Table 2.
134
+
135
+ Table 2: Datasets and models used in our experiments. More details in Appendix C.
136
+
137
+ <table><tr><td>Task</td><td>Dataset</td><td>Vocab Size</td><td>Tokenization</td><td>Base Model</td></tr><tr><td>LM</td><td>PTB Wikitext-2</td><td>10,000 33,278</td><td>Words</td><td>LSTM-based models from Zaremba et al. (2014), three model sizes</td></tr><tr><td rowspan="3">NMT</td><td>IWSLT15 (En-Vi)</td><td>17,191</td><td>Words</td><td>Seq2seq-based model from Luong et al. (2017)</td></tr><tr><td>IWSLT15 (Vi-En) WMT19 (En-De)</td><td>7,709 32,000</td><td>Sub-words</td><td>Transformer Base in Vaswani et al. (2017)</td></tr><tr><td>AG News Yahoo! Ans.</td><td>69,322</td><td></td><td>One hidden layer after mean pooling of</td></tr></table>
138
+
139
+ Table 3: Comparisons of DPQ variants vs. the full embedding baselines.
140
+
141
+ <table><tr><td>Task</td><td>Metric</td><td>Dataset</td><td>Baseline</td><td>DPQ-SX</td><td>(CR)</td><td>DPQ-VQ</td><td>(CR)</td></tr><tr><td rowspan="2">LM</td><td rowspan="2">PPL</td><td>PTB</td><td>83.38</td><td>83.17</td><td>(163.2)</td><td>83.27</td><td>(58.67)</td></tr><tr><td>Wikitext-2</td><td>95.61</td><td>94.94</td><td>(59.25)</td><td>95.92</td><td>(95.25)</td></tr><tr><td rowspan="3">NMT</td><td rowspan="3">BLEU</td><td>IWSLT15 (En-Vi)</td><td>25.4</td><td>25.3</td><td>(86.17)</td><td>25.3</td><td>(16.13)</td></tr><tr><td>IWSLT15 (Vi-En)</td><td>23.0</td><td>23.1</td><td>(72.00)</td><td>22.5</td><td>(14.05)</td></tr><tr><td>WMT19 (En-De)</td><td>38.8</td><td>38.8</td><td>(18.00)</td><td>38.7</td><td>(18.23)</td></tr><tr><td rowspan="5">TextC</td><td rowspan="5">Acc(%)</td><td>AG News</td><td>92.59</td><td>92.49</td><td>(19.26)</td><td>92.55</td><td>(23.95)</td></tr><tr><td>Yahoo! Ans.</td><td>69.41</td><td>69.62</td><td>(48.16)</td><td>69.15</td><td>(19.24)</td></tr><tr><td>DBpedia</td><td>98.12</td><td>98.13</td><td>(24.08)</td><td>98.14</td><td>(38.45)</td></tr><tr><td>Yelp P</td><td>93.92</td><td>94.17</td><td>(38.52)</td><td>93.91</td><td>(24.04)</td></tr><tr><td>Yelp F</td><td>60.33</td><td>60.10</td><td>(48.16)</td><td>60.22</td><td>(24.05)</td></tr></table>
142
+
143
+ We evaluate the models using two metrics: task performance and compression ratio. Task performance metrics are perplexity scores for LM tasks, BLEU scores for NMT tasks, and accuracy in TextC tasks. Compression ratios for the embedding layer is computed as follows:
144
+
145
+ For DPQ in particular, this can be computed as $\begin{array} { r } { \mathbf { C R } \ = \ \frac { 3 2 n d } { n D \log _ { 2 } K + 3 2 K d } } \end{array}$ . Further compression 2 can be achieved with ‘subspace-sharing’ as described in Appendix E.2. With subspace-sharing, CR = 32ndnD log2 K+32Kd/D .
146
+
147
+ # 3.1 COMPRESSION RATIOS AND TASK PERFORMANCE AGAINST BASELINES
148
+
149
+ Table 3 summarizes the task performance and compression ratios of DPQ-SX and DPQ-VQ against baseline models that use the regular full embeddings3. In each task/dataset, we report results from a configuration that gives as good task performance as the baseline (or as good as possible, if it does not match with the baseline) while providing the largest compression ratio. In all tasks, both DPQ-SX and DPQ-VQ can achieve comparable or better task performance while providing a compression ratio from $1 4 \times$ to $1 6 3 \times$ . In 6 out of 10 datasets, DPQ-SX performs strictly better than DPQ-VQ in both metrics. Remarkably, DPQ is able to further compress the already-compact sub-word representations. This shows great potential of DPQ to learn very compact embedding layers.
150
+
151
+ We also compare DPQ against the following recently proposed embedding compression methods (Chen et al., 2018b; Shu and Nakayama, 2017). Pre-train: a three-step procedure where one firstly trains a full model, secondly learns discrete codes to reconstruct the pre-trained embedding layer and thirdly fixes the discrete codes and trains the model again; E2E: end-to-end training without distillation guidance from a pre-trained embedding table; E2E-dist.: end-to-end training with a distillation procedure that uses a pre-trained embedding as guidance during training. Table 4 shows the comparison between DPQ and the above methods on the PTB language modeling task using LSTMs with three different model sizes. We find that 1) both Pre-train and E2E achieve good compression ratios but with worse perplexity scores on the Medium and Large models, 2) the E2E-dist. method has the same compression ratio as them and is able to achieve similar perplexity scores as the full embedding baseline, with the downside that it requires the extra distillation procedure, 3) DPQ variants (particularly DPQ-SX) are able to obtain extremely competitive perplexity scores in all cases, while offering compression ratios that are an order of magnitude larger than the alternatives.
152
+
153
+ Table 4: Comparison of DPQ against recently proposed embedding compression techniques on the PTB LM task (LSTMs with three model sizes are studied). Metrics are perplexity (PPL) and compression ratio (CR).
154
+
155
+ <table><tr><td></td><td colspan="2">Small</td><td colspan="2">Medium</td><td colspan="2">Large</td></tr><tr><td>Method</td><td>PPL</td><td>CR</td><td>PPL</td><td>CR</td><td>PPL</td><td>CR</td></tr><tr><td>Full</td><td>114.5</td><td>1</td><td>83.4</td><td>1</td><td>78.7</td><td>1</td></tr><tr><td>Pre-train (Chen et al.,2018b)</td><td>108.0</td><td>4.8</td><td>84.9</td><td>11.7</td><td>80.7</td><td>18.5</td></tr><tr><td>E2E (Chen et al.,2018b)</td><td>108.5</td><td>4.8</td><td>89.0</td><td>11.7</td><td>86.4</td><td>18.5</td></tr><tr><td>E2E-dist. (Chen et al., 2018b)</td><td>107.8</td><td>4.8</td><td>83.1</td><td>11.7</td><td>77.7</td><td>18.5</td></tr><tr><td>DPQ-SX</td><td>105.8</td><td>85.5</td><td>82.0</td><td>82.9</td><td>78.5</td><td>238.3</td></tr><tr><td>DPQ-VQ</td><td>106.5</td><td>51.1</td><td>83.3</td><td>58.7</td><td>79.5</td><td>238.3</td></tr></table>
156
+
157
+ ![](images/96905d1cb4059094d1889566d78f1602fc49f7ecf6fe57431c26c0af8a3b3e4b.jpg)
158
+ Figure 3: Heat-maps of task performance and compression ratio for various $K$ and $D$ values. Darker is better. Key observations are: 1) increasing $K$ or $D$ typically improves the task performance at the expense of lower CRs; 2) the combination of a small $K$ and a large $D$ is better than the other way round.
159
+
160
+ # 3.2 EFFECTS OF $K$ AND $D$
161
+
162
+ Among key hyper-parameters of DPQ are the code size: $K$ the number of centroids per dimension and $D$ the code length. Figure 3 shows the task performance and compression ratios for different $K$ and $D$ values on PTB and IWSLT15 (En-Vi). Firstly, we observe that the combination of a small $K$ and a large $D$ is a better configuration than the other way round. For example, in IWSLT15 (En-Vi), $( K = 2 , D = 1 2 8 )$ is better than $( K = 1 2 8 , D = 8 )$ in both BLEU and CR, with both DPQ-SX and DPQ-VQ. Secondly, increasing $K$ or $D$ would typically improve the task performance at the expense of lower CRs, which means one can adjust $K$ and $D$ to achieve the best task performance and compression ratio trade-off. Thirdly, we note that decreasing $D$ has a much more traumatic effect on DPQ-VQ than on DPQ-SX in terms of task performance. This is because as the dimension of each sub-space $( d / D )$ increases, the nearest neighbour approximation (that DPQ-VQ relies on) becomes less exact.
163
+
164
+ # 3.3 COMPUTATIONAL COST
165
+
166
+ DPQ incurs a slightly higher computational cost during training and no extra cost at inference. Figure 4 shows the training speed as well as the (GPU) memory required when using DPQ on the medium
167
+
168
+ LSTM model, trained on Tesla-V100 GPUs. For most $K$ and $D$ values, the extra training time is within $10 \%$ , and the extra training memory is zero. For very large $K$ and $D$ values, DPQ-VQ has better computational efficiency than DPQ-SX (as expected). At inference, we do not observe any impact on speed or memory from DPQ.
169
+
170
+ ![](images/2bbedc2bc5fb4f3aa65cb155175a27273e4dc864c8401bd683d5c9ac57bccc4e.jpg)
171
+ Figure 4: Extra training cost incurred by DPQ, measured on a medium sized LSTM for LM trained on Tesla-V100 GPUs. For most $K$ and $D$ values, the extra training time is within $10 \%$ , and the extra memory usage is zero. For very large $K$ and $D$ values, DPQ-VQ has better computational efficiency than DPQ-SX in both memory and speed (as expected).
172
+
173
+ # 3.4 CODE STUDY
174
+
175
+ To better understand the KD codes learned end-to-end via DPQ, we investigated the codes and observed the following. Firstly, the centroids in all $D$ groups are usually well utilized (Appendix D.1). Secondly, the KD codebook changes as training progresses, but the rate of change decreases throughout training and converges to $< 2 0 \%$ (Appendix D.2). Thirdly, the nearest neighbours in the continuous embedding space between DPQ and the baseline align very well (Appendix D.3). Finally, we also list the learned codes for selected words in Appendix D.4.
176
+
177
+ # 4 RELATED WORK
178
+
179
+ Modern neural networks have many parameters and redundancies. The compression of such models has attracted many research efforts (Han et al., 2015; Howard et al., 2017; Chen et al., 2018a). Most of these compression techniques focus on the weights that are shared among many examples, such as convolutional and dense layers (Howard et al., 2017; Chen et al., 2018a). The embedding layers are different in the sense that they are tabular and very sparsely accessed, i.e. the pruning cannot remove rows/symbols in the embedding table, and only a few symbols are accessed in each data sample. This makes the compression challenges different for the embedding layers.
180
+
181
+ Existing work on compressing embedding layers includes (Shu and Nakayama, 2017; Chen et al., 2018b), which also leverages discrete codes. However, we propose a new formulation from product quantization perspective, in which discrete codes are compute from product quantization on some continuous space. This formulation makes it more general and allows two types of instantiations with different gradient approximation. The product keys and values in our model also make it more efficient in both training and inference. Empirically, DPQ achieve better compression ratios without resorting to the extra distillation process.
182
+
183
+ Our work differs from traditional quantization techniques (Jegou et al., 2010) in that they can be trained in an end-to-end fashion. The idea of utilizing multiple orthogonal subspaces/groups for quantization is used in product quantization (Jegou et al., 2010; Norouzi and Fleet, 2013) and multi-head attention (Vaswani et al., 2017).
184
+
185
+ The two approximation techniques presented for DPQ in this work also share similarities with Gumbel-softmax (Jang et al., 2016) and VQ-VAE (van den Oord et al., 2017). However, we do not find using stochastic noises (as in Gumbel-softmax) useful since we aim to get deterministic codes. It is also worth pointing out that these techniques (Jang et al., 2016; van den Oord et al., 2017) by themselves cannot be directly applied to compression.
186
+
187
+ # 5 CONCLUSION
188
+
189
+ In this work, we propose a novel and general differentiable product quantization framework for learning compact embedding layers. We provide two instantiations of our framework, which can readily serve as a drop-in replacement for existing embedding layers. Empirically, we evaluate the proposed method on ten datasets across three different language tasks, and show that our method surpasses existing compression methods and can compress the embedding table up to $2 3 8 \times$ without suffering a performance loss. In the future, we plan to apply the DPQ framework to a wider range of applications and architectures.
190
+
191
+ # REFERENCES
192
+
193
+ Rohan Anil, Vineet Gupta, Tomer Koren, and Yoram Singer. Memory-Efficient Adaptive Optimization for Large-Scale Learning. In arXiv, 2019.
194
+
195
+ Yoshua Bengio, Nicholas Léonard, and Aaron Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013.
196
+
197
+ Antoine Bordes, Nicolas Usunier, Alberto Garcia-Duran, Jason Weston, and Oksana Yakhnenko. Translating embeddings for modeling multi-relational data. In Advances in neural information processing systems, pages 2787–2795, 2013.
198
+
199
+ Ting Chen, Ji Lin, Tian Lin, Song Han, Chong Wang, and Denny Zhou. Adaptive mixture of low-rank factorizations for compact neural modeling. Neural Information Processing Systems (CDNNRIA workshop), 2018a.
200
+
201
+ Ting Chen, Martin Renqiang Min, and Yizhou Sun. Learning k-way d-dimensional discrete codes for compact embedding representations. In International Conference on Machine Learning, 2018b.
202
+
203
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
204
+
205
+ Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. arXiv preprint arXiv:1510.00149, 2015.
206
+
207
+ 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.
208
+
209
+ Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax. arXiv preprint arXiv:1611.01144, 2016.
210
+
211
+ Herve Jegou, Matthijs Douze, and Cordelia Schmid. Product quantization for nearest neighbor search. IEEE transactions on pattern analysis and machine intelligence, 33(1):117–128, 2010.
212
+
213
+ Armand Joulin, Edouard Grave, Piotr Bojanowski, and Tomas Mikolov. Bag of tricks for efficient text classification. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics, 2017.
214
+
215
+ Łukasz Kaiser, Aurko Roy, Ashish Vaswani, Niki Parmar, Samy Bengio, Jakob Uszkoreit, and Noam Shazeer. Fast decoding in sequence models using discrete latent variables. arXiv preprint arXiv:1803.03382, 2018.
216
+
217
+ Yehuda Koren, Robert Bell, and Chris Volinsky. Matrix factorization techniques for recommender systems. Computer, pages 30–37, 2009.
218
+
219
+ Taku Kudo and John Richardson. Sentencepiece: A simple and language independent subword tokenizer and detokenizer for neural text processing. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 66–71, 2018.
220
+
221
+ Minh-Thang Luong, Eugene Brevdo, and Rui Zhao. Neural machine translation (seq2seq) tutorial. https://github.com/tensorflow/nmt, 2017.
222
+
223
+ Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781, 2013.
224
+
225
+ Mohammad Norouzi and David J Fleet. Cartesian k-means. In Proceedings of the IEEE Conference on computer Vision and Pattern Recognition, pages 3017–3024, 2013.
226
+
227
+ Raphael Shu and Hideki Nakayama. Compressing word embeddings via deep compositional code learning. arXiv preprint arXiv:1711.01068, 2017.
228
+
229
+ Richard Socher, Danqi Chen, Christopher D Manning, and Andrew Ng. Reasoning with neural tensor networks for knowledge base completion. In Advances in neural information processing systems, pages 926–934, 2013.
230
+
231
+ Aaron van den Oord, Oriol Vinyals, et al. Neural discrete representation learning. In Advances in Neural Information Processing Systems, pages 6306–6315, 2017.
232
+
233
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pages 5998–6008, 2017.
234
+
235
+ Wojciech Zaremba, Ilya Sutskever, and Oriol Vinyals. Recurrent neural network regularization. arXiv preprint arXiv:1409.2329, 2014.
236
+
237
+ Xiang Zhang, Junbo Zhao, and Yann LeCun. Character-level convolutional networks for text classification. In Advances in neural information processing systems, pages 649–657, 2015.
238
+
239
+ # A ALGORITHM PSEUDO-CODE
240
+
241
+ This section lays out the algorithm pseudo-code for the DPQ embedding layer during the forward training/inference pass.
242
+
243
+ <table><tr><td colspan="2">Algorithm1 DPQ for the i-th token in the vocab (training, forward pass)</td></tr><tr><td>h-params :K, D</td></tr><tr><td>parameters: Q∈RnxDx(d/D), K,V E RKxDx(d/D),C e {1,.,K}nxD</td></tr><tr><td>for j in 1.,...,D do C() = arg max dist(Q), K)) i (j)</td></tr><tr><td>hi V(j) C)</td></tr><tr><td>end for ,h(2), ,(D)</td></tr></table>
244
+
245
+ <table><tr><td>Algorithm 2 DPQ for the i-th token in the vocab (inference)</td></tr><tr><td>h-params :K, D parameters: V ∈ RKxDx(d/D), C ∈ {1,...,K}nxD</td></tr><tr><td>for j in 1,...,D do V(j)</td></tr><tr><td>C) end for ,h(D)</td></tr></table>
246
+
247
+ # B PROOF OF THEOREM 1
248
+
249
+ Proof. We first re-parameterize both the codebook $\mathbf { C }$ and the Value matrix $\mathbf { V }$ as follows.
250
+
251
+ The original codebook is $\mathbf { C } \in \{ 1 , \cdots , K \} ^ { n \times D }$ , and we turn each code bit, which is an integer in $\{ 1 , \cdots , K \}$ , into a small one-hot vector of length- $K$ . This results in the new binary codebook $\mathbf { B } \in \{ 0 , 1 \} ^ { n \times K D }$ . Per our constraint in theorem 1, $\mathbf { B }$ is a full rank matrix.
252
+
253
+ The original Value matrix is $\mathbf { V } \in \mathbb { R } ^ { K \times d }$ , and we turn it into a block-diagonal matrix $\mathbf { U } \in \mathbb { R } ^ { K D \times d }$ where the $j$ -th block-diagonal is set to $\mathbf { V } ^ { ( j ) } \in \mathbb { R } ^ { K \times ( d / D ) }$ . Given that each block diagonal, i.e. $\mathbf { V } ^ { ( j ) }$ , is full rank, the resulting block diagonal matrix $\mathbf { U }$ is also full rank.
254
+
255
+ With the above re-parameterization, we can write the output embedding matrix $\mathbf { H } = \mathbf { B } \mathbf { U }$ . Given both $\mathbf { B }$ and $\mathbf { U }$ are full rank and $K D \ge d$ , the resulting embedding matrix $\mathbf { H }$ is also full rank. □
256
+
257
+ # C DETAILS OF MODEL TRAINING
258
+
259
+ We follow the training settings of the base models used, and most of the time, just tune the DPQ hyper-parmeters such as $K$ , $D$ and/or subspace-sharing. We also apply batch normalization for the distance measure in DPQ along the K-dimension, i.e. each centroid will have a normalized distance distribution with batch samples.
260
+
261
+ For training the Transformer Model on WMT’19 En-De dataset, the training set contains approximately 27M parallel sentences. We generated a vocabulary of $3 2 \mathrm { k }$ sub-words from the training data using the SentencePiece tokenizer (Kudo and Richardson, 2018). The architecture is the Transformer Base configuration described in Vaswani et al. (2017) with a context window size of 256 tokens. All models were trained with a batch size of 2048 sentences for $2 5 0 \mathrm { k }$ steps, and with the SM3 optimizer (Anil et al., 2019) with momentum 0.9 and a quadratic learning rate warm-up schedule with 10k warm-up steps. We searched the learning rate in $\left. 0 . 1 , 0 . 3 \right.$ .
262
+
263
+ # D CODE STUDY
264
+
265
+ # D.1 CODE DISTRIBUTION
266
+
267
+ DPQ discretizes the embedding space into the KD codebook in $\{ 1 , . . . , K \} ^ { n \times D }$ . We examine the code distribution by computing the number of times each discrete code in each of the $D$ groups is used in
268
+
269
+ the entire codebook:
270
+
271
+ $$
272
+ \mathrm { C o u n t } _ { k } ^ { ( j ) } = \sum _ { i = 1 } ^ { n } ( \mathbf { C } _ { i } ^ { ( j ) } = = k ) , \forall j \in \{ 1 , . . . , D \} , k \in \{ 1 , . . . , K \}
273
+ $$
274
+
275
+ Figure 5 shows the code distribution heat-maps for the Transformer model on WMT’19 En-De, with $K = 3 2$ and $D = 3 2$ and no subspace-sharing. We find that 1) DPQ-VQ has a more evenly distributed code utilization, 2) DPQ-SX has a more concentrated and sparse code distribution: in each group, only a few discrete codes are used, and some codes are not used in the codebook.
276
+
277
+ ![](images/8b2b4c6460d5143ecc851a71fb7ea5bca32fc80f1b860f70da0b85bbc4e3a539.jpg)
278
+ Figure 5: Code heat-maps. Left: DPQ-SX. Right: DPQ-VQ. $x$ -axis: K codes per group. $y$ -axis: D groups. $K = D = 3 2$ .
279
+
280
+ # D.2 RATE OF CODE CHANGES
281
+
282
+ We investigate how the codebook changes during training by computing the percentage of code bits in the KD codebook C changed since the last saved checkpoint. An example is plotted in Figure 6 for the Transformer on WMT’19 En-De task, with $D = 1 2 8$ and various $K$ values. Checkpoints were saved every 600 iterations. Interestingly, for DPQ-SX, code convergence remains about the same for different $K$ values; while for DPQ-VQ, the codes takes longer to stabilize for larger $K$ values.
283
+
284
+ ![](images/018059a8c4002ce00873cac0ea234f6dfbbc11726391c70c923c57b545b4f961.jpg)
285
+ Figure 6: Percentage of code bits in codebook which changed from the previous checkpoint. Transformer on WMT’19 En-De. $D = 1 2 8$ for all runs. Checkpoints are saved every 600 iterations.
286
+
287
+ # D.3 NEAREST NEIGHBOURS OF RECONSTRUCTED EMBEDDINGS
288
+
289
+ Table 5, 6 and 7 show examples of nearest neighbours in the reconstructed continuous embedding space, trained in the Transformer model on the WMT’19 En-De task. Distance between two subwords is measured by the cosine similarity of their embedding vectors. Baseline is the original full embeddings model. DPQ variants were trained with $K = D = 1 2 8$ with no subspace-sharing.
290
+
291
+ Taking the sub-word ‘_evolve’ as an example, DPQ variants give very similar top 10 nearest neighbours as the original full embedding: both have 7 out of 10 overlapping top neighbours as the baseline model. However, in DPQ-SX the neighbours have closer distances than the baseline, hence a tighter cluster; while in DPQ-VQ the neighbours are further from the original word. We observe similar patterns in the other two examples.
292
+
293
+ Table 5: Nearest neighbours of ‘_evolve’ in the embedding space.
294
+
295
+ <table><tr><td>Baseline (Full)</td><td>Dist</td><td>DPQ-SX</td><td>Dist</td><td>DPQ-VQ</td><td>Dist</td></tr><tr><td>_evolve</td><td>1.000</td><td>_evolve</td><td>1.000</td><td>_evolve</td><td>1.000</td></tr><tr><td>_evolved</td><td>0.533</td><td>_evolved</td><td>0.571</td><td>_evolved</td><td>0.506</td></tr><tr><td>_evolving</td><td>0.493</td><td>_evolution</td><td>0.499</td><td>_develop</td><td>0.417</td></tr><tr><td>_develop</td><td>0.434</td><td>_develop</td><td>0.435</td><td>_evolving</td><td>0.359</td></tr><tr><td>_evolution</td><td>0.397</td><td>_evolving</td><td>0.418</td><td>_developed</td><td>0.320</td></tr><tr><td>_developed</td><td>0.379</td><td>_arise</td><td>0.405</td><td>_development</td><td>0.307</td></tr><tr><td>_developing</td><td>0.316</td><td>_developed</td><td>0.405</td><td>_developing</td><td>0.299</td></tr><tr><td>_arise</td><td>0.298</td><td>_resulted</td><td>0.394</td><td>_evolution</td><td>0.282</td></tr><tr><td>_unfold</td><td>0.294</td><td>_originate</td><td>0.361</td><td>_changed</td><td>0.278</td></tr><tr><td>_emerge</td><td>0.290</td><td>_result</td><td>0.359</td><td>_grew</td><td>0.273</td></tr></table>
296
+
297
+ Table 6: Nearest neighbours of ‘_monopoly’ in the embedding space.
298
+
299
+ <table><tr><td>Baseline</td><td>Dist</td><td>DPQ-SX</td><td>Dist</td><td>DPQ-VQ</td><td>Dist</td></tr><tr><td>_monopoly</td><td>1.000</td><td>_monopoly</td><td>1.000</td><td>_monopoly</td><td>1.000</td></tr><tr><td>_monopolies</td><td>0.613</td><td>_monopolies</td><td>0.762</td><td>_monopolies</td><td>0.509</td></tr><tr><td>monopol</td><td>0.552</td><td>monopol</td><td>0.714</td><td>monopol</td><td>0.483</td></tr><tr><td>_Monopol</td><td>0.380</td><td>_Monopol</td><td>0.531</td><td>_Monopol</td><td>0.341</td></tr><tr><td>_moratorium</td><td>0.271</td><td>_zugestimmt</td><td>0.486</td><td>_dominant</td><td>0.258</td></tr><tr><td>_privileged</td><td>0.269</td><td>legitim</td><td>0.420</td><td>_moratorium</td><td>0.239</td></tr><tr><td>_unilateral</td><td>0.262</td><td>_GroBunternehmen</td><td>0.401</td><td>_autonomy</td><td>0.230</td></tr><tr><td>_miracle</td><td>0.260</td><td>Eigenkapital</td><td>0.400</td><td>_zugelassen</td><td>0.227</td></tr><tr><td>privilege</td><td>0.254</td><td>_wirkungsvoll</td><td>0.399</td><td>_imperial</td><td>0.226</td></tr><tr><td>_dominant</td><td>0.250</td><td>_UCLAF</td><td>0.388</td><td>_capitalist</td><td>0.223</td></tr></table>
300
+
301
+ Table 7: Nearest neighbours of ‘_Toronto’ in the embedding space.
302
+
303
+ <table><tr><td>Baseline</td><td>Dist</td><td>DPQ-SX</td><td>Dist</td><td>DPQ-VQ</td><td>Dist</td></tr><tr><td>_Toronto</td><td>1.000</td><td>_Toronto</td><td>1.000</td><td>_Toronto</td><td>1.000</td></tr><tr><td>_Vancouver</td><td>0.390</td><td>_Chicago</td><td>0.475</td><td>_Orlando</td><td>0.307</td></tr><tr><td>_Tokyo</td><td>0.378</td><td>_Orleans</td><td>0.467</td><td>_Detroit</td><td>0.306</td></tr><tr><td>_Ottawa</td><td>0.372</td><td>_Melbourne</td><td>0.435</td><td>_Canada</td><td>0.280</td></tr><tr><td>_Philadelphia</td><td>0.353</td><td>_Miami</td><td>0.434</td><td>_London</td><td>0.280</td></tr><tr><td>_Orlando</td><td>0.345</td><td>_Vancouver</td><td>0.415</td><td>_Glasgow</td><td>0.276</td></tr><tr><td>_Chicago</td><td>0.340</td><td>_Tokyo</td><td>0.407</td><td>_Montreal</td><td>0.272</td></tr><tr><td>_Canada</td><td>0.330</td><td>_Ottawa</td><td>0.405</td><td>_Vancouver</td><td>0.271</td></tr><tr><td>_Seoul</td><td>0.329</td><td>_Azeroth</td><td>0.403</td><td>_Philadelphia</td><td>0.267</td></tr><tr><td>_Boston</td><td>0.325</td><td>_Antonio</td><td>0.400</td><td>_Hamilton</td><td>0.264</td></tr></table>
304
+
305
+ # D.4 CODE VISUALIZATION
306
+
307
+ Table 8 shows some examples of compressed codes for both DPQ-SX and DPQ-VQ. Semantically related words share common codes in more dimensions than unrelated words.
308
+
309
+ # E ADDITIONAL HYPER-PARAMETERS STUDY
310
+
311
+ # E.1 EFFECTS OF $K$ AND $D$
312
+
313
+ Figure 7 shows extra heatmaps with varied $K$ and $D$ in addition to those in Section 3.2.
314
+
315
+ Table 8: Examples of KD codes.
316
+
317
+ <table><tr><td></td><td colspan="8">DPQ-SX</td><td colspan="8">DPQ-VQ</td></tr><tr><td>_Monday</td><td>26</td><td>5</td><td>0</td><td>7</td><td>0</td><td>6</td><td>1</td><td></td><td>6</td><td></td><td>0</td><td></td><td>4</td><td></td><td></td><td>7</td></tr><tr><td>_Tuesday</td><td></td><td>0</td><td>0</td><td>7</td><td>0</td><td>6</td><td>1</td><td>7</td><td>1</td><td>5722</td><td>0</td><td>22</td><td>0</td><td>33</td><td>11</td><td>7</td></tr><tr><td>_Wednesday</td><td>6</td><td>5</td><td>0</td><td>3</td><td>0</td><td>6</td><td>1</td><td>6</td><td>6</td><td></td><td>3</td><td></td><td>0</td><td>2</td><td>1</td><td>7</td></tr><tr><td>Thursday</td><td>5</td><td>5</td><td>0</td><td>3</td><td>0</td><td>6</td><td>1</td><td>7</td><td>7</td><td></td><td>0</td><td>22</td><td>0</td><td>3</td><td>1</td><td>2</td></tr><tr><td>_Friday</td><td>4</td><td>6</td><td>0</td><td>7</td><td>0</td><td>6</td><td>1</td><td>7</td><td>6</td><td>0</td><td>0</td><td>2</td><td>1</td><td>6</td><td>1</td><td>7</td></tr><tr><td>_Saturday</td><td>4</td><td>0</td><td>6</td><td>7</td><td>0</td><td>6</td><td>1</td><td>0</td><td>6</td><td>2</td><td>0</td><td>2</td><td>3</td><td>3</td><td>1</td><td>7</td></tr><tr><td>_Sunday</td><td>2</td><td>0</td><td>0</td><td>3</td><td>0</td><td>6</td><td>1</td><td>6</td><td>7</td><td>2</td><td>0</td><td>2</td><td>6</td><td>3</td><td>1</td><td>7</td></tr><tr><td>_Obama</td><td>2</td><td>6</td><td>7</td><td></td><td>5</td><td>7</td><td>3</td><td>7</td><td>2</td><td>3</td><td>1</td><td>6</td><td>6</td><td>1</td><td>7</td><td>4</td></tr><tr><td>_Clinton</td><td>2</td><td>4</td><td>7</td><td></td><td>3</td><td>52227</td><td>62566</td><td>7</td><td>5</td><td>333333</td><td>5</td><td>6</td><td>6</td><td>0</td><td>7</td><td>4</td></tr><tr><td>_Merkel</td><td>4</td><td>1</td><td>7</td><td></td><td>6</td><td></td><td></td><td>6</td><td>6</td><td></td><td>1</td><td>1</td><td>45</td><td>6</td><td>7</td><td>4</td></tr><tr><td>_Sarkozy</td><td>7</td><td>6</td><td>7</td><td></td><td>4</td><td></td><td></td><td>0</td><td>0</td><td></td><td>1</td><td>7</td><td></td><td>7</td><td>7</td><td>4</td></tr><tr><td>Berlusconi</td><td>4</td><td>6</td><td>5</td><td>222111</td><td>4</td><td></td><td></td><td>7</td><td>6</td><td></td><td>0</td><td>6</td><td>6</td><td>7</td><td>7</td><td>4</td></tr><tr><td>_Putin</td><td>2</td><td>6</td><td>7</td><td></td><td>6</td><td></td><td></td><td>7</td><td>5</td><td></td><td>1</td><td>6</td><td>6</td><td>7</td><td>7</td><td>6</td></tr><tr><td>_Trump</td><td>7</td><td>6</td><td>7</td><td>2</td><td>0</td><td>7</td><td>6</td><td>7</td><td>2</td><td></td><td>1</td><td>6</td><td>5</td><td>7</td><td>7</td><td>7</td></tr><tr><td>_Toronto</td><td>6</td><td>2</td><td>3</td><td></td><td>4</td><td>2</td><td></td><td>6</td><td>4</td><td>3</td><td>4</td><td>7</td><td>6</td><td>2</td><td>0</td><td>7</td></tr><tr><td>_Vancouver</td><td>2</td><td>1</td><td>3</td><td></td><td>6</td><td>2227</td><td>2521</td><td>6</td><td>7</td><td>333333</td><td>6</td><td>6</td><td>6</td><td>2</td><td>3</td><td>1</td></tr><tr><td>_Ottawa</td><td>2</td><td>5</td><td>6</td><td></td><td>6</td><td></td><td></td><td>7</td><td>6</td><td></td><td>1</td><td>6</td><td>6</td><td></td><td>0</td><td>4</td></tr><tr><td>_Montreal</td><td>4</td><td>0</td><td>0</td><td></td><td>6</td><td></td><td></td><td>7</td><td>4</td><td></td><td>1</td><td>1</td><td>6</td><td>22</td><td>0</td><td>1</td></tr><tr><td>_London</td><td>1</td><td>2</td><td>0</td><td></td><td>4</td><td></td><td>1</td><td>7</td><td>2</td><td></td><td>0</td><td>2</td><td>6</td><td>3</td><td>3</td><td>7</td></tr><tr><td>_Paris</td><td>4</td><td>0</td><td>3</td><td></td><td>4</td><td></td><td>1</td><td>0</td><td>5</td><td></td><td>0</td><td>0</td><td>6</td><td>3</td><td>21</td><td>7</td></tr><tr><td>_Munich</td><td>4</td><td>2</td><td>0</td><td>2212254</td><td>0</td><td>27</td><td>5</td><td>0</td><td>1</td><td></td><td>3</td><td>5</td><td>6</td><td>3</td><td></td><td>7</td></tr></table>
318
+
319
+ ![](images/cdc7799d83529224a29da5462179049b28a0e8d8aa24fc10ac7d7ccc3f5fe669.jpg)
320
+ Figure 7: Heat-maps of task performance and compression ratio. Darker is better.
321
+
322
+ # E.2 SUBSPACE-SHARING
323
+
324
+ Subspace-sharing refers to the option of whether to share parameters among the $D$ groups in the Key/Value Matrices, i.e. constraining $\mathbf { K } ^ { ( j ) } = \mathbf { K } ^ { ( j ^ { \prime } ) }$ and $\bar { \mathbf { V } } ^ { ( j ) } = \mathbf { V } ^ { ( j ^ { \prime } ) } , \forall j , \bar { j } ^ { \prime }$ . For simplicity we refer to this as "subspace-sharing". Subspace-sharing improves the compression ratio to: $\mathrm { C R } =$ $3 2 n d / ( n D \log _ { 2 } K + 3 2 K d / D )$ .
325
+
326
+ Figure 8 shows the trade-off curves of task performance and compression ratio with different DPQ variants, K, D and subspace-sharing. We find that one could vary the hyper-parameters to search for optimal performance and compression trade-off. We also observe the effect of subspace-sharing appears very much task-dependent: it improves perplexity scores in LM tasks but hurts BLEU scores in NMT tasks. For TextC tasks, subspace-sharing seems beneficial for DPQ-SX but harmful for DPQ-VQ.
327
+
328
+ # F RELATIONS TO CHEN ET AL. (2018B) AND OTHER CONVENTIONAL METHODS
329
+
330
+ Both this work and (Chen et al., 2018b) are based on the idea of representing symbols with discrete codes, but there are some major differences which we listed below:
331
+
332
+ ![](images/89215957c751d9ce2a67f470b28d657a8da78bfa3942f69693564c1f1814e478.jpg)
333
+ Figure 8: Task performance vs compression ratio trade-off curves. Each subplot comes from one task/dataset and contains four configurations: $\{ \mathrm { D P X - S X } , \mathrm { D P X - V Q } \} \times \left\{ \begin{array} { r l } \end{array} \right.$ {subspace-sharing, NOsubspace-sharing}.
334
+
335
+ • In (Chen et al., 2018b), discrete codes are directly associated with each of the symbols, in this work, discrete codes are computed as outcome of product quantization. This shift of perspective allows the proposed framework to generalize beyond a fixed set of vocabulary, and be applied in potentially in any other neural network layers as a stand-alone module.
336
+
337
+ • Our formulation of discrete codes with product quantization allows us to derive two variants with different approximation techniques (softmax-based and vector quantization-based), while (Chen et al., 2018b) is only based on softmax approximation.
338
+
339
+ • The product quantization has minimal overhead and is very efficient compared to encoder functions used in (Chen et al., 2018b), i.e. MLP-based and RNN-based functions that compose codes into continuous embedding. Our DPQ has very small memory footprint and computation time overhead (Figure 4). Furthermore, the approximation error are also reduced, and DPQ can be truly trained end-to-end without two pass training with distillation loss as in (Chen et al., 2018b).
340
+
341
+ Here are comparisons to more traditional approaches:
342
+
343
+ • Scalar quantization: it quantize each floating number independently, and has very limited compression ratios. E.g. quantizing float32 into int8 would offer a CR of $3 2 / 8 { = } 4$ , while likely dropping in task performance metrics (e.g. PPL). Product quantization: it generalizes scalar quantization and quantize sub-vectors. However, this approach is non-differentiable (cannot train end-to-end) and requires a post-training procedure. Small quantization errors accumulate and thus performances suffer.
344
+
345
+ • Pruning: pruning in effect reduces the embedding size for each symbol. Therefore its performance is usually less than ideal (Shu and Nakayama, 2017).
346
+ • Low-rank factorization: larger compression ratio requires smaller rank, which in effect reduces embedding table size and leads to worse results.
347
+
348
+ Different from these techniques, DPQ makes use of discrete codes, and uses product quantization to generate discrete codes. Unlike traditional product quantization, we propose techniques to make it end-to-end differentiable so that the neural nets can adapt to quantization error. DPQ also relates to factorization-based method (Theorem 1), but DPQ can produce high-rank embedding tables with sparse factorization.
349
+
350
+ # G COMPARISONS TO MORE BASELINES
351
+
352
+ # G.1 COMPARISONS TO TRADITIONAL COMPRESSION TECHNIQUES
353
+
354
+ Table 9 shows comparisons on PTB language modeling task (medium-sized LSTM) with broader set of baselines (including methods that are not based on discrete codes). We find that 1) traditional compression techniques, such as scalar and product quantization, as well as low-rank factorization, typically degenerates the performance significantly in order to achieve good compression ratios compared to discrete code learning-based methods (Chen et al., 2018b; Shu and Nakayama, 2017); 2) the proposed method (DPQ) can largely improve the compression ratio while achieving similar or better task performance (perplexity in this case).
355
+
356
+ Table 9: Performance comparison on PTB language modeling task. The proposed method provides significantly better compression ratio over baselines while achieving similar or better/smaller PPL.
357
+
358
+ <table><tr><td>Method</td><td>PPL</td><td>Compression ratio</td></tr><tr><td>Full</td><td>83.38</td><td>1.0</td></tr><tr><td>Scalar quantization (8 bits)</td><td>84.06</td><td>4.0</td></tr><tr><td>Scalar quantization (6 bits)</td><td>87.73</td><td>5.3</td></tr><tr><td>Scalar quantization (4 bits)</td><td>92.86</td><td>8.3</td></tr><tr><td>Product quantization(64x325)</td><td>84.03</td><td>8.3</td></tr><tr><td>Product quantization(128x325)</td><td>83.71</td><td>6.7</td></tr><tr><td>Product quantization(256x325)</td><td>83.66</td><td>5.3</td></tr><tr><td>Low-rank (5X)</td><td>84.84</td><td>5.0</td></tr><tr><td>Low-rank (10X)</td><td>85.53</td><td>10.2</td></tr><tr><td>Shu and Nakayama (2017)</td><td>84.92</td><td>12.5</td></tr><tr><td>Chen et al. (2018b)</td><td>83.11</td><td>12.5</td></tr><tr><td>Ours (DPQ-VQ)</td><td>83.3</td><td>58.7</td></tr><tr><td>Ours (DPQ-SX)</td><td>82.0</td><td>82.9</td></tr></table>
359
+
360
+ # G.2 COMPARISONS TO BASELINES ON TEXT CLASSIFICATION
361
+
362
+ Table 10 provides performance comparisons on text classification task. We found that the proposed method (DPQ) usually achieve better accuracies than baselines, at the same time providing better compression ratios.
363
+
364
+ # G.3 COMPARISONS TO POST-TRAINING RECONSTRUCTION-BASED BASELINES ON NMT
365
+
366
+ The proposed method (DPQ) supports end-to-end compact embedding learning. An alternative is learning to reconstruct the learned full embedding table with discrete codes after the model is train. The reconstructed compact embedding table is then used to replace the original embedding table for inference. We name this Reconstruction baseline. In our experiment, we use auto-encoder and DPQ (with different $K$ and $D$ ) to learn to reconstruct the trained full embedding table.
367
+
368
+ Table 11 shows performance comparisons between the proposed method and reconstruction baseline on WMT19 (En-De) translation task based on Transformer (Vaswani et al., 2017). We can see that the reconstruction baseline degenerates the performance significantly. This is expected as small approximation errors in the embedding layer accumulate and can be amplified as the errors propagate through the deep neural nets, finally lead to large error in output space. Our method does not have this problem as the whole system is jointly trained so the later networks can account for small approximation errors in the early layer.
369
+
370
+ Table 10: Performance comparison on text classification task. The accuracy and compression ratios (in parenthesis) are shown below. The proposed method (DPQ) usually achieve better accuracies than baselines, at the same time providing better compression ratios.
371
+
372
+ <table><tr><td>Dataset</td><td>AG News</td><td>Yahoo!</td><td>DBPedia</td><td>Yelp P</td><td>1 YelpF</td></tr><tr><td>Full</td><td>92.6 (1.0)</td><td>69.4 (1.0)</td><td>98.1 (1.0)</td><td>93.9 (1.0)</td><td>60.3 (1.0)</td></tr><tr><td>Low-rank(10×)</td><td>91.4 (10.4)</td><td>69.5 (10.2)</td><td>97.7 (10.3)</td><td>92.4 (10.4)</td><td>57.8 (10.3)</td></tr><tr><td>Low-rank(20×)</td><td>91.5 (21.4)</td><td>69.1 (21.5)</td><td>97.9 (21.3)</td><td>92.4 (21.5)</td><td>57.3 (21.4)</td></tr><tr><td>Chen et al. (2018b)</td><td>91.6 (53.3)</td><td>69.5 (31.7)</td><td>98.0 (48.4)</td><td>93.1 (48.6)</td><td>59.0 (54.4)</td></tr><tr><td>DPQ-VQ</td><td>92.6 (24.0)</td><td>69.2 (19.2)</td><td>98.1 (38.5)</td><td>93.9 (24.0)</td><td>60.2 (24.1)</td></tr><tr><td>DPQ-SX</td><td>92.5 (19.3)</td><td>69.6 (48.2)</td><td>98.1 (24.1)</td><td>94.2 (38.5)</td><td>60.1 (48.2)</td></tr></table>
373
+
374
+ Table 11: Performance comparisons against the reconstruction baselines.
375
+
376
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>BLEU</td><td rowspan=1 colspan=1>CR</td></tr><tr><td rowspan=1 colspan=1>Full</td><td rowspan=1 colspan=1>38.8</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=2 colspan=1>Reconstruction (K=128,D=64)Reconstruction (K=32,D=128)Reconstruction (K=128,D=128)Reconstruction (K=32,D=256)Reconstruction (K=128, D=256)</td><td rowspan=2 colspan=1>28.935.435.736.937.8</td><td rowspan=1 colspan=1>31.9</td></tr><tr><td rowspan=1 colspan=1>25.017.012.68.8</td></tr><tr><td rowspan=1 colspan=1>DPQ-VQ (K=32,D=128)DPQ-SX (K=32,D=128)</td><td rowspan=1 colspan=1>38.738.8</td><td rowspan=1 colspan=1>17.017.0</td></tr></table>
377
+
378
+ # G.4 MORE ABLATIONS ON DPQ-SX
379
+
380
+ Table 12 shows an ablation study on PTB language modeling task (medium-sized LSTM), in which we choose to tie the $K$ and $V$ matrices in DPQ-SX (achieved by sharing a single variable during the optimization process). We fix $\mathrm { K } { = } 1 2 8$ , $\scriptstyle \mathrm { D = 5 0 }$ . We find DPQ-SX (with untied K,V) to perform the best, followed by DPQ-SX (tied K,V) and DPQ-VQ.
381
+
382
+ Table 12: Ablation study of DPQ-SX on whether or not to tie $K$ and $V$ matrices. By default, DPQ-SX does not tie these two matrices.
383
+
384
+ <table><tr><td>Method</td><td>PTB</td><td>Wikitext-2</td></tr><tr><td>DPQ-SX (untied K, V)</td><td>82.4</td><td>95.2</td></tr><tr><td>DPQ-SX (tied K, V)</td><td>83.5</td><td>95.8</td></tr><tr><td>DPQ-VQ</td><td>83.5</td><td>97.0</td></tr></table>
385
+
386
+ # H APPLYING DPQ TO BERT
387
+
388
+ BERT (Devlin et al., 2018) has shown excellent results on a wide range of natural language tasks, therefore it is important to demonstrate that DPQ can also achieve competitive performance on BERT. As our baseline, we pre-trained BERT-base on 512-token sequences for 1M iterations with batch size 1024. We use the same optimizer (Adam) and learning rate schedule as described in Devlin et al. (2018). For the DPQ experiments, we use DPQ-SX with no subspace-sharing, $D = 1 2 8$ and $K = 3 2$ ; these choices are not from hyper-parameter search, but inspired from our results on Transformer on
389
+
390
+ WMT19 EnDe. We pre-trained BERT with embedding layer replaced by our DPQ, and then finetuned all model parameters for downstream tasks. Note that we do not perform additional tuning for the DPQ experiments in either pre-training or finetuning: we used exactly the same configurations and hyperparameters as in our baseline. Table 13 shows that DPQ performs on par with full embedding in most of the downstream tasks, while giving a compression ratio of $3 7 \times$ on the embedding table. This is equivalent to saving 24M parameters in the BERT-base model, or decreasing the total model size by $2 2 . 2 \%$ .
391
+
392
+ Table 13: Effect of using DPQ on BERT. DPQ gives a compression ratio of $3 7 \times$ on the embedding table while the model’s performance on downstream tasks remains competitive.
393
+
394
+ <table><tr><td>Embeddings</td><td>CR</td><td>Squad 1.1</td><td>Squad 2.0</td><td>CoLA</td><td>MNLI</td><td>MRPC</td><td>XNLI</td></tr><tr><td>Full</td><td>1.0</td><td>90.1/83.1</td><td>79.3/76.1</td><td>81.1</td><td>84.2</td><td>86.0</td><td>53.3</td></tr><tr><td>DPQ-SX</td><td>37.0</td><td>90.0/83.1</td><td>78.1/74.9</td><td>80.8</td><td>83.9</td><td>85.8</td><td>53.5</td></tr></table>
md/train/ByToKu9ll/ByToKu9ll.md ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EVALUATION OF DEFENSIVE METHODS FOR DNNS AGAINST MULTIPLE ADVERSARIAL EVASION MODELS
2
+
3
+ Xinyun Chen Shanghai Jiao Tong University jungyhuk@gmail.com
4
+
5
+ Bo Li University of Michigan bbbli@umich.edu
6
+
7
+ Yevgeniy Vorobeychik
8
+ Vanderbilt University
9
+ yevgeniy.vorobeychik@vanderbilt.edu
10
+
11
+ # ABSTRACT
12
+
13
+ Due to deep cascades of nonlinear units, deep neural networks (DNNs) can automatically learn non-local generalization priors from data and have achieved high performance in various applications. However, such properties have also opened a door for adversaries to generate the so-called adversarial examples to fool DNNs. Specifically, adversaries can inject small perturbations to the input data and therefore decrease the performance of deep neural networks significantly. Even worse, these adversarial examples have the transferability to attack a black-box model based on finite queries without knowledge of the target model. Therefore, we aim to empirically compare different defensive strategies against various adversary models and analyze the cross-model efficiency for these robust learners. We conclude that the adversarial retraining framework also has the transferability, which can defend adversarial examples without requiring prior knowledge of the adversary models. We compare the general adversarial retraining framework with the state-of-the-art robust deep neural networks, such as distillation, autoencoder stacked with classifier (AEC), and our improved version, IAEC, to evaluate their robustness as well as the vulnerability in terms of the distortion required to mislead the learner. Our experimental results show that the adversarial retraining framework can defend most of the adversarial examples notably and consistently without adding additional vulnerabilities or performance penalty to the original model.
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ Despite the success of deep neural networks (DNNs) in diverse areas, ranging from image recognition and machine translation to autonomous driving, its vulnerabilities have been exploited in the adversarial environments. Evasion attacks against such deep learning systems have recently received considerable attention. It has been shown that with small magnitude of noise added, the original instance can easily be misclassified by the otherwise accurate deep neural networks (Goodfellow et al., 2014; Papernot et al., 2016c; Nguyen et al., 2015; Szegedy et al., 2013). Such instances are also called adversarial examples.
18
+
19
+ Given the strong evasion properties of these adversarial examples, some works have been proposed to test and investigate the robustness of the deep neural networks against the adversarial examples (Goodfellow et al., 2014; Kurakin et al., 2016; Huang et al., 2015; Gu & Rigazio, 2014; Jin et al., 2015). However, most of the existing works only evaluate the robustness of the proposed defense strategies over adversarial examples generated using a single attack method, or several similar methods. Meanwhile, since the evaluated adversary models, i.e., adversarial example generation methods, vary among different works that study the effectiveness of defense strategies, it remains a question how to make a comparison among different defense strategies.
20
+
21
+ In this paper, we focus on providing thorough analysis for different algorithmic strategic defensive learners against various adversary models considering their robustness against adversarial examples, efficiency for cross-model learning process, resilience against additional attacks, and the vulnerabilities of these learners. Here by “cross-model test”, we mean to apply one adversarial model to generate adversarial examples, while test them on the learner trained with instances generated from different adversarial models. High “cross-model test” accuracy indicates higher robustness for learner. In addition, we propose to test the “additional attacks” in a repeated game setting to estimate learner based on against further attacks. A nice symmetry analysis for both the adversary and learner is provided through these analyses. We show that the general adversarial retraining framework performs significantly robust compared with the state-of-the-art defensive algorithms. For example, even for the black box attack, which is considered hard to defend, as long as there is a way to generate these adversarial evasion examples, the robust adversarial retraining framework can always improve the learning ability without knowing the actual adversary model. To our best knowledge, this work is the first to provide comprehensive analysis for different adversarial models and possible defensive solutions.
22
+
23
+ In summary, we made the following contributions:
24
+
25
+ 1. Evaluate the robustness of the general robust adversarial retraining framework $( R A D )$ with the state-of-the-art AEC, Distillation, and the improved AEC, against different adversary models;
26
+ 2. Propose an improved AutoEncoder stacked with Classifier (IAEC);
27
+ 3. Compare the cross-model learning efficiency of different defensive methods and demonstrate the ability to defend against black-box attacks;
28
+ 4. Demonstrate the robustness of the retraining framework RAD, AEC, IAEC, and Distillation, against new attacks by attacking these robust learners repeatedly;
29
+ 5. Analyze the vulnerabilities induced by different defensive strategies/models based on their tolerance of the malicious distortions required to mislead the classifier.
30
+
31
+ We illustrate the applicability and efficiency of different defensive strategies against various stateof-the-art adversary models based on both MNIST and CIFAR-10 datasets.
32
+
33
+ # 2 RELATED WORK
34
+
35
+ Efforts have been made to understand adversarial examples. Goodfellow et al. (2014) pointed out that the adversarial examples actually make use of the linear nature of the DNNs based on the observation of their generalization across architectures and training sets. Tabacof & Valle (2015) analyzed the adversarial image space and showed that adversarial images appear in large regions in the pixel space. Papernot et al. (2016c) studied the limitation of adversarial evasion examples and showed that some instances are more difficult to manipulate than the others. Sabour et al. (2015) demonstrated that the attacker can change classification to an arbitrary class by malicious manipulations. The reverse engineering problem has been proposed in Vorobeychik & Li (2014), and it theoretically proved that the black-box attack is possible and also showed one could learn a sufficiently similar classifier from queries both theoretically and empirically. Similarly, even without knowing exactly the learning algorithm, several black-box attacks have been proposed targeting DNNs, which demonstrates the transferability of such adversarial examples (Papernot et al., 2016a;b).
36
+
37
+ Some training methods have been proposed to improve the robustness of deep neural networks. Jan et al. (2002) has proposed to explore the perturbed regions and apply ensemble method to enhance the robustness of classification. Zheng et al. have proposed to stabilize the state-of-the-art Inception architecture against different distortions, and it focuses on general random noise or distortions, such as compression, rescaling and cropping on images Zheng et al. (2016). Miyato et al. (2015) have proposed to apply the local distribution smoothness for statistical model to promote the smoothness of the model distribution and conduct the virtual adversarial training to enhance the performance of deep neural networks. However, all these works did not test on the adversarial examples and still had a long way to perform robustly against these real adversarial instances.
38
+
39
+ While the existence of adversarial examples is attracting more and more attention, some defense strategies have been proposed to defend against such adversarial examples. In Goodfellow et al. (2014), Goodfellow et al. proposed to train the network with an adversarial objective function based on fast gradient sign method: $\tilde { J } ( \theta , x , y ) = \alpha J ( \theta , x , y ) + ( 1 - \alpha ) J ( \theta , x + \nabla _ { x } J ( \theta , x , y ) , y )$ . In a concurrent and independent work, Kurakin et al. provided an adversarial training method for a large scale dataset, i.e., ImageNet dataset Kurakin et al. (2016). However, they only used fast gradient sign-based methods to generate adversarial examples for both training and evaluation, which fails to consider the generality of defensive strategy. Huang et al. Huang et al. (2015) proposed an alternative method for adversarial training by considering an empirically stronger adversary. In their work, suppose $r ^ { \star }$ is the optimal adversarial perturbation for an instance $( x , y )$ , instead of adding $( x + r ^ { \star } , y )$ into the training dataset, they used “pseudo-samples” for training controlled by a hyperparameter $c$ , which represents the magnitude of perturbation, i.e., $\begin{array} { r } { ( x + c \frac { r ^ { \star } } { | | r ^ { \star } | | } , y ) } \end{array}$ . Several autoencoder structures Vincent et al. (2008) have been proposed against the adversarial examples by reconstructing the original images ahead of classification Gu & Rigazio (2014). Jin et al. have proposed a feedforward CNN structure to improve the robustness in the presence of adversarial noise, which is restricted to the specific type of models in Jin et al. (2015). However, the focus of these researches perform too aggressively on designing robust learning algorithms against arbitrary small perturbations (e.g., noise) neglecting the properties of actual adversarial evasion models. Therefore, studying various adversarial models and building resilient learners accordingly is important. Here we will provide comparisons for defensive algorithms facing different adversarial models to provide insights and encourage devising more efficient learner.
40
+
41
+ # 3 PROBLEM
42
+
43
+ To understand the phenomenon of adversarial examples in deep neural networks, we aim to analyze potential defending methods against different adversary models from various perspectives, such as the robustness of the learner itself, the cross-model generalization ability, the resilience against additional attacks, and the vulnerabilities in terms of the required distortion to attack the robust learner again. Let $X \subseteq R ^ { n }$ represent the feature space, with $n$ the number of features. For every instance $x _ { i } \in X$ , which is drawn from certain distribution $x _ { i } \sim D$ , there is a corresponding label $y _ { i } \in \mathcal { V }$ to comprise the data pair $( x _ { i } , y _ { i } )$ , where $x _ { i j }$ denotes the $j$ th feature of $x _ { i }$ .
44
+
45
+ In the adversarial environments, adversary would like to accomplish the goal of evading the classifier. To formalize, suppose that $M \subseteq \mathcal { V }$ is a set of labels which an adversary wishes to attack, and let $z ( m )$ be the target label for each $m \in M$ . For example, for autonomous driving, potential adversaries may aim to manipulate a stop sign or a dead-end warning sign, to a lamppost, a tree, or an advertisement sign, to cause accidents. Since such perturbations on images towards deep neural networks are often imperceptible to human eyes, it can cause serious vulnerabilities when deploying the DNNs in real adversarial environments. The defender’s goal is to learn a classifier with parameters $w$ , $g _ { w } : x _ { i } \to \mathcal { V }$ , using a training data set of labeled instance $T = \{ ( x _ { 1 } , y _ { 1 } ) , . . . , ( x _ { m } , \bar { y } _ { m } ) \}$ . Here, we focus on deep neural networks representing the function $g _ { w } ( \cdot )$ . Therefore, the learner’s objective is to minimize the following general loss function:
46
+
47
+ $$
48
+ \operatorname* { m i n } _ { w } \mathcal { L } ( w ; \mathcal { A } ) = \sum _ { \substack { i : y _ { i } \in \mathcal { Y } \backslash M } } l ( g _ { w } ( x _ { i } ) , y _ { i } ) + \sum _ { \substack { i : y _ { i } \in M } } l ( g _ { w } ( \mathcal { A } ( w , x _ { i } ) , y _ { i } ) + \alpha \| w \| _ { p } ^ { p } ,
49
+ $$
50
+
51
+ where $l ( \cdot )$ can be arbitrary loss function and $\mathcal { A }$ represents the adversary model.
52
+
53
+ The adversarial risk function in Equation 1 is general: it can be any adversary model oracle, $\mathcal { A }$ , which is used to generate the adversarial evasion instances. Traditionally, this adversarial oracle may capture evasion attack models based on minimizing evasion cost (Lowd & Meek, 2005; Li & Vorobeychik, 2014; Biggio et al., 2014), or based on actual attacker evasion behavior obtained from experimental data (Ke et al., 2016). More formally, we will discuss the potential adversary models for deep neural networks and the possible defensive models for the learner in detail below.
54
+
55
+ # 3.1 ADVERSARY MODEL
56
+
57
+ To mislead deep neural networks, various methods have been proposed to generate the adversarial examples. We mainly discuss three state-of-the-art adversary models $\mathcal { A }$ here for further evaluation.
58
+
59
+ Fast Gradient Sign. Based on the linear view of adversarial examples, a fast way of generating these adversarial examples were proposed in Goodfellow et al. (2014). Suppose $x _ { i }$ is the original feature vector, based on adversary model $\mathcal { A } ( f g s )$ , we have ${ x _ { i } } ^ { \prime } = x _ { i } + \eta$ , where $\eta$ represents the perturbation
60
+
61
+ added for the original instance. Therefore, the dot product between the weighted parameter vector $w$ and an adversarial example ${ x } _ { i } ^ { \prime }$ becomes:
62
+
63
+ $$
64
+ w ^ { T } x _ { i } { ' } = w ^ { T } x _ { i } + w ^ { T } \eta .
65
+ $$
66
+
67
+ Let ${ \cal J } ( w , x _ { i } , y _ { i } )$ be the cost used to train the neural network. By linearizing the cost function around the current value of $w$ , an optimal max-norm constrained perturbation is generated as
68
+
69
+ $$
70
+ \eta = \mathrm { { \epsilon s i g n } } { \left( \nabla _ { x } J ( w , x _ { i } , y _ { i } ) \right) } ,
71
+ $$
72
+
73
+ where the adversary can vary $\epsilon$ to generate adversarial examples with different attacking abilities for different deep neural networks.
74
+
75
+ Coordinate Greedy. Another more general adversary model $\scriptstyle A ( c g )$ is the local search framework Coordinate Greedy (cg) proposed in Li et al. (2016) for approximating the optimal adversarial instance. As an illustration, we focus on binary classification, and assume that $\operatorname { \dot { \phantom { } } g } _ { w } ( x ) = \operatorname { s i g n } ( f ( x ) )$ for some continuous function $f$ , which in this case would be represented by a deep neural network.
76
+
77
+ The coordinate greedy approach is quite general, but we consider a specific adversary objective in which the adversary here tries to balance between two considerations: 1) appear as benign as possible to the classifier, and 2) minimize the cost of modification of the original instance (e.g., minimally manipulate the image). Note that it is also natural to assume that the attacker obtains no value from a manipulation to the original feature vector if the result is still classified as malicious. Therefore, an adversary aiming to transform an instance $x _ { i }$ into an adversarial example $x _ { i } { } ^ { \prime }$ is solving the following optimization problem:
78
+
79
+ $$
80
+ \operatorname* { m i n } _ { { x _ { i } } ^ { \prime } \in X } \operatorname* { m i n } \{ 0 , f ( { x _ { i } } ^ { \prime } ) \} + c ( { x _ { i } } ^ { \prime } , { x _ { i } } ) ,
81
+ $$
82
+
83
+ where $c ( x _ { i } ^ { \prime } , x _ { i } )$ is the cost function of modifying from $x _ { i }$ to ${ x } _ { i } ^ { \prime }$ . Here $c ( x _ { i } ^ { \prime } , x _ { i } ) \geq 0$ , $c ( x _ { i } ^ { \prime } , x _ { i } ) = 0$ iff $x _ { i } { ' } = x _ { i }$ , and the cost function $c$ is strictly increasing in $\| { x } _ { i } ^ { \prime } - { x } _ { i } \| _ { 2 }$ and strictly convex in $x _ { i } { ' }$ . Because Problem 2 is non-convex, so the objective of adversary can be formed to minimize an upper bound:
84
+
85
+ $$
86
+ \operatorname* { m i n } _ { { x _ { i } } ^ { \prime } } Q ( x _ { i } { ' } ) \equiv f ( x _ { i } { ' } ) + c ( x _ { i } { ' } , x _ { i } ) .
87
+ $$
88
+
89
+ So the high-level idea of $c g$ is to iteratively choose a feature, and greedily update this feature according to the partial derivatives of the attacker’s objective as 3 to evade the classifier. Below, we take the exponential cost function $c ( x _ { i } { ' } , x _ { i } ) = \mathrm { e x p } \left( \lambda ( \sum _ { j } ( x _ { i j } { ' } - x _ { i j } ) ^ { 2 } + 1 ) ^ { 1 / 2 } \right)$ as an example to estimate the modification cost, which is also quite natural: options become exponentially less desirable to an attacker as they are more distant from their ideal attack. Then we take the following partial derivative to update the adversary’s objective until the convergence.
90
+
91
+ $$
92
+ \frac { \partial Q ( x _ { i } { ' } ) } { \partial x _ { i j } } = \frac { \partial f ( x _ { i } { ' } ) } { \partial x _ { i j } } + \frac { \partial c ( x _ { i } { ' } , x _ { i } ) } { \partial x _ { i j } } = \frac { \partial f ( x _ { i } { ' } ) } { \partial x _ { i j } } + \frac { \lambda c ( x _ { i } { ' } , x _ { i } ) ( x _ { i j } { ' } - x _ { i j } ) } { ( \sum _ { j } ( x _ { i j } { ' } - x _ { i j } ) ^ { 2 } + 1 ) ^ { 1 / 2 } } ,
93
+ $$
94
+
95
+ To avoid the algorithm converges only to a locally optimal solution, random restarts strategy is applied to randomly select the starting points in the feature space. As long as a global optimum has a basin of attraction with positive Lebesgue measure, or the feature space is finite, this process will asymptotically converge to a globally optimal solution with enough random restarts.
96
+
97
+ Adam. Another adversary model $\mathcal { A } ( a d a m )$ applies the stochastic gradient-based optimization algorithm Adam Kingma $\&$ Ba (2014) to generate adversarial examples. Specifically, the adversary uses Adam to solve the same optimization problem as in Equation 3.
98
+
99
+ # 3.2 DEFENDER MODEL
100
+
101
+ Given the possible adversary models, several defensive strategies have been proposed focusing on different perspectives. Basically, the learner tries to integrate the prior knowledge of either the adversary model or the data distribution with the classification process. Here we consider different defensive strategies given the adversary model and form the interaction as a Stackelberg game. We will also consider the repeated game setting in section 4.4.
102
+
103
+ Adversarial Retraining framework $( R A D )$ . A systematic defensive approach based on adversarial retraining $( R A D )$ has been proposed in Li et al. (2016). At the high level, $R A D$ starts with the original training data and iteratively updating the learner with adversarial instances that evade the previously computed classifier until the convergence. It has been proved that the algorithm will terminate and the lower bound of the empirical loss of $R A D$ is also provided. The important part for $R A D$ is to select the adversarial retraining instances. In practice, it is hard to exactly estimate the adversary model as well as the parameters used within their model. Therefore, the generalization ability of $R A D$ across different adversary models is quite important. Surprisingly, $R A D$ generalizes quite well among various adversary models without requiring to know the exact attacker strategy. We will present the cross-model analysis for $R A D$ in details in section 4.3.
104
+
105
+ AutoEncoder stacked with Classifier $( A E C )$ . One of the recent and efficient defensive method is the AutoEncoder stacked with a classifier to initialize deep architectures proposed in Gu & Rigazio (2014). To assess the structure of the adversarial noise, an autoencoder on mapping adversarial examples back to the original data samples is trained and stacked with the classifier. We train the AutoEncoder with different adversarial algorithms, including the fast gradient sign method $( f g s )$ , the coordinate greedy $( c g )$ method, as well as Adam.
106
+
107
+ Improved AutoEncoder stacked with Classifier (IAEC). Since the baseline $A E C$ cannot perform very well by only mapping the adversarial images back to the original image, we apply an improved AutoEncoder stacked with classifier (IAEC) defensive method. As AutoEncoder itself can not ensure that adversarial examples are denoised, we add a cross-entropy regularizer term as the loss function to help ensure that the output of AutoEncoder is classified correctly. Let $y _ { i }$ be the one-hot representation of ground truth label of an input instance $x _ { i }$ , then our loss function becomes:
108
+
109
+ $$
110
+ J ( x _ { i } ) = \| s ( x _ { i } ) - { x _ { i } } ^ { \prime } \| + H ( y _ { i } , f ( x _ { i } ) ) ,
111
+ $$
112
+
113
+ where $s ( x _ { i } )$ represents the mapping result of $x _ { i }$ by the AutoEncoder, and the cross-entropy function $H ( y _ { i } , f ( x _ { i } ) ) \stackrel { - } { = } - \sum _ { x _ { i } } y _ { i } \log f ( \stackrel { - } { x _ { i } } )$ .
114
+
115
+ Distillation. Considering the fact that the knowledge extracted during training, which is in the form of probability vectors, and transferred in smaller networks to maintain accuracy comparable with those of larger networks can also be beneficial to improving generalization capabilities of deep neural networks outside of their training dataset, a defensive strategy against the adversarial examples has been proposed in Papernot et al. (2015). This defensive strategy transfers the knowledge contained in probability vectors through the distillation training step, then applies these probabilities in the next training step instead of using the original hard labels, and therefore enhances its resilience to perturbations. This defensive model is independent of the adversary models and we will evaluate its robustness and vulnerabilities in details in section 4.
116
+
117
+ # 4 EXPERIMENTAL ANALYSIS
118
+
119
+ In this section, we empirically compare the adversarial retraining framework $R A D$ with other stateof-the-art baseline methods Distillation Papernot et al. (2015), AutoEncoder stacked with Classifier (AEC) Gu & Rigazio (2014) and our improved AutoEncoder stacked with Classifier (IAEC) against various adversary models based on both MNIST and CIFAR-10 datasets.
120
+
121
+ Basically, we first analyze the robustness of $R A D$ and Distillation, which performs the best against adversarial examples currently, by comparing the classification results before and after applying the adversarial retraining technique based on both MNIST and CIFAR-10 datasets. Then we estimate the cross-model classification robustness for $R A D , A E C$ , the improved IAEC, and Distillation. Precisely, during the cross-model evaluation, we allow the attacker to generate the adversarial examples with different adversarial algorithms, while the defender has no clue about what adversarial algorithm is used. Therefore, we are able to evaluate the resilience of the “black-box” defensive strategies without requiring to know the actual adversary model.
122
+
123
+ Besides, we allow the attacker to attack these robustly enhanced learners and we compare the resilience of the $R A D$ with the baseline defensive models and show that with retraining instances generated by adam, the $R A D$ is almost unassailable for attacks based on the fast gradient sign method, which is promising to design universal defensive algorithms based on $R A D$ .
124
+
125
+ Additionally, another perspective to measure the robustness of the learners is to evaluate how much noise is needed to make the learner misclassify an otherwise correct instance. As pointed out by $\mathrm { G u }$ & Rigazio (2014), even a learner can be demonstrated to perform robustly against certain adversarial examples, it may become more vulnerable in the sense of being attacked by adding much smaller magnitude of adversarial noise. This means increasing the noticeability of the smallest adversarial noise for each example becomes the key to solve the adversarial examples problem. Therefore, we compare the malicious distortion required to attack each model, aiming to evaluate the vulnerability of different learners. The distortion is measured by $\begin{array} { r } { d ( x _ { i } ^ { \prime } , x _ { i } ) = \frac { 1 } { n } \sqrt { \sum ( x _ { i } ^ { \prime } - x _ { i } ) ^ { 2 } } } \end{array}$ , where $x _ { i } ^ { \prime } =$ $\mathcal { A } ( \beta , x _ { i } )$ representing the adversarial manipulated instance based on arbitrary adversary model $\mathcal { A }$ .
126
+
127
+ # 4.1 EXPERIMENTAL SETUP
128
+
129
+ In our experiments, we focus on binary classification, and the adversary tries to modify a malicious instance (classified as $+ 1$ ) to evade the classifier and be classified as benign (-1). On MNIST, we select digit $" 4 "$ as the malicious (positive) class, and $" 7 "$ as the benign (negative) class. On CIFAR10, we use “Airplane” as the malicious class, and “Cat” as the benign class. We use LeNet-5 LeCun et al. (1998) to perform the binary classification, and all classifiers used to evaluate the efficiency of different adversary models and defender models are based on this model architecture. All input pixel values are normalized into $[ - 0 . 5 , 0 . 5 ]$ .
130
+
131
+ With respect to adversary models, during the evaluation, all of them modify the malicious instances in the original testset to evade the classifier, and keep the benign instances untouched. Meanwhile, for iterative attack methods evaluated in our experiments, i.e., $c g$ and adam, according to our experiments, actually we can find adversarial examples with small modification cost using any $\lambda$ , even when setting $\lambda = 0$ , i.e., not considering the cost function $c ( x _ { i } ^ { \prime } , x _ { i } )$ for optimization. Therefore, we set $\lambda = 0$ for all experiments using these two attack methods.
132
+
133
+ With respect to defensive models, for RAD, we only add adversarial examples generated on original malicious instances into the dataset for retraining, since the goal of adversary is trying to fool a classifier to label a malicious instance as benign, which follows the framework proposed in Li et al. (2016). As for AEC and IAEC, we use the same autoencoder architecture for removing adversarial noises proposed in Gu & Rigazio (2014), i.e., a three-hidden-layer autoencoder (784-256-128-256- 784 neurons). We train the autoencoder to map adversarial examples generated on original malicious instances to the original images, and as suggested in Gu & Rigazio (2014), we also train the autoencoder to map original data back to itself. Both AEC and IAEC stack the autoencoder with a LeNet-5 classifier.
134
+
135
+ # 4.2 ROBUSTNESS ANALYSIS FOR DEFENSIVE LEARNERS
136
+
137
+ To evaluate the robustness and efficiency of the adversarial retraining framework and other defensive learners, we generate adversarial examples based on the the coordinate gradient algorithm $( c g )$ , adam, and the fast gradient sign algorithm $( f g s _ { \epsilon } )$ with the size of perturbation $\epsilon = 0 . 1 \sim 0 . 5$ ( Goodfellow et al. (2014)), respectively. Figure 1 shows the analysis of recall for the traditional LeNet-5 and the robust $R A D$ classifiers on MNIST. The test error of LeNet-5 on the original dataset is $0 . 0 4 5 \%$ . It is obvious that after the adversarial retraining process based on $R A D$ , the classifiers perform nearly optimal. It is interesting to observe that with the $\epsilon$ of fgs increases, the adversarial examples generated by fgs can attack the original LeNet-5 more efficiently.
138
+
139
+ Figure 2 presents the comparisons of recall for the original LeNet-5 and the adversarial retraining framework on CIFAR-10. It shows that the adversarial retraining framework works robustly against different adversarial example generation methods. Note the test error of LeNet-5 on the original dataset is $5 . 5 \%$ . From the results of recall, we can see that almost all the “generated” adversarial instances are correctly classified by the retraining framework. Additionally, sometimes the test error of $R A D$ is even smaller than that of the original model LeNet-5 based on the uncontaminated (no adversary) data. This means, with the adversarial robust retraining process, some “blind-spots” in the input space volume can be filled out without decreasing the performance on the normal test data. Moreover, surprisingly, with the increase of $\epsilon$ , the fast gradient sign method works worse for generating adversarial examples against LeNet-5, which is different for MNIST. This is actually caused by the properties of the fast gradient sign method itself. By following the gradient, the generated instance can be trapped into sub-optimal and therefore fail to converge to the global optima, so different step size can affect their final convergence. Therefore, by comparing with the results of MNIST, we can see learners on CIFAR-10 is easier to be trapped by the sub-optima and larger $\epsilon$ values can lead the learner to be trapped into these points with higher probability. On the other hand, no matter how much the strength of adversarial ability is affected by different parameters, the adversarial retraining framework works robustly by almost identifying all the manipulated instances correctly on different datasets consistently.
140
+
141
+ ![](images/ecbb64d765a0fe57f02c698626b68671c5333bbab455fe193a120384ed7fbfa2.jpg)
142
+ Figure 1: Performance of retraining with instances generated from different models based on MNIST. (a) The retraining instances are generated by $c g$ ; (b) the adversarial examples are generated by $c g$ ; (c) the adversarial examples are generated by adam.
143
+
144
+ ![](images/e320c714385bad3ae3f2ab6cf42a6d7f02a12f22f4fca741093ab95b014ae22c.jpg)
145
+ Figure 2: Performance of retraining with instances generated from different models based on CIFAR-10. (a) The retraining instances are generated by CG; (b) the adversarial examples are generated by CG; (c) the adversarial examples are generated by adam.
146
+
147
+ # .3 CROSS-MODEL ANALYSIS FOR DIFFERENT DEFENSIVE LEARNERS
148
+
149
+ Aiming to defend a more broad class of attacks, here we assume the the learner has no clue about which adversarial algorithm the attacker uses to generate the adversarial instances. Therefore, the defender can perform robustly as the “black-box” learner against arbitrary adversaries. Here we use different attack algorithms to generate the adversarial examples, and the retraining instances for $R A D$ are also generated across various adversary models to evaluate the learners’ generalization ability. We also compare the results with the state-of-the-art Distillation, $A E C$ and our improved $I A E C$ algorithm based on different adversarial models. Here the $A E C$ is trained on the adam model, which offers the best classification results. The IAEC is also trained corresponding to different adversary models to compare the cross-model learning ability with RAD. Table 1 shows the test error comparisons for these cross-model learners. “No adversary” presents the test error of different learners on the clean data. Basically, the adversarial retraining framework performs consistently better than AEC, IAEC, and Distillation on all different adversarial examples in terms of the classification error. This conclusion is independent of what models are used to generate adversarial retraining instances for RAD. Based on the results, the adversarial retraining framework has the potential to be applied to defend against any arbitrary attacks without requiring to know the exact adversary model. Based on the classification error results for our improved IAEC in Table 1, it is obvious that the $I A E C$ with the same adam adversary model works much more robust than AEC. This means the proposed $I A E C$ is much more robust compared with the original AEC by adding the cross-entropy regularization. Additionally, we also evaluate the cross-model classification error for $I A E C$ to test its generalization ability. Table 1 shows that the IAEC can also defend against different adversarial examples without requiring to know the exact adversary model.
150
+
151
+ Table 1: Classification error of different learners against various adversary models based on MNIST
152
+
153
+ <table><tr><td>Model</td><td>A(fgso.1)</td><td>A(fgs0.5)</td><td>A(cg)</td><td>A(adam)</td><td>No adversary</td></tr><tr><td>LeNet-5</td><td>1.2%</td><td>46.1%</td><td>48.2%</td><td>48.9%</td><td>0.045%</td></tr><tr><td>RAD(fgs0.1)</td><td>0.1%</td><td>0.5%</td><td>0.4%</td><td>3.0%</td><td>0.045%</td></tr><tr><td>RAD(fgs0.5)</td><td>0.5%</td><td>0.1%</td><td>0</td><td>2.5%</td><td>0.045%</td></tr><tr><td>RAD(cg)</td><td>0.1%</td><td>1.4%</td><td>0.4%</td><td>2.9%</td><td>0.045%</td></tr><tr><td>RAD(adam)</td><td>0</td><td>0.1%</td><td>0.1%</td><td>0.1%</td><td>0.045%</td></tr><tr><td>AEC(adam)</td><td>3.2%</td><td>20.6%</td><td>9.7%</td><td>2.6%</td><td>4.5%</td></tr><tr><td>IAEC(fgs0.1)</td><td>1.3%</td><td>28.0%</td><td>18.3%</td><td>9.6%</td><td>1.1%</td></tr><tr><td>IAEC(fgs0.5)</td><td>1.2%</td><td>1.4%</td><td>2.6%</td><td>5.5%</td><td>1.0%</td></tr><tr><td>IAEC(cg)</td><td>1.6%</td><td>1.6%</td><td>1.5%</td><td>7.4%</td><td>1.2%</td></tr><tr><td>IAEC(adam)</td><td>1.2%</td><td>5.2%</td><td>7.3%</td><td>2.3%</td><td>1.7%</td></tr><tr><td>Distillation(T = 1)</td><td>0.6%</td><td>47.2%</td><td>29.4%</td><td>41.9%</td><td>0.2%</td></tr><tr><td>Distillation(T = 100)</td><td>0.3%</td><td>42.3%</td><td>12.4%</td><td>28.5%</td><td>0.2%</td></tr></table>
154
+
155
+ Similarly, we show the classification error comparison results of $R A D$ across different adversary models in Table 2 compared with Distillation. As CIFAR-10 images are more complex, the error rates for adversarial retraining framework get larger compared with that on MNIST. However, overall the classification error for the retraining framework on different adversarial examples are below $13 \%$ with zero knowledge of the adversary model, while the classification error on normal data is around $6 \%$ . Therefore, even on CIFAR-10 dataset, the adversarial retraining framework is still promising to perform the “black-box” defending resiliently against various attacks. Additionally, the distillation with $T = 1$ and $T = 1 0 0$ both encounter higher test error than $R A D$ , even the distillation method performs more robustly when $T = 1 0 0$ than $T = 1$ .
156
+
157
+ Table 2: Comparisons for the error rate of $R A D$ based on different adversary models on CIFAR-10
158
+
159
+ <table><tr><td>Model</td><td>A(fgso.1)</td><td>A(fgs0.5)</td><td>A(cg)</td><td>A(adam)</td><td>No adversary</td></tr><tr><td>LeNet-5</td><td>1.2%</td><td>46.1%</td><td>54.0%</td><td>52.7%</td><td>5.5%</td></tr><tr><td>RAD(fgso.1)</td><td>2.35%</td><td>2.0%</td><td>4.65%</td><td>3.0%</td><td>5.3%</td></tr><tr><td>RAD(fgs0.5)</td><td>4.4%</td><td>2.7%</td><td>5.6%</td><td>2.6%</td><td>5.8%</td></tr><tr><td>RAD(cg)</td><td>7.5%</td><td>2.45%</td><td>5.05%</td><td>2.2%</td><td>5.7%</td></tr><tr><td>RAD(adam)</td><td>16.2%</td><td>2.8%</td><td>6.15%</td><td>2.4%</td><td>5.9%</td></tr><tr><td>Distillation(T =1)</td><td>21.3%</td><td>30.8%</td><td>13.8%</td><td>22.0%</td><td>11.0%</td></tr><tr><td>Distillation(T = 100)</td><td>19.3%</td><td>25.2%</td><td>9.2%</td><td>20.2%</td><td>7.2%</td></tr></table>
160
+
161
+ # 4.4 ROBUSTNESS AGAINST ADDITIONAL ATTACKS
162
+
163
+ In order to test the robustness of the learner against the repeated attacks, where the attacker can again conduct attacks on the robust learners, here we evaluate how the robust learner behaves given additional attacks based on different adversary models. Table 3 presents the test error rate comparison when the attacker generates adversarial examples to attack the robust $R A D$ learner, $I A E C$ , and Distillation on MNIST. It is shown that the coordinate greedy $( c g )$ and adam are somehow efficient to attack $R A D$ , while the fast gradient sign methods fail to attack the robust $R A D$ . So if the $R A D$ is retrained with instances generated by arbitrary adversary models, it can be resilient against adversarial examples produced by the fast gradient sign method with various $\epsilon$ values. This means the $R A D$ can confer robustness to single-step attack methods but not the iterative ones. However, adversaries based on $c g$ and adam can still find the vulnerabilities to attack the model. Compared with the performance of the adversarial retraining framework $( R A D )$ against these “repeated attacks”, the $I A E C$ encounters much higher classification error when being attacked. This indicates that the adversarial retraining framework can not only enhance the resilience of the original learner (LeNet-5), but also perform robustly against the additional attacks compared with the IAEC.
164
+
165
+ Similarly, Table 4 presents the test error for attacking different robust learners with various adversary models on CIFAR-10. RAD again produces lower test error compared with Distillation $T = 1$
166
+
167
+ Table 3: Error rate of attacking the robust learners with additional attacks on MNIST
168
+
169
+ <table><tr><td>Model</td><td>A(fgs0.1)</td><td>A(fgs0.5)</td><td>A(cg)</td><td>A(adam)</td></tr><tr><td>RAD(fgs0.1)</td><td>0.3%</td><td>9.6%</td><td>48.1%</td><td>49.0%</td></tr><tr><td>RAD(fgs0.5)</td><td>0.8%</td><td>0.1%</td><td>45.7%</td><td>49.0%</td></tr><tr><td>RAD(cg)</td><td>0.8%</td><td>3.4%</td><td>44.6%</td><td>49.0%</td></tr><tr><td>RAD(adam)</td><td>0.1%</td><td>0.1%</td><td>40.2%</td><td>48.7%</td></tr><tr><td>IAEC(fgs0.1)</td><td>4.2%</td><td>10.3%</td><td>49.9%</td><td>49.5%</td></tr><tr><td>IAEC(fgs0.5)</td><td>5.2%</td><td>3.8%</td><td>49.8%</td><td>49.9%</td></tr><tr><td>IAEC(cg)</td><td>5.3%</td><td>3.9%</td><td>49.9%</td><td>49.4%</td></tr><tr><td>IAEC(adam)</td><td>4.6%</td><td>7.0%</td><td>49.9%</td><td>49.9%</td></tr><tr><td>Distillation(T = 100)</td><td>0.2%</td><td>0.2%</td><td>49.0%</td><td>48.7%</td></tr></table>
170
+
171
+ Table 4: Error rate of attacking the robust learners with additional attacks on CIFAR-10
172
+
173
+ <table><tr><td>Model</td><td>A(fgso.1)</td><td>A(fgs0.5)</td><td>A(cg)</td><td>A(adam)</td></tr><tr><td>RAD(fgs0.1)</td><td>3.7%</td><td>2.7%</td><td>42.0%</td><td>52.7%</td></tr><tr><td>RAD(fgs0.5)</td><td>5.3%</td><td>2.8%</td><td>49.0%</td><td>52.4%</td></tr><tr><td>RAD(cg)</td><td>7.9%</td><td>2.8%</td><td>52.0%</td><td>52.7%</td></tr><tr><td>RAD(adam)</td><td>6.3%</td><td>3.1%</td><td>54.0%</td><td>52.7%</td></tr><tr><td>Distillation(T = 100)</td><td>9.05%</td><td>8.6%</td><td>54.0%</td><td>54.1%</td></tr></table>
174
+
175
+ $T = 1 0 0 _ { , }$ ) given diverse adversarial attacking strategies. What is worth to mention is that these robust learners all perform accurately on the normal dataset without adversarial manipulation, which offers more potentials for the robust learners.
176
+
177
+ # 4.5 VULNERABILITY OF THE DEFENSIVE LEARNERS
178
+
179
+ Given the fact that the attacker can attack the learning model continuously, here we are concerned with how vulnerable the robust models become in terms of the amount of distortion needed to add to mislead the learner. We compare the average distortion for attacking the LeNet-5, RAD, IAEC, and Distillation to evaluate their robustness. As mentioned by Gu & Rigazio (2014), AEC demands smaller distortion to attack, which means $A E C$ is quite fragile, and we also gain the similar observation and confirm that attacking the original LeNet-5 model requires larger magnitude of noise than $A E C$ . Thus, we focus on the improved IAEC.
180
+
181
+ In the Table 5 we present the demanded distortion to maliciously attack the $R A D$ , the $I A E C$ , and Distillation on MNIST. Note that the fast gradient sign method here is a one-step method, which will stop after computing one gradient to find the optimal perturbation of a linear approximation of the cost or model, so it cannot guarantee to find the evasion instance $x _ { i } { ' }$ and we do not consider its distortion. so here we only consider $c g$ and adam to generate distortions. We use $R A D ( . )$ to represent the adversarial retraining framework retrained with arbitrary adversarial instances since they all require the same amount of distortion to be attacked given their similar network structures. From Table 5 RAD requires the same distortion as attacking the original LeNet-5 model. However, the distortion needed for attacking the $I A E C$ is substantially smaller than that for attacking the original models. From this perspective, the $I A E C$ becomes more vulnerable compared with the original model even though it can be resilient against the adversarial examples. Similar for Distillation, smaller distortion is demanded to attack the robust learner, which means more vulnerabilities are introduced by the robust Distillation. On the contrary, the adversarial retraining framework $R A D$ can perform robustly against various diverse adversarial attacks without increasing the vulnerability penalty.
182
+
183
+ Figure 3 shows the results of adding the corresponding adversarial noise to generate the misclassification for LeNet-5 model by different adversarial algorithms qualitatively. It shows that by using fast gradient sign method with $\epsilon = 0 . 5$ , the original image is almost distorted. This indicates different adversary models have different attacking strengths, so taking the stronger adversary model into account may have a chance to defend the weaker adversaries, which makes the universal defensive model promising.
184
+
185
+ Table 5: Adversarial distortion required for attacking different models on MNIST
186
+
187
+ <table><tr><td>Model</td><td>A(cg)</td><td>A(adam)</td></tr><tr><td>LeNet-5</td><td>0.0118</td><td>0.0060</td></tr><tr><td>RAD(.)</td><td>0.0118</td><td>0.0060</td></tr><tr><td>IAEC(fgs0.1)</td><td>0.0042</td><td>0.0031</td></tr><tr><td>IAEC(fgs0.5)</td><td>0.0058</td><td>0.0028</td></tr><tr><td>IAEC(cg)</td><td>0.0069</td><td>0.0023</td></tr><tr><td>IAEC(adam)</td><td>0.0064</td><td>0.0029</td></tr><tr><td>Distillation(T = 100)</td><td>0.0106</td><td>0.0060</td></tr></table>
188
+
189
+ ![](images/e36b789f4ab07b2221ec4670e4bbee971f25978db217088dc30f0c7ab42011e2.jpg)
190
+ Figure 3: Visualization of adversarial examples generated by different attacker models based on MNIST. (a) Original image, (b) attacked by $f g s _ { 0 . 1 }$ , (c) attacked by $f g s _ { 0 . 5 }$ , (d) attacked by $c g$ , (e) attacked by adam.
191
+
192
+ Similarly, Table 6 lists the amount of distortion needed to fool the original learner based on CIFAR10. It is shown that both the $R A D$ and Distillation need exactly the same amount of distortion with the original LeNet-5 model, which means these robust learners do not increase the vulnerability of the original model.
193
+
194
+ Table 6: Adversarial distortion required for attacking different models on CIFAR-10
195
+
196
+ <table><tr><td>Model</td><td>A(cg)</td><td>A(adam)</td></tr><tr><td>LeNet-5</td><td>0.0025</td><td>0.0015</td></tr><tr><td>RAD()</td><td>0.0025</td><td>0.0015</td></tr><tr><td>Distillation(T = 100)</td><td>0.0025</td><td>0.0015</td></tr></table>
197
+
198
+ The visual attacking results by injecting malicious noise are shown in Figure 4. It is clear that fgs with $\epsilon = 0 . 5$ can distort the original images the most compared with other adversary algorithms. Surprisingly, all the retraining framework based on different retraining instances only get the classification error lower than $3 . 0 \%$ .
199
+
200
+ ![](images/643145ffcb53a9db029ccaa143ac7eb2d6ad866eb86272d7c02ebcb796762565.jpg)
201
+ Figure 4: Visualization of adversarial examples generated by different attacker models based on CIFAR-10. (a) Original image, (b) attacked by $f g s _ { 0 . 1 }$ , (c) attacked by $f g s _ { 0 . 5 }$ , (d) attacked by $c g$ , (e) attacked by adam.
202
+
203
+ # 5 CONCLUSION
204
+
205
+ To understand the adversarial examples better, as well as the potential adversary models and corresponding defensive learners, we conduct extensive experiments to evaluate properties of different defensive strategies. We point out that $R A D$ works the best among all the defensive strategies against different adversary models, including one-step and iterative ones, in terms of the classification test error. The adversarial retraining framework, RAD, also generalizes well for the cross-model evaluation compared with AEC, IAEC, and Distillation. Moreover, both $R A D$ and Distillation do not introduce additional vulnerability penalty to the original models, while still increase the robustness. So in the future work, to generalize the robust learner across different adversary models, one direction could be to generate retraining instances based on diverse adversarial algorithms to cover as much as possible the “blind-spots” within the input space. In addition, we will dynamically optimize the choice of adversary model and the quantity of retraining instances according to the robustness requirements of a specific learner. Therefore, the tradeoff between robustness and accuracy on the normal data can be balanced based on the specific resilience demand of the learner.
206
+
207
+ # REFERENCES
208
+
209
+ Battista Biggio, Giorgio Fumera, and Fabio Roli. Security evaluation of pattern classifiers under attack. Knowledge and Data Engineering, IEEE Transactions on, 26(4):984–996, 2014.
210
+ Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
211
+ Shixiang Gu and Luca Rigazio. Towards deep neural network architectures robust to adversarial examples. arXiv preprint arXiv:1412.5068, 2014.
212
+ Ruitong Huang, Bing Xu, Dale Schuurmans, and Csaba Szepesvari. Learning with adversary. arXiv preprint arXiv:1511.03034, 2015.
213
+ JC Jan, Shih-Lin Hung, SY Chi, and JC Chern. Neural network forecast model in deep excavation. Journal of Computing in Civil Engineering, 16(1):59–65, 2002.
214
+ Jonghoon Jin, Aysegul Dundar, and Eugenio Culurciello. Robust convolutional neural networks under adversarial noise. arXiv preprint arXiv:1511.06306, 2015.
215
+ Liyiming Ke, Bo Li, and Yevgeniy Vorobeychik. Behavioral experiments in email filter evasion. In AAAI Conference on Artificial Intelligence, 2016.
216
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
217
+ Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial machine learning at scale. arXiv preprint arXiv:1611.01236, 2016.
218
+ 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.
219
+ Bo Li and Yevgeniy Vorobeychik. Feature cross-substitution in adversarial classification. In Advances in Neural Information Processing Systems, pp. 2087–2095, 2014.
220
+ Bo Li, Yevgeniy Vorobeychik, and Xinyun Chen. A general retraining framework for scalable adversarial classification. arXiv preprint arXiv:1604.02606, 2016.
221
+ Daniel Lowd and Christopher Meek. Adversarial learning. In Proceedings of the eleventh ACM SIGKDD international conference on Knowledge discovery in data mining, pp. 641–647. ACM, 2005.
222
+ Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, Ken Nakae, and Shin Ishii. Distributional smoothing with virtual adversarial training. stat, 1050:25, 2015.
223
+ Anh Nguyen, Jason Yosinski, and Jeff Clune. Deep neural networks are easily fooled: High confidence predictions for unrecognizable images. In 2015 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 427–436. IEEE, 2015.
224
+ Nicolas Papernot, Patrick McDaniel, Xi Wu, Somesh Jha, and Ananthram Swami. Distillation as a defense to adversarial perturbations against deep neural networks. arXiv preprint arXiv:1511.04508, 2015.
225
+
226
+ 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.
227
+
228
+ Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z Berkay Celik, and Ananthram Swami. Practical black-box attacks against deep learning systems using adversarial examples. arXiv preprint arXiv:1602.02697, 2016b.
229
+
230
+ Nicolas Papernot, Patrick McDaniel, Somesh Jha, Matt Fredrikson, Z Berkay Celik, and Ananthram Swami. The limitations of deep learning in adversarial settings. In 2016 IEEE European Symposium on Security and Privacy (EuroS&P), pp. 372–387. IEEE, 2016c.
231
+
232
+ Sara Sabour, Yanshuai Cao, Fartash Faghri, and David J Fleet. Adversarial manipulation of deep representations. arXiv preprint arXiv:1511.05122, 2015.
233
+
234
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013.
235
+
236
+ Pedro Tabacof and Eduardo Valle. Exploring the space of adversarial images. arXiv preprint arXiv:1510.05328, 2015.
237
+
238
+ Pascal Vincent, Hugo Larochelle, Yoshua Bengio, and Pierre-Antoine Manzagol. Extracting and composing robust features with denoising autoencoders. In Proceedings of the 25th international conference on Machine learning, pp. 1096–1103. ACM, 2008.
239
+
240
+ Yevgeniy Vorobeychik and Bo Li. Optimal randomized classification in adversarial settings. In Proceedings of the 2014 international conference on Autonomous agents and multi-agent systems, pp. 485–492. International Foundation for Autonomous Agents and Multiagent Systems, 2014.
241
+
242
+ Stephan Zheng, Yang Song, Thomas Leung, and Ian Goodfellow. Improving the robustness of deep neural networks via stability training. arXiv preprint arXiv:1604.04326, 2016.
md/train/E3Ys6a1NTGT/E3Ys6a1NTGT.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/H1Xw62kRZ/H1Xw62kRZ.md ADDED
@@ -0,0 +1,386 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEVERAGING GRAMMAR AND REINFORCEMENT LEARNING FOR NEURAL PROGRAM SYNTHESIS
2
+
3
+ Rudy Bunel∗ University of Oxford rudy@robots.ox.ac.uk
4
+
5
+ Matthew Hausknecht
6
+ Microsoft Research
7
+ matthew.hausknecht@microsoft.com
8
+ Jacob Devlin∗
9
+ Google
10
+ jacobdevlin@google.com
11
+
12
+ Rishabh Singh Microsoft Research risin@microsoft.com
13
+
14
+ Pushmeet Kohli∗
15
+ Deepmind
16
+ pushmeet@google.com
17
+
18
+ # ABSTRACT
19
+
20
+ Program synthesis is the task of automatically generating a program consistent with a specification. Recent years have seen proposal of a number of neural approaches for program synthesis, many of which adopt a sequence generation paradigm similar to neural machine translation, in which sequence-to-sequence models are trained to maximize the likelihood of known reference programs. While achieving impressive results, this strategy has two key limitations. First, it ignores Program Aliasing: the fact that many different programs may satisfy a given specification (especially with incomplete specifications such as a few input-output examples). By maximizing the likelihood of only a single reference program, it penalizes many semantically correct programs, which can adversely affect the synthesizer performance. Second, this strategy overlooks the fact that programs have a strict syntax that can be efficiently checked. To address the first limitation, we perform reinforcement learning on top of a supervised model with an objective that explicitly maximizes the likelihood of generating semantically correct programs. For addressing the second limitation, we introduce a training procedure that directly maximizes the probability of generating syntactically correct programs that fulfill the specification. We show that our contributions lead to improved accuracy of the models, especially in cases where the training data is limited.
21
+
22
+ # 1 INTRODUCTION
23
+
24
+ The task of program synthesis is to automatically generate a program that is consistent with a specification such as a set of input-output examples, and has been studied since the early days of Artificial Intelligence (Waldinger and Lee, 1969). There has been a lot of recent progress made on neural program induction, where novel neural architectures inspired from computation modules such as RAM, stack, CPU, turing machines, and GPU (Graves et al., 2014; Joulin and Mikolov, 2015; Kurach et al., 2016; Graves et al., 2016; Reed and de Freitas, 2016; Kaiser and Sutskever, 2016) have been proposed to train these architectures in an end-to-end fashion to mimic the behavior of the desired program. While these approaches have achieved impressive results, they do not return explicit interpretable programs, tend not to generalize well on inputs of arbitrary length, and require a lot of examples and computation for learning each program. To mitigate some of these limitations, neural program synthesis approaches (Johnson et al., 2017; Parisotto et al., 2017; Devlin et al., 2017b) have been recently proposed that learn explicit programs in a Domain-specific language (DSL) from as few as five input-output examples. These approaches, instead of using a large number of input-output examples to learn a single program, learn a large number of different programs, each from just a few input-output examples. During training, the correct program is provided as reference, but at test time, the learnt model generates the program from only the input-output examples.
25
+
26
+ While neural program synthesis techniques improve over program induction techniques in certain domains, they suffer from two key limitations. First, these approaches use supervised learning with reference programs and suffer from the problem of Program Aliasing: For a small number of input-output examples, there can be many programs that correctly transform inputs to outputs. The problem is the discrepancy between the single supervised reference program and the multitude of correct programs. Figure 1 shows an example of this: if maximizing the probability of ground truth program, predicting Program B would be assigned a high loss even though the two programs are semantically equivalent for the input-output example. Maximum likelihood training forces the model to learn to predict ground truth programs, which is different from the true objective of program synthesis: predicting any consistent program. To address this problem, we alter the optimization objective: instead of maximum likelihood, we use policy gradient reinforcement learning to directly encourage generation of any program that is consistent with the given examples.
27
+
28
+ ![](images/da75918d710670223bada7e9820b7a9a2b98c2401abdf44c0cfab4f8b4c145dc.jpg)
29
+ Figure 1: Program Aliasing is one difficulty of program synthesis: For the input-output specification given in (1a), both programs are semantically correct. However, supervised training would penalize the prediction of Program B, if A is the ground truth.
30
+
31
+ The second limitation of neural program synthesis techniques based on sequence generation paradigm (Devlin et al., 2017b) is that they often overlook the fact that programs have a strict syntax, which can be checked efficiently. Similarly to the work of Parisotto et al. (2017), we explore a method for leveraging the syntax of the programming language in order to aggressively prune the exponentially large search space of possible programs. In particular, not all sequences of tokens are valid programs and syntactically incorrect programs can be efficiently ignored both during training and at test time. A syntax checker is an additional form of supervision that may not always be present. To address this limitation, we introduce a neural architecture that retains the benefits of aggressive syntax pruning, even without assuming access to the definition of the grammar made in previous work (Parisotto et al., 2017). This model is jointly conditioned on syntactic and program correctness, and can implicitly learn the syntax of the language while training.
32
+
33
+ We demonstrate the efficacy of our approach by developing a neural program synthesis system for the Karel programming language (Pattis, 1981), an educational programming language, consiting of control flow constructs such as loops and conditionals, making it more complex than the domains tackled by previous neural program synthesis works.
34
+
35
+ This paper makes the following key contributions:
36
+
37
+ • We show that Reinforcement Learning can directly optimize for generating any consistent program and improves performance compared to pure supervised learning. • We introduce a method for pruning the space of possible programs using a syntax checker and show that explicit syntax checking helps generate better programs. In the absence of a syntax checker, we introduce a model that jointly learns syntax and the production of correct programs. We demonstrate this model improves performance in instances with limited training data.
38
+
39
+ # 2 RELATED WORK
40
+
41
+ Program synthesis is one of the fundamental problems in Artificial Intelligence. To the best of our knowledge, it can be traced back to the work of Waldinger and Lee (1969) where a theorem prover was used to construct LISP programs based on a formal specification of the input-output relation. As formal specification is often as complex as writing the original program, many techniques were developed to achieve the same goal with simpler partial specifications in the form of input-output (IO) examples (Amarel, 1970; Summers, 1977). Rule-based synthesis approaches have recently been successful in delivering on the promise of Programming By Example (Lieberman, 2001), the most widely known example being the FlashFill system (Gulwani et al., 2012) in Excel. However, such systems are extremely complicated to extend and need significant development time from domain experts to provide the pruning rules for efficient search.
42
+
43
+ As a result, the use of Machine Learning methods have been proposed, based on Bayesian probabilistic models (Liang et al., 2010) or Inductive Logic programming (Muggleton, 1991; Muggleton et al., 2014) to automatically generate programs based on examples. Recently, inspired by the success of Neural Networks in other applications such as vision (Krizhevsky et al., 2012) or speech recognition (Graves et al., 2013) differentiable controllers were made to learn the behaviour of programs by using gradient descent over differentiable version of traditional programming concepts such as memory addressing (Graves et al., 2014), manipulating stacks (Joulin and Mikolov, 2015; Grefenstette et al., 2015), register machines (Kurach et al., 2016), and data manipulation (Neelakantan et al., 2016). These approaches to program induction however tend to struggle with generalization, especially when presented with inputs of a different dimension than the one they were trained with and require a very large amount of training data. Some exceptions to this include Neural Programmer Interpreters (Reed and de Freitas, 2016) and its extensions (Li et al., 2017; Cai et al., 2017) that learn from program traces rather than only examples. However, they still learn a different model for each program and are computationally expensive, unlike our system that uses a single model for learning a large number of programs.
44
+
45
+ A series of recent works aim to infer explicit program source code with the assumption that code structure provides an inductive bias for better generalization. In particular, explicitly modeling control flow statements such as conditionals and loops can often lead to programs capable of generalizing, regardless of input size (Gaunt et al., 2016; Bunel et al., 2016; Riedel et al., 2017). One remaining drawback of these approaches is the need to restart learning from scratch for each new program. Thus they are largely unsuited for the situation of synthesizing a new program on-the-fly from very few examples. The latest developments use large datasets of artificially generated programs and learn to map embeddings of IO examples to information about the programs to generate. Balog et al. (2017) produce scores over attributes, to be used as heuristics to speed up search-based techniques. Parisotto et al. (2017) use their dataset to learn probability over the expansion rules of a predefined grammar, while (Devlin et al., 2017b) directly predict the source code of the programs. These last two methods use supervised training to maximize the likelihood of a single reference program, while we directly optimize for the generation of any consistent program.
46
+
47
+ Our approach to optimize program correctness is similar in spirit to advances in Neural Machine Translation (Wu et al., 2016; Ranzato et al., 2016) that leverage reinforcement learning to optimize directly for evaluation metrics. Taking advantage of the fact that programs can be syntactically checked and unit tested against the specification examples, we show how to improve on those REINFORCE (Williams, 1992) based methods. Recently, Guu et al. (2017) proposed a method similar to ours based on Maximum Marginal Likelihood to generate programs based on a description in natural language. From an application point of view, our target domain is more complex as our DSL includes control flow operations such as conditionals and loops. Moreover, natural language utterances fully describe the steps that the program needs to take, while learning from IO examples requires planning over potentially long executions. Their approach is more akin to inferring a formal specification based on a natural language description, as opposed to our generation of imperative programs.
48
+
49
+ Incorporating knowledge of the grammar of the target domain to enforce syntactical correctness has already proven useful to model arithmetic expressions, molecules (Kusner et al., 2017), and programs (Parisotto et al., 2017; Yin and Neubig, 2017). These approaches define the model over the production rules of the grammar; we instead operate directly over the terminals of the grammar. This allows us to learn the grammar jointly with the model in the case where no formal grammar specification is available. Our approach is extremely general and can be applied to the very recently proposed methods for inferring and executing programs for visual reasoning (Johnson et al., 2017) that to the best of our knowledge does not directly explictly encourage grammar consistency of the resulting program.
50
+
51
+ # 3 PROBLEM OVERVIEW
52
+
53
+ Before describing our proposed methods, we establish the necessary notation, present the problem setting and describe the general paradigm of our approach.
54
+
55
+ # 3.1 PROGRAM SYNTHESIS FORMULATION
56
+
57
+ To avoid confusion with probabilities, we will use the letter $\lambda$ to denote programs. $I$ and $O$ will be used to denote respectively input states and output states and we will use the shortcut $I O$ to denote a pair of corresponding input/output examples. A state constitutes what the programs are going to be operating on, depending on the application domain. In FlashFill-type applications (Parisotto et al., 2017; Devlin et al., 2017b), Input and Output states would be strings of characters, while in our Karel environment, states are grids describing the presence of objects. If we were to apply our method to actual programming languages, states would represent the content of the machine’s registers and the memory.
58
+
59
+ At training time, we assume to have access to $N$ training samples, each training sample consisting of a set of $K$ Input/Output states and a program implementing the mapping correctly:
60
+
61
+ $$
62
+ { \mathcal { D } } = \left\{ { \left( \left\{ I O _ { i } ^ { k } \right\} _ { k = 1 . . K } , \ \lambda _ { i } \right) } \right\} \qquad { \mathrm { s u c h ~ t h a t : } } \quad \lambda _ { i } ( I _ { i } ^ { k } ) = O _ { i } ^ { k } \quad \forall i \in 1 . . N , \quad \forall k \in 1 . . K
63
+ $$
64
+
65
+ where $\lambda _ { i } ( I _ { i } ^ { k } )$ denotes the resulting state of applying the program $\lambda _ { i }$ to the input state $I _ { i } ^ { k }$ . Our goal is to learn a synthesizer $\sigma$ that, given a set of input/output examples produces a program:
66
+
67
+ $$
68
+ \sigma : ~ \left\{ { I O } ^ { k } \right\} _ { k = 1 \dots K } ~ \longrightarrow ~ { \hat { \lambda } }
69
+ $$
70
+
71
+ We evaluate the programs on a set of test cases for which we have both specification examples and held-out examples:
72
+
73
+ $$
74
+ { \mathcal D } _ { \mathrm { t e s t } } = \left\{ \left( \left\{ I O _ { j } ^ { k _ { \mathrm { s p e c } } } \right\} _ { k _ { \mathrm { s p e c } } = 1 \dots K } , \quad \left\{ I O _ { j } ^ { k _ { \mathrm { t e s t } } } \right\} _ { k _ { \mathrm { t e s t } } = K + 1 \dots K ^ { \prime } } \right) \right\} _ { j = 1 \dots N _ { \mathrm { t e s t } } } ,
75
+ $$
76
+
77
+ At test time, we evaluate the performance of our learned synthesizer by generating, for each sample in the test set, a program $\hat { \lambda _ { j } }$ . The metric we care about is Generalization:
78
+
79
+ $$
80
+ \{ \begin{array} { l l } { j \in \{ 1 . . N _ { \mathrm { t e x } } \} \ \mathrm { s u c h } \mathrm { t h a t } \ \hat { \lambda _ { j } } ( I _ { j } ^ { k } ) = O _ { j } ^ { k } } & { \forall k \in \{ 1 . . K ^ { \prime } \} \ \} \mathrm { w h e r e } \ \ \hat { \lambda _ { j } } = \sigma ( \{ I O _ { j } ^ { k _ { \mathrm { s p e c } } } \} _ { k _ { \mathrm { s p e c } } = 1 . . K } ) . } \end{array}
81
+ $$
82
+
83
+ # 3.2 NEURAL PROGRAM SYNTHESIS ARCHITECTURE
84
+
85
+ Similar to Devlin et al. (2017b) we use a sequential LSTM-based (Hochreiter and Schmidhuber, 1997) language model, conditioned on an embedding of the input-output pairs. Each pair is encoded independently by a convolutional neural network (CNN) to generate a joint embedding. A succinct description of the architecture can be found in section 6.1 and the exact dimensions are available in the supplementary materials.
86
+
87
+ Each program is represented by a sequence of tokens $\lambda = [ s _ { 1 } , s _ { 2 } , . . . , s _ { L } ]$ where each token comes from an alphabet $\Sigma$ . We model the program one token at a time using an LSTM. At each timestep, the input consists of the concatenation of the embedding of the IO pair and of the last predicted token. One such decoder LSTM is run for each of the IO pairs, all using the same weights. The probability of the next token is defined as the Softmax of a linear layer over the max-pooled hidden state of all the decoder LSTMs. A schema representing this architecture can be seen in Figure 2.
88
+
89
+ The form of the model that we are learning is:
90
+
91
+ $$
92
+ p _ { \theta } ( \lambda _ { i } \mid \left\{ I O _ { i } ^ { k } \right\} _ { k = 1 . . K } ) = \prod _ { t = 1 } ^ { L _ { i } } p _ { \theta } ( s _ { t } \mid s _ { 1 } , . . . , s _ { t - 1 } , \left\{ I O _ { i } ^ { k } \right\} _ { k = 1 . . . K } )
93
+ $$
94
+
95
+ At test time, the most likely programs are obtained by running a beam search. One of the advantages of program synthesis is the ability to execute hypothesized programs. Through execution, we remove syntactically incorrect programs and programs that are not consistent with the observed examples. Among the remaining programs, we return the most likely according to the model.
96
+
97
+ ![](images/2a0a88c147a38409c6453040414a01e83b66bff4e8779b4a6684ec70c945ff06.jpg)
98
+ Figure 2: Architecture of our model. Each pair of Input-Output is embedded jointly by a CNN. One decoder LSTM is run for each example, getting fed in a concatenation of the previous token and the IO pair embedding (constant across timestep). Results of all the decoders are maxpooled and the prediction is modulated by the mask generated by the syntax model. The probability over the next token is then obtained by a Softmax transformation.
99
+
100
+ # 4 OBJECTIVE FUNCTIONS
101
+
102
+ # 4.1 MAXIMUM LIKELIHOOD OPTIMIZATION
103
+
104
+ To estimate the parameters $\theta$ of our model, the default solution is to perform supervised training, framing the problem as Maximum Likelihood estimation. Devlin et al. (2017b) follow this approach and use stochastic gradient descent to solve:
105
+
106
+ $$
107
+ \theta ^ { \star } = \operatorname * { a r g m a x } _ { \theta } \prod _ { i = 1 . . N } p _ { \theta } ( \lambda _ { i } \mid \{ I O _ { i } ^ { i } \} _ { i = 1 . . K } ) = \operatorname * { a r g m a x } _ { \theta } \sum _ { i = 1 . . N } \log \left( p _ { \theta } ( \lambda _ { i } \mid \{ I O _ { i } ^ { k } \} _ { k = 1 . . K } ) \right)
108
+ $$
109
+
110
+ However, this training objective exhibits several drawbacks. First, at training time, the model is only exposed to the training data distribution, while at test time, it is fed back the token from its own previous predictions. This discrepancy in distribution of the inputs is well known in Natural Language Processing under the name of exposure bias (Ranzato et al., 2016).
111
+
112
+ Moreover, this loss does not represent the true objective of program synthesis. In practice, any equivalent program should be as valid a prediction as the reference one. This property, that we call program aliasing, is not taken into account by the MLE training. Ideally, we would like the model to learn to reason about the necessary steps needed to map the input to the output. As a result, the loss shouldn’t penalize correct programs, even if they do not correspond to the ground truth.
113
+
114
+ # 4.2 OPTIMIZING EXPECTED CORRECTNESS
115
+
116
+ The first modification that we propose is to change the target objective to bring it more in line with the goal of program synthesis. We replace the optimization problem of (6) by
117
+
118
+ $$
119
+ \theta ^ { \star } = { \underset { \theta } { \operatorname { a r g m a x } } } \ \mathcal { L } _ { R } ( \theta ) , \qquad { \mathrm { w h e r e ~ } } \mathcal { L } _ { R } ( \theta ) = \sum _ { i . . N } \left( \sum _ { \lambda } p \theta ( \lambda \mid \left\{ I O _ { i } ^ { k } \right\} _ { k = 1 . . K } ) \ R _ { i } ( \lambda ) \right) ,
120
+ $$
121
+
122
+ where $R _ { i } ( \lambda )$ is a reward function designed to encode the quality of the sampled programs. Note that this formulation is extremely generic and would allow to represent a wide range of different objective functions. If we assume that we have access to a simulator to run our programs, we can design $R _ { i }$ so as to optimize for generalization on held-out examples, preventing the model to overfit on its inputs. Additional property such as program conciseness, or runtime efficiency could also be encoded into the reward.
123
+
124
+ ![](images/6162ab9de360efe363cf765e8ca2dcf1b6d329f7160feb3a3ba2ed750da8c054.jpg)
125
+ Figure 3: Approximation using a beamsearch. All possibles next tokens are tried for each candidates, the $S$ (here 3) most likely according to $p _ { \theta }$ are kept. When an End-Of-Sequence token (green) is reached, the candidate is held out. At the end, the most likely complete sequences are used to construct an approximate distribution, through rescaling.
126
+
127
+ However, this expressiveness comes at a cost: the inner sum in (7) is over all possible programs and therefore is not tractable to compute. The standard method consists of approximating the objective by defining a Monte Carlo estimate of the expected reward, using $S$ samples from the model. To perform optimization, an estimator of the gradient of the expected reward is built based on the REINFORCE trick (Williams, 1992).
128
+
129
+ $$
130
+ \begin{array} { r l r } { { \mathcal { L } _ { R } ( \theta ) \approx \sum _ { i = 1 . . N } \sum _ { r = 1 } ^ { S } \frac { 1 } { S } R _ { i } ( \lambda _ { r } ) , } } & { \mathrm { ~ w h e r e ~ } \lambda _ { r } \sim p _ { \theta } ( \cdot \vert \{ I O _ { i } ^ { k } \} _ { k = 1 . . K } ) } \\ & { } & { \nabla _ { \theta } \mathcal { L } _ { R } ( \theta ) \approx \sum _ { i = 1 . . N } \sum _ { r = 1 } ^ { S } \frac { 1 } { S } R _ { i } ( \lambda _ { r } ) \log \big ( p _ { \theta } ( \lambda _ { r } \vert \{ I O _ { i } ^ { k } \} _ { k = 1 . . K } ) \big ) } \end{array}
131
+ $$
132
+
133
+ However, given that we sample from a unique model, there is a high chance that we will sample the same programs repeatedly when estimating the gradient. This is especially true when the model has been pre-trained in a supervised manner. A different approach is to approximate the distribution of the learned distribution by another one with a smaller support.
134
+
135
+ To obtain this smaller distribution, one possible solution is to employ the $S$ most likely samples as returned by a Beam Search. We generate the embedding of the IO grids and perform decoding, keeping at each step the $S$ most likely candidates prefixes based on the probability $p _ { \theta }$ given by the model. At step $t$ , we evaluate $p _ { \theta } ( s _ { 1 } \cdot \cdot . s _ { t } , \left\{ I O _ { i } ^ { k } \right\} _ { k = 1 \dots K } ^ { \cdot } )$ for all the possible next token $s _ { t }$ and all the candidates $\left( s _ { 1 } \ldots s _ { t - 1 } \right)$ previously obtained. The $S$ most likely sequences will be the candidates at the $( t + 1 )$ step. Figure 3 represents this process.
136
+
137
+ Based on the final samples obtained, we define a probability distribution to use as an approximation of $p _ { \theta }$ in (7). As opposed to (8), this approximation introduces a bias. It however has the advantage of aligning the training procedure more closely with the testing procedure where only likely samples are going to be decoded. Formally, this corresponds to performing the following approximation of the objective function, $( \mathrm { B S } ( p _ { \theta } , S )$ being the $S$ samples returned by a beam search with beam size $S$ ):
138
+
139
+ $$
140
+ \begin{array} { r l } & { { \mathcal { L } } _ { R } ( \theta ) \approx \displaystyle \sum _ { i = . . . N } \left( \sum _ { \lambda } q \theta \big ( \lambda \big | \left\{ I O _ { i } ^ { k } \right\} _ { k = 1 . . K } \big ) R _ { i } ( \lambda ) \right) } \\ & { \mathrm { ~ w h e r e ~ } \qquad q \theta \big ( \lambda _ { r } \big | \left\{ I O _ { i } ^ { k } \right\} _ { k = 1 . . K } \big ) = \left\{ \begin{array} { l l } { \displaystyle \frac { p _ { \theta } \big ( \lambda _ { r } \big | \left\{ I O _ { i } ^ { k } \right\} _ { k = 1 . . K } \big ) } { \sum _ { \lambda _ { r } \in \mathsf { B S } ( r _ { \theta } , s ) } p _ { \theta } \big ( \lambda _ { r } \big | \left\{ I O _ { i } ^ { k } \right\} _ { k = 1 . . K } \big ) } \qquad } & { \mathrm { i f ~ } \lambda _ { r } \in \mathsf { B S } ( p _ { \theta } , S ) } \\ { 0 \qquad } & { \mathrm { o t h e r w i s e . } } \end{array} \right. } \end{array}
141
+ $$
142
+
143
+ With this approximation, the support of the distribution $q _ { \theta }$ is much smaller as it contains only the $S$ elements returned by the beam search. As a result, the sum become tractable and no estimator are needed. We can simply differentiate this new objective function to obtain the gradients of the loss with regards to $p _ { \theta }$ and use the chain-rule to subsequently obtain gradient with regards to $\theta$ necessary for the optimization. Note that if $S$ is large enough to cover all possible programs, we recover the objective of (7).
144
+
145
+ Based on this more tractable distribution, we can define more complex objective functions. In program synthesis, we have the possibility to prune out several predictions by using the specification. Therefore, we can choose to go beyond optimizing the expected reward when sampling a single program and optimize the expected reward when sampling a bag of $C$ programs and keeping the best one. This results in a new objective function:
146
+
147
+ $$
148
+ \boldsymbol \theta ^ { \star } = \underset { \boldsymbol \theta } { \operatorname { a r g m a x } } \sum _ { i = 1 . . N } \left( \sum _ { \{ \lambda _ { 1 } , \dots , \lambda _ { C } \} \in \mathbf { B } \setminus ( p _ { \theta , s } ) ^ { C } } \left[ \underset { j \in 1 . . C } { \operatorname* { m a x } } R _ { i } ( \lambda _ { j } ) \right] \left( \prod _ { r \in 1 . . C } q _ { \theta } \left( \lambda _ { r } \mid \left\{ I O _ { i } ^ { k } \right\} _ { k = 1 . . R } \right) \right) \right) ,
149
+ $$
150
+
151
+ where $q _ { \theta }$ is defined as previously. We argue that by optimizing this objective function, the model gets the capability of “hedging its bets” and assigning probability mass to several candidates programs, resulting in a higher diversity of outputs.
152
+
153
+ In the special case where the reward function only takes values in $\{ 0 , 1 \}$ , as it is when we are using correctness as a reward, this can be more easily computed as:
154
+
155
+ $$
156
+ \theta ^ { \star } = \operatorname * { a r g m a x } _ { \theta } \sum _ { i = 1 \dots N } \left( 1 - \left( \sum _ { \lambda _ { r } \in \mathrm { B S } ( p _ { \theta } , S ) } \left[ R _ { i } ( \lambda _ { r } ) = = 0 \right] q _ { \theta } ( \lambda _ { r } \mid \left\{ I O _ { i } ^ { k } \right\} _ { k = 1 \dots K } ) \right) ^ { C } \right)
157
+ $$
158
+
159
+ The derivation leading to this formulation as well as a description on how to efficiently compute the more general loss(10) can be found in appendix A. Note that although this formulation brings the training objective function closer to the testing procedure, it is still not ideal. It indeed makes the assumption that if we have a correct program in our bag of samples, we can identify it, ignoring the fact that it is possible to have some incorrect program consistent with the IO pairs partial specification (and therefore not prunable). In addition, this represents a probability where the $C$ programs are sampled independently, which in practice we wouldn’t do.
160
+
161
+ # 5 MODEL
162
+
163
+ # 5.1 CONDITIONING ON THE SYNTAX
164
+
165
+ One aspect of the program synthesis task is that syntactically incorrect programs can be trivially identified and pruned before making a prediction. As a result, if we use stx to denote the event that the sampled program is syntactically correct, what we care about modeling correctly is $p ( \lambda | \left\{ I O _ { i } ^ { k } \right\} _ { k = 1 \ldots K } , \dot { \mathbf { s t x } } )$ k=1..K , stx). Using Bayes rule, we can rewrite this:
166
+
167
+ $$
168
+ \begin{array} { r l } & { p \left( \boldsymbol { \lambda } \mid \left\{ I O _ { i } ^ { k } \right\} _ { k = 1 . . K } , \mathbf { s t x } \right) \propto p \left( \mathbf { s t x } \mid \left\{ I O _ { i } ^ { k } \right\} _ { k = 1 . . K } , \boldsymbol { \lambda } \right) \times p \left( \boldsymbol { \lambda } \mid \left\{ I O _ { i } ^ { k } \right\} _ { k = 1 . . K } \right) } \\ & { \qquad \propto p \left( \mathbf { s t x } \mid \boldsymbol { \lambda } \right) \times p \left( \boldsymbol { \lambda } \mid \left\{ I O _ { i } ^ { k } \right\} _ { k = 1 . . K } \right) } \end{array}
169
+ $$
170
+
171
+ We drop the conditional dependency on the IO pairs in the second line of (12) as the syntactical correctness of the program is independent from the specification when conditioned on the program. We can do the same operation at the token level, denoting by $\mathtt { s t x } _ { 1 \dots t }$ the event that the sequence of the first $t$ tokens $s _ { 1 } \cdot \cdot \cdot s _ { t }$ doesn’t contain any syntax error and may therefore be a prefix to a valid program.
172
+
173
+ $$
174
+ \begin{array} { r l } { p ( \textit { s } _ { t } | \textit { s } _ { 1 } \cdot \cdot \cdot \mathscr { s } _ { t - 1 } , \{ I O _ { i } ^ { k } \} _ { k = 1 . . . K } , \mathfrak { s t x } _ { 1 . . . t } ) \propto } & { p ( \mathfrak { s t x } _ { 1 . . . t } | \mathscr { s } _ { 1 } \cdot \cdot \cdot \mathscr { s } _ { t } ) \times } \\ & { \quad p ( \textit { s } _ { t } | \mathscr { s } _ { 1 } \cdot \cdot \cdot \mathscr { s } _ { t - 1 } , \{ I O _ { i } ^ { k } \} _ { k = 1 . . . K } ) } \end{array}
175
+ $$
176
+
177
+ Given a grammar, it is possible to construct a checker to determine valid prefixes of programs. Example applications include compilers to signal syntax errors to the user and autocomplete features of Integrated Development Environments (IDEs) to restrict the list of suggested completions.
178
+
179
+ The quantity $p \left( \left. \mathbf { s t x } _ { 1 \ldots t } \right| s _ { 1 } \cdot \cdot \cdot s _ { t } \right)$ is therefore not a probability but can be implemented as a deterministic process for a given target programming language. In practice, this is implemented by getting at each timestep a mask $M = \{ - \operatorname { i n f } , 0 \} ^ { | \Sigma | }$ where $M _ { j } = - \operatorname { i n f }$ if the $j$ -th token in the alphabet is not a valid token in the current context, and 0 otherwise. This mask is added to the output of the network, just before the Softmax operation that normalizes the output to a probability over the tokens.
180
+
181
+ Conditioning on the syntactical correctness of the programs provides several advantages: First, sampled programs become syntactically correct by construction. At test time, it allows the beam search to only explore useful candidates. It also ensures that when we are optimizing for correctness, the samples used to approximate the distribution are all going to be valid candidates. Restricting the dimension of the space on which our model is defined also makes the problem simpler to learn.
182
+
183
+ It may not always be feasible to assume access to a syntax checker. In general, we wish to retain the syntax checker’s ability to aggressively prune the search in program space without requiring access to the syntax itself. To this end, we propose to represent the syntax checker as a neural network module and learn it jointly. Similar to the base model, we implement learned syntax checking using an LSTM $g _ { \phi }$ . Comparing to the decoder LSTM, there are two major differences:
184
+
185
+ • The syntaxLSTM is conditioned only on the program tokens, not on the IO pairs. This ensures that the learned checker models only the syntax of the language. • The output of the syntaxLSTM is passed through an elementwise $x \mapsto - \exp ( x )$ activation function and added to the decoder LSTM’s output. Similar to the mask in Section 5.1, the exponential activation function allows the syntaxLSTM to output high penalties to any tokens deemed syntactically incorrect.
186
+
187
+ The addition of the syntaxLSTM doesn’t necessitate any change to the training procedure as it is simply equivalent to a change of architecture. However, in the supervised setting, when we have access to syntactically correct programs, we have the possibility of adding an additional term to the loss (6) to prevent the model from masking valid programs:
188
+
189
+ $$
190
+ \mathcal { L } _ { \mathrm { s y n t a x } } = - \sum _ { i = 1 } \cdots N \sum _ { t = 1 } \cdots L _ { \varnothing } \left( \boldsymbol s _ { t } ^ { i } | \boldsymbol s _ { 1 } ^ { i } \cdots \boldsymbol s _ { t - 1 } ^ { i } \right) , \qquad \mathrm { w h e r e } \lambda _ { i } = [ \boldsymbol s _ { 1 } ^ { i } , \boldsymbol s _ { 2 } ^ { i } \cdots \boldsymbol s _ { L } ^ { i } ]
191
+ $$
192
+
193
+ This loss penalizes the syntaxLSTM for giving negative scores to each token belonging to a known valid program. We use the reference programs as example of valid programs when we perform supervised training.
194
+
195
+ # 6 EXPERIMENTS
196
+
197
+ # 6.1 THE DOMAIN: KAREL
198
+
199
+ The Karel programming language is an educational programming language (Pattis, 1981), used for example in Stanford CS introductory classes (cs1) or in the Hour of Code initiative (hoc). It features an agent inside a gridworld (See Figure 1), capable of moving (move, turn{Left,Right}), modifying world state ({pick,put}Marker), and querying the state of the nearby environment for its own markers (markerPresent, noMarkerPresent) or for natural obstacles (frontIsClear, leftIsClear, rightIsClear). Our goal is to learn to generate a program in the Karel DSL given a small set of input and output grids. The language supports for loops, while loops, and conditionals, but no variable assignment. Compared to the original Karel language, we only removed the possibility of defining subroutines. The specification for the DSL can be found in appendix B.
200
+
201
+ To evaluate our method, we follow the standard practice (Devlin et al., 2017b; Parisotto et al., 2017; Neelakantan et al., 2016; Balog et al., 2017) and use a synthetic dataset generated by randomly sampling programs from the DSL. We perform a few simple heuristic checks to ensure generated programs have observable effect on the world and prune out programs performing spurious actions (e.g. executing a turnLeft just after a turnRight for example). For each program, we a set of IO pairs are generated by sampling random input grids and executing the program on them to obtain the corresponding output grids. A large number of them are sampled and 6 are kept for each program, ensuring that all conditionals in a program are hit by at least one of the examples. The first 5 samples serve as the specification, and the sixth one is kept as held-out test pair. 5000 programs are not used for training, and get split out between a validation set and a test set.
202
+
203
+ We represent the input and output elements as grids where each cell in the grid is a vector with 16 channels, indicating the presence of elements (AgentFacingNorth, AgentFacingSouth, · · · , Obstacle, OneMarkerPresent, TwoMarkersPresent, · · · ). The input and output grids are initially passed through independent convolution layers, before being concatenated and passed through two convolutional residual blocks and a fully connected layer, mapping them to a final 512-dimensional representation. We run one decoder per IO pair and perform a maxpooling operation over the output of all the decoders, out of which we perform the prediction of the next token. Our models are implemented using the Pytorch framework (pyt). Code and data will be made available.
204
+
205
+ <table><tr><td></td><td colspan="2">Full Dataset</td><td colspan="2">Small Dataset</td></tr><tr><td>Top-1</td><td>Generalization</td><td>Exact Match</td><td>Generalization</td><td>Exact Match</td></tr><tr><td>MLE</td><td>71.91</td><td>39.94</td><td>12.58</td><td>8.93</td></tr><tr><td>RL</td><td>68.39</td><td>34.74</td><td>0</td><td>0</td></tr><tr><td>RL_beam</td><td>75.72</td><td>8.21</td><td>25.28</td><td>17.63</td></tr><tr><td>RL_beam_div</td><td>76.20</td><td>31.25</td><td>23.72</td><td>16.31</td></tr><tr><td>RL_beam_div_opt</td><td>77.12</td><td>32.17</td><td>24.24</td><td>16.63</td></tr></table>
206
+
207
+ Table 1: RL_beam optimization of program correctness results in consistent improvements in top-1 generalization accuracy over supervised learning MLE, even though the exact match of recovering the reference program drops. The improved objective function results in further improvements.
208
+
209
+ # 6.2 RESULTS
210
+
211
+ We trained a variety of models on the full Karel dataset containing 1-million examples as well as a reduced dataset containing only $1 0 , 0 0 0$ examples. In general, the small dataset serves to help understand the data efficiency of the program synthesis methods and is motivated by the expected difficulty of obtaining many labeled examples in real-world program synthesis domains.
212
+
213
+ The Karel DSL was previously used by Devlin et al. (2017a) to study the relative perfomances of a range of methods depending on the available amount of data. The task considered was however different as they attempted to perform program induction as opposed to program synthesis. Rather than predicting a program implementing the desired transformation, they simply output a specification of the changes that would result from applying the program so a direct number comparison wouldn’t be meaningful.
214
+
215
+ Models are grouped according to training objectives. As a baseline, we use MLE, which corresponds to the maximum likelihood objective (Eq.6), similar to the method proposed by Devlin et al. (2017b). Unless otherwise specified, the reward considered for our other methods is generalization: $+ 1$ if the program matches all samples, including the held out one and 0 otherwise. RL uses the expected reward objective (Eq.7), using REINFORCE to obtain a gradient estimate (Eq.8). RL_beam attempts to solve the proxy problem described by Equation (9) and RL_beam_div the richer loss function of Equation (10). RL_beam_div_opt also optimizes the loss of equation (10) but the reward additionally includes a term inversly proportional to the number of timesteps it takes for the program to finish executing. All RL models are initialized from pretrained supervised models.
216
+
217
+ Optimizing for correctness (RL): Results in Table 1 show that optimizing for the expected program correctness consistently provides improvements in top-1 generalization accuracy. Top-1 Generalization Accuracy (Eq. 4) denotes the accuracy of the most likely program synthesized by beam search decoding having the correct behaviour across all input-output examples. We didn’t perform any pruning of programs that were incorrect on the 5 specification examples. The improved performance of RL methods confirms our hypothesis that better loss functions can effectively combat the program aliasing problem.
218
+
219
+ On the full dataset, when optimizing for correctness, Exact Match Accuracy decreases, indicating that the RL models no longer prioritize generating programs that exactly match the references. On the small dataset, RL_beam methods improves both exact match accuracy and generalization.
220
+
221
+ Comparing RL_beam to standard RL, we note improvements across all levels of generalization. By better aligning the RL objective with the sampling that happens during beam search decoding, consistent improvements can be made in accuracy. Further improvements are made by encouraging diversity in the beam of solutions (RL_beam_div) and penalizing long running programs (RL_beam_div_opt).
222
+
223
+ In the settings where little training data is available, RL methods show more dramatic improvements over MLE, indicating that data efficiency of program synthesis methods can be greatly improved by using a small number of samples first for supervised training and again for Reinforcement Learning.
224
+
225
+ As a side note, we were unable to achieve high performance when training the RL methods from scratch. The necessity of extensive supervised pretraining to get benefits from Reinforcement
226
+
227
+ <table><tr><td>Top-1 Generalization</td><td>Full Dataset</td><td>Small Dataset</td></tr><tr><td>MLE</td><td>71.91</td><td>12.58</td></tr><tr><td>MLE_learned</td><td>69.37</td><td>17.02</td></tr><tr><td>MLE _handwritten</td><td>72.07</td><td>9.81</td></tr><tr><td>MLE _large</td><td>73.67</td><td>13.14</td></tr></table>
228
+
229
+ Table 2: Top-k accuracies: MLE shows greater relative accuracy increases as k increases than RL. Methods employing beam search and diversity objectives reduce this accuracy gap by encouraging diversity in the beam of partial programs.
230
+
231
+ <table><tr><td>Generalization</td><td>Top-1 Top-5 Top-50</td></tr><tr><td>MLE</td><td>71.91 79.56 86.37</td></tr><tr><td>RL_beam</td><td>75.72 79.29 83.49</td></tr><tr><td>RL_beam_div</td><td>76.20 82.09 85.86</td></tr><tr><td>RL_beam_div_opt</td><td>77.12 82.17 85.38</td></tr></table>
232
+
233
+ Table 3: Grammar prunes the space of possible programs: On the full dataset, handwritten syntax checking MLE_handwritten improves accuracy over no grammar MLE, although MLE_large shows that simply adding more parameters results in even greater gains. On the small dataset, learning the syntax MLE_learned outperforms handwritten grammar and larger models.
234
+
235
+ Learning fine-tuning is well-known in the Neural Machine Translation literature (Ranzato et al., 2016;
236
+ Wu et al., 2016; Wiseman and Rush, 2016; Bahdanau et al., 2017).
237
+
238
+ Table 2 examines the top-1, top-5, and top-50 generalization accuracy of supervised and RL models. RL_beam methods performs best for top-1 but their advantage drops for higher-rank accuracy. Inspection of generated programs shows that the top predictions all become diverse variations of the same program, up to addition/removal of no-operations (turnLeft followed by turnRight, full circle obtained by a series of four turnLeft). The RL_beam_div objective helps alleviate this effect as does RL_beam_div_opt, which penalizes redundant programs. This is important as in the task of Program Synthesis, we may not necessarily need to return the most likely output if it can be pruned by our specification.
239
+
240
+ Impact of syntax: We also compare models according to the use of syntax: MLE_handwritten denotes the use of a handwritten syntax checker (Sec 5.1), MLE_learned denotes a learned syntax (Sec 5.2), while no suffix denotes no syntax usage. Table 3 compares syntax models.
241
+
242
+ On the full dataset, leveraging the handwritten syntax leads to marginally better accuracies than learning the syntax or using no syntax. Given access to enough data, the network seems to be capable of learning to model the syntax using the sheer volume of training examples.
243
+
244
+ On the other hand, when the amount of training data is limited, learning the syntax produces significantly better performance. By incorporating syntactic structure in the model architecture and objective, more leverage is gained from small training data. Interestingly, the learned syntax model even outperforms the handwritten syntax model. We posit the syntaxLSTM is free to learn a richer syntax. For example, the syntaxLSTM could learn to model the distribution of programs and discourage the prediction of not only syntactically incorrect programs, but also the unlikely ones.
245
+
246
+ To control for the extra parameters introduced by the syntaxLSTM, we compare against MLE_large, which uses no syntax but features a larger decoder LSTM, resulting in the same number of parameters as MLE_learned. Results show that the larger number of parameters is not enough to explain the difference in performance, which again indicates the utility of jointly learning syntax.
247
+
248
+ Analysis of learned syntax: Section 5.2 claimed that by decomposing our models into two separate decoders, we could decompose the learning so that one decoder would specialize in picking the likely tokens given the IO pairs, while the other would enforce the grammar of the language. We now provide experimental evidence that this decomposition happens in practice.
249
+
250
+ Table 4 shows the percentage of syntactically correct programs among the most likely predictions of the ${ \bf M L E + }$ learned model trained on the full dataset. Both columns correspond to the same set of parameters but the second column doesn’t apply the syntaxLSTM’s mask to constrain the decoding process. The precipitous drop in syntax accuracy indicates the extent to which the program decoder has learned to rely on the syntaxLSTM to produce syntactically correct programs.
251
+
252
+ Figure 3 compares the syntax masks generated by the learned and handwritten syntax models while decoding Program A in Figure 1. (3a) shows output of the handwritten syntax checker; (3b) shows syntaxLSTM output. White cells indicates tokens that are labeled syntactically correct at each decoding step.
253
+
254
+ Figure 3c analyzes the difference between the handwritten and learned syntax masks. White indicates similar output, which occupies the majority of the visualization. Blue cells correspond to instances where the syntaxLSTM labeled a token correct when it actually was syntactically incorrect. This type of error can be recovered if the program decoder predicts those tokens as unlikely.
255
+
256
+ <table><tr><td>% Synctactically Correct</td><td>Joint Model</td><td>Without Learned Syntax</td></tr><tr><td>Amongst Top1</td><td>100%</td><td>0%</td></tr><tr><td>Amongst Top5</td><td>100 %</td><td>0%</td></tr><tr><td>Amongst Top50</td><td>100 %</td><td>0%</td></tr><tr><td>Amongst Top100</td><td>99.79 %</td><td>.04%</td></tr></table>
257
+
258
+ On the other hand, red cells indicate the syntaxLSTM predicted a valid token is syntactically incorrect. This type of error is more dangerous because the program decoder cannot recover the valid token once it is declared incorrect. The majority of red errors correspond to tokens which are rarely observed in the training dataset, indicating that the syntaxLSTM learns to model more than just syntax - it also captures the distribution over programs. Given a large enough dataset of real programs, the syntaxLSTM learns to consider non-sensical and unlikely programs as syntactically incorrect, ensuring that generated programs are both syntactically correct and likely.
259
+
260
+ ![](images/e35294641612e826d101b53ba678d4ef72143e4a9050fd2d1f76a85e7228fa3e.jpg)
261
+ Table 4: Importance of Syntax
262
+ Figure 3: Syntax Comparison
263
+
264
+ # 7 CONCLUSION
265
+
266
+ We presented two novel contributions to improve stateof-the-art neural program synthesis techniques. Our first contribution uses Reinforcement Learning to optimize for generating any consistent program, which we show helps in improving generalization accuracy of the learned programs for large training datasets. Our second contribution incorporates syntax checking as an additional conditioning mechanism for pruning the space of programs during decoding. We show that incorporating syntax leads to significant improvements with limited training datasets.
267
+
268
+ # REFERENCES
269
+
270
+ Stanford CS106A course page. https://see.stanford.edu/Course/CS106A. Accessed: 2017-05- 16.
271
+
272
+ Hour of Code. http://hourofcode.codehs.com/. Accessed: 2017-05-16.
273
+
274
+ Pytorch. http://pytorch.org/.
275
+
276
+ Saul Amarel. Representations and modeling in problems of program formation. Rutgers University. Livingstone College. Department of Computer Science, 1970.
277
+
278
+ Dzmitry Bahdanau, Philemon Brakel, Kelvin Xu, Anirudh Goyal, Ryan Lowe, Joelle Pineau, Aaron Courville, and Yoshua Bengio. An actor-critic algorithm for sequence prediction. ICLR, 2017.
279
+
280
+ Matej Balog, Alexander L Gaunt, Marc Brockschmidt, Sebastian Nowozin, and Daniel Tarlow. Deepcoder: Learning to write programs. In ICLR, 2017.
281
+
282
+ Rudy R Bunel, Alban Desmaison, Pawan K Mudigonda, Pushmeet Kohli, and Philip Torr. Adaptive neural compilation. In NIPS, 2016.
283
+
284
+ Jonathon Cai, Richard Shin, and Dawn Song. Making neural programming architectures generalize via recursion. In ICLR, 2017.
285
+
286
+ Jacob Devlin, Rudy R Bunel, Rishabh Singh, Matthew Hausknecht, and Pushmeet Kohli. Neural program meta-induction. 2017a.
287
+
288
+ Jacob Devlin, Jonathan Uesato, Surya Bhupatiraju, Rishabh Singh, Abdel-rahman Mohamed, and Pushmeet Kohli. Robustfill: Neural program learning under noisy I/O. In ICML, 2017b.
289
+
290
+ Alexander L Gaunt, Marc Brockschmidt, Rishabh Singh, Nate Kushman, Pushmeet Kohli, Jonathan Taylor, and Daniel Tarlow. Terpret: A probabilistic programming language for program induction. arXiv preprint arXiv:1608.04428, 2016.
291
+
292
+ Alex Graves, Abdel-rahman Mohamed, and Geoffrey Hinton. Speech recognition with deep recurrent neural networks. In ICASSP, 2013.
293
+
294
+ Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. arXiv preprint arXiv:1410.5401, 2014.
295
+
296
+ Alex Graves, Greg Wayne, Malcolm Reynolds, Tim Harley, Ivo Danihelka, Agnieszka Grabska-Barwinska, ´ Sergio Gómez Colmenarejo, Edward Grefenstette, Tiago Ramalho, John Agapiou, et al. Hybrid computing using a neural network with dynamic external memory. Nature, 2016.
297
+
298
+ Edward Grefenstette, Karl Moritz Hermann, Mustafa Suleyman, and Phil Blunsom. Learning to transduce with unbounded memory. In NIPS, 2015.
299
+
300
+ Sumit Gulwani, William R Harris, and Rishabh Singh. Spreadsheet data manipulation using examples. Communications of the ACM, 2012.
301
+
302
+ Kelvin Guu, Panupong Pasupat, Evan Zheran Liu, and Percy Liang. From language to programs: Bridging reinforcement learning and maximum marginal likelihood. In ACL, 2017.
303
+
304
+ Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 1997.
305
+
306
+ Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Judy Hoffman, Fei-Fei Li, C. Lawrence Zitnick, and Ross B. Girshick. Inferring and executing programs for visual reasoning. 2017.
307
+
308
+ Armand Joulin and Tomas Mikolov. Inferring algorithmic patterns with stack-augmented recurrent nets. In NIPS, 2015.
309
+
310
+ Łukasz Kaiser and Ilya Sutskever. Neural gpus learn algorithms. In ICLR, 2016.
311
+
312
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In NIPS, 2012.
313
+
314
+ Karol Kurach, Marcin Andrychowicz, and Ilya Sutskever. Neural random-access machines. In ICLR, 2016.
315
+
316
+ Matt J Kusner, Brooks Paige, and José Miguel Hernández-Lobato. Grammar variational autoencoder. In ICML, 2017.
317
+
318
+ Chengtao Li, Daniel Tarlow, Alexander L. Gaunt, Marc Brockschmidt, and Nate Kushman. Neural program lattices. In ICLR, 2017.
319
+
320
+ Percy Liang, Michael I Jordan, and Dan Klein. Learning programs: A hierarchical bayesian approach. In ICML, 2010.
321
+
322
+ Henry Lieberman. Your wish is my command: Programming by example. 2001.
323
+
324
+ Stephen Muggleton. Inductive logic programming. New generation computing, 1991.
325
+
326
+ Stephen H Muggleton, Dianhuan Lin, Niels Pahlavi, and Alireza Tamaddoni-Nezhad. Meta-interpretive learning: application to grammatical inference. Machine learning, 2014.
327
+
328
+ Arvind Neelakantan, Quoc V Le, and Ilya Sutskever. Neural programmer: Inducing latent programs with gradient descent. In ICLR, 2016.
329
+
330
+ Emilio Parisotto, Abdelrahman Mohamed, Rishabh Singh, Lihong Li, Denny Zhou, and Pushmeet Kohli. Neuro-symbolic program synthesis. In ICLR, 2017.
331
+
332
+ Richard E Pattis. Karel the robot: a gentle introduction to the art of programming. John Wiley & Sons, Inc., 1981.
333
+
334
+ Marc’Aurelio Ranzato, Sumit Chopra, Michael Auli, and Wojciech Zaremba. Sequence level training with recurrent neural networks. In ICLR, 2016.
335
+
336
+ Scott Reed and Nando de Freitas. Neural programmer-interpreters. In ICLR, 2016.
337
+
338
+ Sebastian Riedel, Matko Bosnjak, and Tim Rocktäschel. Programming with a differentiable forth interpreter. In ICML, 2017.
339
+
340
+ Phillip D Summers. A methodology for lisp program construction from examples. Journal of the ACM, 1977.
341
+
342
+ Richard J Waldinger and Richard CT Lee. Prow: A step toward automatic program writing. In IJCAI, 1969.
343
+
344
+ Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 1992.
345
+
346
+ Sam Wiseman and Alexander M Rush. Sequence-to-sequence learning as beam-search optimization. In EMNLP, 2016.
347
+
348
+ 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.
349
+
350
+ Pengcheng Yin and Graham Neubig. A syntactic neural model for general-purpose code generation. In ACL, 2017.
351
+
352
+ # A COMPUTING THE RICHER LOSS FUNCTION
353
+
354
+ In this section, we describe how the objective function of Equation (10) can be computed.
355
+
356
+ We have a distribution $q _ { \theta }$ over $S$ programs, as obtained by performing a beam search over $p _ { \theta }$ and renormalizing. We are going to get $C$ independent samples from this distribution and obtain a reward corresponding to the best performing of all of them.
357
+
358
+ In the case where the reward function $R _ { i } ( \lambda _ { r } )$ is built on a boolean property, such as for example “correctness of the generated program”, Equation (10) can be simplified. As $R _ { i } ( \lambda _ { r } )$ can only take the values 0 or 1, the term $\operatorname* { m a x } _ { j \in 1 \ldots C } R _ { i } ( \lambda _ { j } )$ is going to be equal to 0 only if all of the $C$ sampled programs give a reward of zero. For each sample, there is a probability of $\begin{array} { r } { q _ { \mathrm { i n c o r r e c t } } = \sum _ { \lambda _ { r } \in { \bf B S } ( p _ { \theta } , S ) } [ R _ { i } ( \bar { \lambda _ { r } } ) = = 0 ] q _ { \theta } ( \lambda _ { r } \mid \{ I O _ { i } ^ { k } \} _ { k = 1 \dots K } ) } \end{array}$ of samput of the g a prograsamples is ewards. From $C$ $q _ { \mathrm { i n c o r r e c t } } ^ { C }$ this, we can derive the form of Equation (11). Note that this can be computed without any additional sampling steps as we have a close form solution for this expectation.
359
+
360
+ In the general case, a similar derivation can be obtained. Assume that the programs outputted by the beam search have associated rewards $R _ { 0 } , R _ { 1 } , . . . , R _ { S }$ and assume without loss of generality that $R _ { 0 } < R _ { 1 } < . . < R _ { S }$ . The probability of sampling a program with a reward smaller than $R _ { i }$ is $\begin{array} { r } { q _ { \le R _ { i } } = \sum _ { \lambda _ { r } \in \mathrm { B S } ( p _ { \theta } , S ) } [ R _ { i } ( \lambda _ { r } ) \le R _ { i } ] \stackrel { \cdot } { q _ { \theta } } ( \lambda _ { r } \mid \{ { \hat { I } } { \hat { O } } _ { i } ^ { k } \} _ { k = 1 \ldots K } ^ { - } ) } \end{array}$ so the probability of obtaining a final reward of less than $R _ { i }$ when sampling $\textrm { C }$ samples is $q _ { \leq { R _ { i } } } ^ { C }$ . As a result, the probability of obtaining a reward of exactly $R _ { i }$ is $\left( q _ { \leq R _ { i } } ^ { C } - q _ { \leq R _ { i - 1 } } ^ { C } \right)$ . Based on this, it is easy to evaluate (and differentiate) the loss function described by Equation (10).
361
+
362
+ # B KAREL LANGAGE SPECIFICATION
363
+
364
+ $$
365
+ \begin{array} { r c l } { \operatorname { P r o g } p } & { : = } & { \det \operatorname { r u n } ( ) : s } \\ { \operatorname { S t m } \textstyle * } & { : = } & { \textstyle \operatorname { w h i l } \textstyle \mathrm { 1 } \cdot \boldsymbol { \mathrm { s } } \left| \operatorname { r e p e a t } ( r ) : s \right| \textstyle \mathrm { s } _ { 1 } ; \boldsymbol { s } _ { 2 } \left| \alpha \right. } \\ & { \big | } & { \big | \big | \big | \big | \big | \big | \operatorname { s } : \big | \operatorname { i f e l s e } ( b ) : \boldsymbol { s } _ { 1 } \big . \mathrm { e l s e } : \boldsymbol { s } _ { 2 } } \\ { \operatorname { C o n d } b } & { : = } & { \textstyle \operatorname { f r o n t } \operatorname { I s C l e a r } ( ) \big | \big | \operatorname { l e f t } \operatorname { I s C l e a r } ( ) \big | \big | \operatorname { r i g h t } \operatorname { I s C l e a r } ( ) } \\ & { \big | } & { \textstyle \operatorname { m a r k e r s p r e s e n t } ( ) \big | \operatorname { n o M a r k e r s P r e s e n t } ( ) \big | \operatorname { n o t } b } \\ { \operatorname { A c t i o n } \big . } & { : = } & { \operatorname { m o v e } \big ( ) \big | \operatorname { t u r n R i g h t } \big ( ) \big | \operatorname { t u r n L e f t } ( ) } \\ & { \big | } & { \big | \operatorname { p i c k M a r k e r } ( ) \big | \operatorname { p u t M a r k e r } ( ) } \\ { \operatorname { C s t e r } } & { : = } & { 0 \big | 1 \big | \operatorname { 1 } \dots | \operatorname { l 9 } } \end{array}
366
+ $$
367
+
368
+ Figure 4: The Domain-specific language for Karel programs.
369
+
370
+ # C EXPERIMENTS HYPERPARAMETERS
371
+
372
+ The state of the grid word are represented as a $1 6 \times 1 8 \times 1 8$ tensor. For each cell of the grid, the 16-dimensional vector corresponds to the feature indicated in Table 5
373
+
374
+ The decoders are two-layer LSTM with a hidden size of 256. Tokens of the DSL are embedded to a 256 dimensional vector. The input of the LSTM is therefore of dimension 768 (256 dimensional of the token $+ 5 1 2$ dimensional of the IO pair embedding). The LSTM used to model the syntax is similarly sized but doesn’t take the embedding of the IO pairs as input so its input size is only 256.
375
+
376
+ One decoder LSTM is run on the embedding of each IO pair. The topmost activation are passed through a MaxPooling operation to obtain a 256 dimensional vector representing all pairs. This is passed through a linear layer to obtain a score for each of the 52 possible tokens. We add the output of the model and of the eventual syntax model, whether learned or handwritten and pass it through a SoftMax layer to obtain a probability distribution over the next token.
377
+
378
+ All training is performed using the Adam optimizer, with a learning rate of $1 0 ^ { - } 4$ . Supervised training used a batch size of 128 and RL methods used a batch size of 16. We used 100 rollouts per samples for the Reinforce method and a beam size of 64 for methods based on the beam search. The value of C used for the methods computing a loss on bags of programs was 5.
379
+
380
+ Table 5: Representation of the grid
381
+
382
+ <table><tr><td rowspan=1 colspan=1>Hero facingNorth</td></tr><tr><td rowspan=1 colspan=1>Hero facingSouth</td></tr><tr><td rowspan=1 colspan=1>Hero facing West</td></tr><tr><td rowspan=1 colspan=1>Hero facing East</td></tr><tr><td rowspan=1 colspan=1>Obstacle</td></tr><tr><td rowspan=1 colspan=1>Grid boundary</td></tr><tr><td rowspan=1 colspan=1>1 marker</td></tr><tr><td rowspan=1 colspan=1>2 marker</td></tr><tr><td rowspan=1 colspan=1>3 marker</td></tr><tr><td rowspan=1 colspan=1>4 marker</td></tr><tr><td rowspan=1 colspan=1>5marker</td></tr><tr><td rowspan=1 colspan=1>6 marker</td></tr><tr><td rowspan=1 colspan=1>7 marker</td></tr><tr><td rowspan=1 colspan=1>8 marker</td></tr><tr><td rowspan=1 colspan=1>9 marker</td></tr><tr><td rowspan=1 colspan=1>10 marker</td></tr></table>
383
+
384
+ Table 6: Encoding of the Input/Output Pairs
385
+
386
+ <table><tr><td rowspan="2">Grid Embedding</td><td>Input Grid Conv2D,kernel size= 3, padding=1,16 →32</td><td>Output Grid Conv2D,kernel size=3,padding=1,16-&gt;32</td></tr><tr><td>ReLU</td><td>ReLU Conv2D,kernel size=3,padding1,64 → 64</td></tr><tr><td>Residual Block 1</td><td colspan="2">ReLU Conv2D, kernel size = 3, padding 1, 64 → 64 ReLU Conv2D,kernel size = 3,padding1,64 →→ 64 ReLU</td></tr><tr><td rowspan="2">Residual Block 1</td><td>Conv2D,kernel size =3,padding1, 64 -→ 64 Conv2D,kernel size = 3, padding 1, 64 -→ 64</td><td>ReLU</td></tr><tr><td>Conv2D,kernel size = 3, padding 1, 64 -→ 64</td><td>ReLU</td></tr><tr><td>Fully Connected</td><td colspan="2">ReLU Linear,20736→512</td></tr></table>
md/train/H1e572A5tQ/H1e572A5tQ.md ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TARMAC: TARGETED MULTI-AGENT COMMUNICATION
2
+
3
+ # Anonymous authors
4
+
5
+ Paper under double-blind review
6
+
7
+ # ABSTRACT
8
+
9
+ We explore a collaborative multi-agent reinforcement learning setting where a team of agents attempts to solve cooperative tasks in partially-observable environments. In this scenario, learning an effective communication protocol is key. We propose a communication architecture that allows for targeted communication, where agents learn both what messages to send and who to send them to, solely from downstream task-specific reward without any communication supervision.
10
+
11
+ Additionally, we introduce a multi-stage communication approach where the agents co-ordinate via multiple rounds of communication before taking actions in the environment. We evaluate our approach on a diverse set of cooperative multi-agent tasks, of varying difficulties, with varying number of agents, in a variety of environments ranging from 2D grid layouts of shapes and simulated traffic junctions to complex 3D indoor environments. We demonstrate the benefits of targeted as well as multi-stage communication. Moreover, we show that the targeted communication strategies learned by agents are both interpretable and intuitive.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Effective communication is a key ability for collaborative multi-agents systems. Indeed, intelligent agents (humans or artificial) in real-world scenarios can significantly benefit from exchanging information that enables them to coordinate, strategize, and utilize their combined sensory experiences to act in the physical world. The ability to communicate has wide-ranging applications for artificial agents – from multi-player gameplay in simulated games (e.g. DoTA, Quake, StarCraft) or physical worlds (e.g. robot soccer), to networks of self-driving cars communicating with each other to achieve safe and swift transport, to teams of robots on search-and-rescue missions deployed in hostile and fast-evolving environments.
16
+
17
+ A salient property of human communication is the ability to hold targeted interactions. Rather than the ‘one-size-fits-all’ approach of broadcasting messages to all participating agents, as has been previously explored (Sukhbaatar et al., 2016; Foerster et al., 2016), it can be useful to direct certain messages to specific recipients. This enables a more flexible collaboration strategy in complex environments. For example, within a team of search-and-rescue robots with a diverse set of roles and goals, a message for a fire-fighter (“smoke is coming from the kitchen”) is largely meaningless for a bomb-defuser.
18
+
19
+ In this work we develop a collaborative multi-agent deep reinforcement learning approach that supports targeted communication. Crucially, each individual agent actively selects which other agents to send messages to. This targeted communication behavior is operationalized via a simple signaturebased soft attention mechanism: along with the message, the sender broadcasts a key which encodes properties of agents the message is intended for, and is used by receivers to gauge the relevance of the message. This communication mechanism is learned implicitly, without any attention supervision, as a result of end-to-end training using a downstream task-specific team reward.
20
+
21
+ The inductive bias provided by soft attention in the communication architecture is sufficient to enable agents to 1) communicate agent-goal-specific messages (e.g. guide fire-fighter towards fire, bomb-defuser towards bomb, etc.), 2) be adaptive to variable team sizes (e.g. the size of the local neighborhood a self-driving car can communicate with changes as it moves), and 3) be interpretable through predicted attention probabilities that allow for inspection of which agent is communicating what message and to whom.
22
+
23
+ Our results however show that just using targeted communication is not enough. Complex realworld tasks might require large populations of agents to go through multiple stages of collaborative communication and reasoning, involving large amounts of information to be persistent in memory and exchanged via high-bandwidth communication channels. To this end, our actor-critic framework combines centralized training with decentralized execution (Lowe et al., 2017), thus enabling scaling to a large number of agents. In this context, our inter-agent communication architecture supports multiple stages of targeted interactions at every time-step, and the agents’ recurrent policies support persistent relevant information in internal states.
24
+
25
+ While natural language, i.e. a finite set of discrete tokens with pre-specified human-conventionalized meanings, may seem like an intuitive protocol for inter-agent communication – one that enables human-interpretability of interactions – forcing machines to communicate among themselves in discrete tokens presents additional training challenges. Since our work focuses on machine-only multi-agent teams, we allow agents to communicate via continuous vectors (rather than discrete symbols), and via the learning process, agents have the flexibility to discover and optimize their communication protocol as per task requirements.
26
+
27
+ We provide extensive empirical demonstration of the efficacy of our approach across a range of tasks, environments, and team sizes. We begin by benchmarking multi-agent communication with and without attention on a cooperative navigation task derived from the SHAPES environment (Andreas et al., 2016). We show that agents learn intuitive attention behavior across a spectrum of task difficulties. Next, we evaluate the same targeted multi-agent communication architecture on the traffic junction environment (Sukhbaatar et al., 2016), and show that agents are able to adaptively focus on ‘active’ agents in the case of varying team sizes. Finally, we demonstrate effective multi-agent communication in 3D environments on a cooperative first-person point-goal navigation task in the rich House3D environment (Wu et al., 2018).
28
+
29
+ # 2 RELATED WORK
30
+
31
+ Multi-agent systems fall at the intersection of game theory, distributed systems, and Artificial Intelligence in general (Shoham & Leyton-Brown, 2008), and thus have a rich and diverse literature. Our work builds on and is related to prior work in deep multi-agent reinforcement learning, the centralized training and decentralized execution paradigm, and emergent communication protocols.
32
+
33
+ Multi-Agent Reinforcement Learning (MARL). Within MARL (see Busoniu et al. (2008) for a survey), our work is related to recent efforts on using recurrent neural networks to approximate agent policies (Hausknecht & Stone, 2015), algorithms stabilizing multi-agent training (Lowe et al., 2017; Foerster et al., 2018), and tasks in novel application domains such as coordination and navigation in 3D simulated environments (Peng et al., 2017; OpenAI, 2018; Jaderberg et al., 2018).
34
+
35
+ Centralized Training & Decentralized Execution. Both Sukhbaatar et al. (2016) and Hoshen (2017) adopt a fully centralized framework at both training and test time – a central controller processes local observations from all agents and outputs a probability distribution over joint actions. In this setting, any controller (e.g. a fully-connected network) can be viewed as implicitly encoding communication. Sukhbaatar et al. (2016) present an efficient architecture to learn a centralized controller invariant to agent permutations – by sharing weights and averaging as in Zaheer et al. (2017). Meanwhile Hoshen (2017) proposes to replace averaging by an attentional mechanism to allow targeted interactions between agents. While closely related to our communication architecture, his work only considers fully supervised one-next-step prediction tasks, while we tackle the full reinforcement learning problem with tasks requiring planning over long time horizons.
36
+
37
+ Moreover, a centralized controller quickly becomes intractable in real-world tasks with many agents and high-dimensional observation spaces (e.g. navigation in House3D (Wu et al., 2018)). To address these weaknesses, we adopt the framework of centralized learning but decentralized execution (following Foerster et al. (2016); Lowe et al. (2017)) and further relax it by allowing agents to communicate. While agents can use extra information during training, at test time, they pick actions solely based on local observations and communication messages received from other agents.
38
+
39
+ Finally, we note that fully decentralized execution at test time without communication is very restrictive. It means 1) each agent must act myopically based solely on its local observation and 2) agents cannot coordinate their actions. In our setting, communication between agents offers a reasonable trade-off between allowing agents to globally coordinate while retaining tractability (since the communicated messages are much lower-dimensional than the observation space).
40
+
41
+ <table><tr><td></td><td>Decentralized Execution</td><td>Targeted Communication</td><td>Multi-Stage Decisions</td><td>Reinforcement Learning</td></tr><tr><td>DIAL (Foerster et al., 2016)</td><td>Yes</td><td>No</td><td>No</td><td>Yes (Q-Learning)</td></tr><tr><td>CommNets (Sukhbaatar et al., 2016)</td><td>No</td><td>No</td><td>Yes</td><td>Yes (REINFORCE)</td></tr><tr><td>VAIN (Hoshen, 2017)</td><td>No</td><td>Yes</td><td>Yes</td><td>No (Supervised)</td></tr><tr><td>ATOC (Jiang &amp; Lu,2018)</td><td>Yes</td><td>No</td><td>No</td><td>Yes (Actor-Critic)</td></tr><tr><td>TarMAC (this paper)</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes (Actor-Critic)</td></tr></table>
42
+
43
+ Table 1: Comparison with previous work on collaborative multi-agent communication with continuous vectors.
44
+
45
+ Emergent Communication Protocols. Our work is also related to recent work on learning communication protocols in a completely end-to-end manner with reinforcement learning – from perceptual input (e.g. pixels) to communication symbols (discrete or continuous) to actions (e.g. navigating in an environment). While (Foerster et al., 2016; Jorge et al., 2016; Das et al., 2017; Kottur et al., 2017; Mordatch & Abbeel, 2017; Lazaridou et al., 2017) constrain agents to communicate with discrete symbols with the explicit goal to study emergence of language, our work operates in the paradigm of learning a continuous communication protocol in order to solve a downstream task (Sukhbaatar et al., 2016; Hoshen, 2017; Jiang & Lu, 2018). While (Jiang & Lu, 2018) also operate in a decentralized execution setting and use an attentional communication mechanism, their setup is significantly different from ours as they use attention to decide when to communicate, not who to communicate with (‘who’ depends on a hand-tuned neighborhood parameter in their work). Table 1 summarizes the main axes of comparison between our work and previous efforts in this exciting space.
46
+
47
+ # 3 TECHNICAL BACKGROUND
48
+
49
+ Decentralized Partially Observable Markov Decision Processes (Dec-POMDPs). A DecPOMDP is a cooperative multi-agent extension of a partially observable Markov decision process (Oliehoek (2012)). For $N$ agents, it is defined by a set of states $S$ describing possible configurations of all agents, a global reward function $R$ , a transition probability function $T$ , and for each agent $i \in { 1 , . . . , N }$ a set of allowed actions $A _ { i }$ , a set of possible observations $\Omega _ { i }$ and an observation function $O _ { i }$ . Operationally, at each time step every agent picks an action $a _ { i }$ based on its local observation $\omega _ { i }$ following its own stochastic policy $\pi _ { \boldsymbol { \theta } _ { i } } ( a _ { i } | \omega _ { i } )$ . The system randomly transitions to the next state $s ^ { \prime }$ given the current state and joint action $T ( s ^ { \prime } | s , a _ { 1 } , . . . , a _ { N } )$ . The agent team receives a global reward $r = R ( s , a _ { 1 } , . . . , a _ { N } )$ while each agent receives a local observation of the new state ř $O _ { i } ( \omega _ { i } | s ^ { \prime } )$ . gents aim to maximize the total expected return $\begin{array} { r } { J = \sum _ { t = 0 } ^ { T } \gamma ^ { t } r _ { t } } \end{array}$ where $\gamma$ is a discount factor and $T$
50
+
51
+ Actor-Critic Algorithms. Policy gradient methods directly adjust the parameters $\theta$ of the policy in order to maximize the objective $\begin{array} { r } { \dot { J ( \theta ) } = \mathbb { E } _ { s \sim p _ { \pi } , a \sim \pi _ { \theta } ( s ) } \left[ \dot { R ( s , a ) } \right] } \end{array}$ by taking steps in the direction of $\nabla J ( \theta )$ . We can write the gradient with respect to the policy parameters as
52
+
53
+ $$
54
+ \nabla _ { \theta } J ( \theta ) = \mathbb { E } _ { s \sim p _ { \pi } , a \sim \pi _ { \theta } ( s ) } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a | s ) Q _ { \pi } ( s , a ) \right] ,
55
+ $$
56
+
57
+ where $Q _ { \pi } ( s , a )$ is called the action-value, it is the expected remaining discounted reward if we take action $a$ in state $s$ and follow policy $\pi$ thereafter. Actor-Critic algorithms learn an approximation of the unknown true action-value function $\hat { Q } ( s , a )$ by e.g. temporal-difference learning (Sutton & Barto, 1998). This $\hat { Q } ( s , a )$ is called the Critic while the policy $\pi _ { \theta }$ is called the Actor.
58
+
59
+ Multi-Agent Actor-Critic. Lowe et al. (2017) propose a multi-agent Actor-Critic algorithm adapted to centralized learning and decentralized execution. Each agent learns its own individual policy $\pi _ { \theta _ { i } } ( a _ { i } | \omega _ { i } )$ conditioned on local observation $\omega _ { i }$ , using a centralized Critic which estimates the joint action-value $\hat { Q } ( s , a _ { 1 } , . . . , a _ { N } )$ .
60
+
61
+ # 4 TARMAC: TARGETED MULTI-AGENT COMMUNICATION
62
+
63
+ We now describe our multi-agent communication architecture in detail. Recall that we have $N$ agents with policies $\left\{ \pi _ { 1 } , . . . , \pi _ { N } \right\}$ , respectively parameterized by $\big \{ \theta _ { 1 } , . . . , \theta _ { N } \big \}$ , jointly performing a cooperative task. At every timestep $t$ , the ith agent for all $i \in \{ 1 , . . . , N \}$ sees a local observation $\omega _ { i } ^ { t }$ , and must select a discrete environment action $\bar { \boldsymbol { a } } _ { i } ^ { t } \sim \pi _ { \boldsymbol { \theta } _ { i } }$ and a continuous communication message $m _ { i } ^ { t }$ , received by other agents at the next timestep, in order to maximize global reward $r _ { t } \sim R$ . Since no agent has access to the underlying state of the environment $s _ { t }$ , there is incentive in communicating with each other and being mutually helpful to do better as a team.
64
+
65
+ ![](images/bc395e5a5aab975be313e2a5d3bd2a0e1cdee750a7a411855df61900ec279d8a.jpg)
66
+ Figure 1: Overview of our multi-agent architecture with targeted communication. Left: At every timestep, each agent policy gets a local observation $\boldsymbol { \omega } _ { i } ^ { t }$ and aggregated message $c _ { i } ^ { t }$ as input, and predicts an environment action $a _ { i } ^ { \overline { { t } } }$ and a targeted communication message $m _ { i } ^ { \bar { t } }$ . Right: Targeted communication between agents is implemented as a signature-based soft attention mechanism. Each agent broadcasts a message $m _ { i } ^ { t }$ consisting of a signature $k _ { i } ^ { t }$ , which can be used to encode agent-specific information and a value $\boldsymbol { v } _ { i } ^ { t }$ , which contains the actual message. At the next timestep, each receiving agent gets as input a convex combination of message values, where the attention weights are obtained by a dot product between sender’s signature $k _ { i } ^ { t }$ and a query vector $\boldsymbol q _ { j } ^ { t + 1 }$ predicted from the receiver’s hidden state.
67
+
68
+ Policies and Decentralized Execution. Each agent is essentially modeled as a Dec-POMDP augmented with communication. Each agent’s policy $\pi _ { \boldsymbol { \theta } _ { i } }$ is implemented as a 1-layer Gated Recurrent Unit (Cho et al., 2014). At every timestep, the local observation $\omega _ { i } ^ { t }$ and a vector $c _ { i } ^ { t }$ aggregating messages sent by all agents at the previous timestep (described in more detail below) are used to update the hidden state $h _ { i } ^ { t }$ of the GRU, which encodes the entire message-action-observation history up to time $t$ . From this internal state representation, the agent’s policy $\pi _ { \theta _ { i } } \left( a _ { i } ^ { t } | h _ { i } ^ { t } \right)$ predicts a categorical distribution over the space of actions, and another output head produces an outgoing message vector $m _ { i } ^ { t }$ . Note that for all our experiments, agents are symmetric and policies are instantiated from the same set of shared parameters; i.e. $\theta _ { 1 } = \ldots = \theta _ { N }$ . This considerably speeds up learning.
69
+
70
+ Centralized Critic. Following prior work (Lowe et al., 2017; Foerster et al., 2018), we operate under the centralized learning and decentralized execution paradigm wherein during training, a centralized critic guides the optimization of individual agent policies. The centralized Critic takes as input predicted actions $\{ a _ { 1 } ^ { \bar { t } } , . . . , a _ { N } ^ { t } \}$ and internal state representations $\{ h _ { 1 } ^ { t } , . . . , h _ { N } ^ { t } \}$ from all agents to estimate the joint action-value $\hat { Q } _ { t }$ at every timestep. The centralized Critic is learned by temporal difference (Sutton $\&$ Barto, 1998) and the gradient of the expected return $J ( \theta _ { i } ) = \mathbb { E } [ R ]$ with respect to policy parameters is approximated by:
71
+
72
+ $$
73
+ \nabla _ { \theta _ { i } } J ( \theta _ { i } ) = \mathbb { E } \left[ \nabla _ { \theta _ { i } } \log \pi _ { \theta _ { i } } ( a _ { i } ^ { t } | h _ { i } ^ { t } ) \ \hat { Q } _ { t } ( h _ { 1 } ^ { t } , . . . , h _ { N } ^ { t } , a _ { t } ^ { 1 } , . . . , a _ { t } ^ { N } ) \right] .
74
+ $$
75
+
76
+ Note that compared to an individual critic $\hat { Q } _ { i } ( h _ { i } ^ { t } , a _ { i } ^ { t } )$ for each agent, having a centralized critic leads to considerably lower variance in policy gradient estimates since it takes into account actions from all agents. At test time, the critic is not needed anymore and policy execution is fully decentralized.
77
+
78
+ Targeted, Multi-Stage Communication. Establishing complex collaboration strategies requires targeted communication i.e. the ability to send specific messages to specific agents, as well as multi
79
+
80
+ stage communication i.e. multiple rounds of back-and-forth interactions between agents. We use a signature-based soft-attention mechanism in our communication structure to enable targeting. Each message $m _ { i } ^ { t }$ consists of 2 parts – a signature $k _ { i } ^ { t } \in \mathbb { R } ^ { d _ { k } }$ to target recipients, and a value $\mathcal { \mathbf { v } } _ { i } ^ { t } \in \mathbb { \breve { R } } ^ { d _ { v } }$ :
81
+
82
+ $$
83
+ m _ { i } ^ { t } = \big [ \begin{array} { c c } { { \frac { \mathrm { s i g n a t u r e } } { k _ { i } ^ { t } } } } & { { } } \\ { { } } & { { \frac { v _ { i } ^ { t } } { \mathrm { v a l u e } } } } \end{array} \big ] .
84
+ $$
85
+
86
+ At the receiving end, each agent (indexed by $j$ ) predicts a query vector $q _ { j } ^ { t + 1 } \in \mathbb { R } ^ { d _ { k } }$ from its hidden state ? $h _ { j } ^ { t + 1 }$ and uses it to compute a dot product with signatures of all $N$ messages. This is scaled by $1 / \sqrt { d _ { k } }$ followed by a softmax to obtain attention weight $\alpha _ { j i }$ for each message value vector:
87
+
88
+ $$
89
+ \alpha _ { j } = \mathrm { s o f t m a x } \left[ \frac { { q _ { j } ^ { t + 1 } } ^ { T } k _ { 1 } ^ { t } } { \sqrt { d _ { k } } } \dots \frac { { q _ { j } ^ { t + 1 } } ^ { T } k _ { i } ^ { t } } { \hdots \hdots \hdots } \hdots \frac { { q _ { j } ^ { t + 1 } } ^ { T } k _ { N } ^ { t } } { \sqrt { d _ { k } } } \right]
90
+ $$
91
+
92
+ $$
93
+ c _ { j } ^ { t + 1 } = \sum _ { i = 1 } ^ { N } \alpha _ { j i } v _ { i } ^ { t } .
94
+ $$
95
+
96
+ Note that equation 2 also includes $\alpha _ { i i }$ corresponding to the ability to self-attend (Vaswani et al., 2017), which we empirically found to improve performance, especially in situations when an agent has found the goal in a coordinated navigation task and all it is required to do is stay at the goal, so others benefit from attending to this agent’s message but return communication is not needed.
97
+
98
+ For multiple stages of communication, aggregated message vector $c _ { j } ^ { t + 1 }$ and internal state $h _ { j } ^ { t }$ are first used to predict the next internal state ${ h ^ { \prime } } _ { j } ^ { t }$ taking into account a first round of communication:
99
+
100
+ $$
101
+ { h ^ { \prime } } _ { j } ^ { t } = \operatorname { t a n h } ( W _ { h h ^ { \prime } } [ \ c _ { j } ^ { t + 1 } \ \parallel \ h _ { j } ^ { t } \ ] ) .
102
+ $$
103
+
104
+ Next, ${ h ^ { \prime } } _ { j } ^ { t }$ is used to predict signature, query, value followed by repeating Eqns 1-4 for multiple rounds until we get a final aggregated message vector $c _ { j } ^ { t + 1 }$ to be used as input at the next timestep.
105
+
106
+ # 5 EXPERIMENTS
107
+
108
+ We evaluate our targeted multi-agent communication architecture on a variety of tasks and environments. All our models were trained with a batched synchronous version of the multi-agent ActorCritic described above, using RMSProp with a learning rate of $7 \times 1 0 ^ { - 4 }$ and $\alpha = 0 . 9 9$ , batch size 16, discount factor $\gamma = 0 . 9 9$ and entropy regularization coefficient 0.01 for agent policies. All our agent policies are instantiated from the same set of shared parameters; i.e. $\theta _ { 1 } = \ldots = \theta _ { N }$ . Each agent’s GRU hidden state is 128-d, message signature/query is 16-d, and message value is 32-d (unless specified otherwise). All results are averaged over 5 independent runs with different seeds.
109
+
110
+ # 5.1 SHAPES
111
+
112
+ The SHAPES dataset was introduced by Andreas et al. $\left( 2 0 1 6 \right)$ , and originally created for testing compositional visual reasoning for the task of visual question answering. It consists of synthetic images of 2D colored shapes arranged in a grid ( $3 \times 3$ cells in the original dataset) along with corresponding question-answer pairs. There are 3 shapes (circle, square, triangle), 3 colors (red, green, blue), and 2 sizes (small, big) in total (see Figure 2).
113
+
114
+ We convert each image from SHAPES into an active environment where agents can now be spawned at different regions of the image, observe a $5 \times 5$ local patch around them and their coordinates, and take actions to move around – tup, down, left, right, stayu. Each agent is tasked with navigating to a specified goal state in the environment – t‘red’, ‘blue square’, ‘small green circle’, etc. $\} -$ and the reward for each agent at every timestep is based on team performance i.e. $\begin{array} { r } { r _ { t } = \frac { \# \mathrm { a g e n t s ~ o n ~ g o a l } } { \# \mathrm { a g e n t s } } } \end{array}$
115
+
116
+ ![](images/4576e03e27c2832c081c391c28c88faecf612a0969853f4bbfb04e6b85fbf912.jpg)
117
+ (a) 4 agents have to find rred, red, green, blues respectively. $t = 1$ : inital spawn locations; $t = 2$ : 4 was on red at $t = 1$ so 1 and 2 attend to messages from 4 since they have to find red. 3 has found its goal (green) and is self-attending; $t = 6$ : 4 attends to messages from 2 as 2 is on $4$ ’s target – blue; $t = 8$ : 1 finds red, so 1 and 2 shift attention to 1; $t = 2 1$ : all agents are at their respective goal locations and primarily self-attending.
118
+
119
+ ![](images/a5b777d28b1efa0d622687ea099c17e88ae1f39400c36192a6b9de31d75798b7.jpg)
120
+
121
+ (b) 8 agents have to find red on a large $1 0 0 \times 1 0 0$ environment. $t = 7$ : Agent 2 finds red and signals all other agents; $t = 7$ to $t = 1 5 0$ : All agents make their way to 2’s location and eventually converge around red.
122
+
123
+ Figure 2: Visualizations of learned targeted communication in SHAPES. Figure best viewed in color.
124
+
125
+ <table><tr><td></td><td></td><td></td><td>30 × 30,4agents,find[red]50 × 50,4agents,find[red]50 × 50,4agents,find[red,red,green,blue]</td></tr><tr><td>No communication</td><td>95.3±2.8%</td><td>83.6±3.3%</td><td>69.1±4.6%</td></tr><tr><td>No attention</td><td>99.7±0.8%</td><td>89.5±1.4%</td><td>82.4±2.1%</td></tr><tr><td>TarMAC</td><td>99.8±0.9%</td><td>89.5±1.7%</td><td>85.8±2.5%</td></tr></table>
126
+
127
+ Table 2: Success rates on 3 different settings of cooperative navigation in the SHAPES environment.
128
+
129
+ Having a symmetric, team-based reward incentivizes agents to cooperate with each other in finding each agent’s goal. For example, as shown in Figure 2a, if agent 2’s goal is to find red and agent 4’s goal is to find blue, it is in agent 4’s interest to let agent 2 know if it passes by red $( t = 2$ ) during its exploration / quest for blue and vice versa $( t = 6$ ). SHAPES serves as a flexible testbed for carefully controlling and analyzing the effect of changing the size of the environment, no. of agents, goal configurations, etc. Figure 2 visualizes learned protocols from two different configurations, and Table 2 reports quantitative evaluation for three different configurations. Benefits of communication and attention increase with task complexity ( $3 0 \times 3 0 \to 5 0 \times 5 0$ & findrreds findrred,red,green,blues).
130
+
131
+ How does targeting work in the communication learnt by TarMAC? Recall that each agent predicts a signature and value vector as part of the message it sends, and a query vector to attend to incoming messages. The communication is targeted because the attention probabilities are a function of both the sender’s signature and receiver’s query vectors. So it is not just the receiver deciding how much of each message to listen to. The sender also sends out signatures that affects how much of each message is sent to each receiver. The sender’s signature could encode parts of its observation most relevant to other agents’ goals (for example, it would be futile to convey coordinates in the signature), and the message value could contain the agent’s own location. For example, in Figure 2a, at $t = 6$ , we see that when agent 2 passes by blue, agent 4 starts attending to agent 2. Here, agent 2’s signature encodes the color it observes (which is blue), and agent 4’s query encodes its goal (which is also blue) leading to high attention probability. Agent 2’s message value encodes coordinates agent 4 has to navigate to, as can be seen at $t = 2 1$ when agent 4 reaches there.
132
+
133
+ # 5.2 TRAFFIC JUNCTION
134
+
135
+ <table><tr><td></td><td>Easy</td><td>Hard</td></tr><tr><td>No communication</td><td>84.9±4.3%</td><td>74.1±3.9%</td></tr><tr><td>CommNets (Sukhbaatar et al., 2016)</td><td>99.7±0.1%</td><td>78.9±3.4%</td></tr><tr><td>TarMAC 1-stage</td><td>99.9±0.1%</td><td>84.6±3.2%</td></tr><tr><td>TarMAC 2-stage</td><td>99.9±0.1%</td><td>97.1±1.6%</td></tr></table>
136
+
137
+ Table 3: Success rates on traffic junction. Our targeted 2-stage communication architecture gets a success rate of $9 7 . 1 \%$ on the ‘hard’ variant of the task, significantly outperforming Sukhbaatar et al. (2016). Note that $1 \mathrm { - }$ and 2-stage refer to the number of rounds of communication between actions (Equation 4).
138
+
139
+ ![](images/42c7b922f493e22504b75c747cefd681495b7fc95cebf19d4767eacbe462fc43.jpg)
140
+ Figure 3: Success rates for 1 vs. 2-stage vs. message size on Hard. Performance does not decrease significantly even when the message vector is a single scalar, and 2 rounds of back-and-forth communication before taking an environment action leads to a significant improvement over 1-stage.
141
+
142
+ ![](images/484b7250cf4ef991db8bb33f64c548095baaf4a169dd981655636de939bfa65f.jpg)
143
+ (c) No. of cars being attended to. 1) is positively correlated with total cars, indicating that TarMAC is adaptive to dynamic team sizes, and 2) is slightly right-shifted, since it takes few steps of communication to adapt.
144
+
145
+ (a) Brake probabilities at dif- (b) Attention probabilities at ferent locations on the hard different locations. Cars are traffic junction environment. most attended to in the ‘interCars tend to brake close to or nal grid’ – right after the 1st right before entering junctions. junction and before the 2nd.
146
+
147
+ ![](images/187ff4300ed4c435b4a7b5a33a4739e5aee142e7ad4153d00b44202b62550544.jpg)
148
+ Figure 4: Results on the traffic junction environment.
149
+
150
+ Environment and Task. The simulated traffic junction environments from Sukhbaatar et al. (2016) consist of cars moving along pre-assigned, potentially intersecting routes on one or more road junctions. The total number of cars is fixed at $N _ { \mathrm { m a x } }$ and at every timestep, new cars get added to the environment with probability $p _ { \mathrm { a r r i v e } }$ . Once a car completes its route, it becomes available to be sampled and added back to the environment with a different route assignment. Each car has a limited visibility of a $3 \times 3$ region around it, but is free to communicate with all other cars. The action space for each car at every timestep is gas and brake, and the reward consists of a linear time penalty $- 0 . 0 1 \tau$ , where $\tau$ is the number of timesteps since car has been active, and a collision penalty $r _ { \mathrm { c o l l i s i o n } } = - 1 0$ .
151
+
152
+ Quantitative Results. We compare our approach with CommNets (Sukhbaatar et al., 2016) on the easy and hard difficulties of the traffic junction environment. The easy task has one junction of two one-way roads on a $7 \times 7$ grid with $N _ { \mathrm { m a x } } ~ = ~ 5$ and $p _ { \mathrm { a r r i v e } } ~ = ~ 0 . 3 0$ , while the hard task has four connected junctions of two-way roads on a $1 8 \times 1 8$ grid with $N _ { \mathrm { m a x } } = 2 0$ and $p _ { \mathrm { a r r i v e } } = 0 . 0 5$ .
153
+
154
+ See Figure 4a, 4b for an example of the four two-way junctions in the hard task. As shown in Table 3, a no communication baseline has success rates of $8 4 . 9 \%$ and $7 4 . 1 \%$ on easy and hard respectively. On easy, both CommNets and TarMAC get close to $1 0 0 \%$ . On hard, TarMAC with 1-stage communication significantly outperforms CommNets with a success rate of $8 4 . 6 \%$ , while 2- stage further improves on this at $9 7 . 1 \%$ , which is an $\sim 1 8 \%$ absolute improvement over CommNets.
155
+
156
+ Model Interpretation. Interpreting the learned policies, Figure 4a shows braking probabilities at different locations: cars tend to brake close to or right before entering traffic junctions, which is reasonable since junctions have the highest chances for collisions.
157
+
158
+ Turning our attention to attention probabilities (Figure $4 \mathrm { b }$ ), we can see that cars are most-attended to when in the ‘internal grid’ – right after crossing the 1st junction and before hitting the 2nd junction. These attention probabilities are intuitive: cars learn to attentively attend to specific sensitive locations with the most relevant local observations to avoid collisions.
159
+
160
+ Finally, Figure 4c compares total number of cars in the environment vs. number of cars being attended to with probability $> 0 . 1$ at any time. Interestingly, these are (loosely) positively correlated, with Spearman’s $\sigma = 0 . 4 9$ , which shows that TarMAC is able to adapt to variable number of agents. Crucially, agents learn this dynamic targeting behavior purely from task rewards with no handcoding! Note that the right shift between the two curves is expected, as it takes a few timesteps of communication for team size changes to propagate. At a relative time shift of 3, the Spearman’s rank correlation between the two curves goes up to 0.53.
161
+
162
+ Message size vs. multi-stage communication. We study performance of TarMAC with varying message value size and number of rounds of communication on the ‘hard’ variant of the traffic junction task. As can be seen in Figure 3, multiple rounds of communication leads to significantly higher performance than simply increasing message size, demonstrating the advantage of multistage communication. In fact, decreasing message size to a single scalar performs almost as well as 64-d, perhaps because even a single real number can be sufficiently partitioned to cover the space of meanings/messages that need to be conveyed for this task.
163
+
164
+ # 5.3 HOUSE3D
165
+
166
+ Finally, we benchmark TarMAC on a cooperative point-goal navigation task in House3D (Wu et al., 2018). House3D provides a rich and diverse set of publicly-available2 3D indoor environments, wherein agents do not have access to the top-down map and must navigate purely from first-person vision. Similar to SHAPES, the agents are tasked with finding a specified goal (such as ‘fireplace’), spawned at random locations in the environment and allowed to communicate with each other and move around. Each agent gets a shaped reward based on progress towards the specified target. An episode is successful if all agents end within $0 . 5 \mathrm { m }$ of the target object in 50 navigation steps.
167
+
168
+ Table 4 shows success rates on a find[fireplace] task in House3D. A no-communication navigation policy trained with the same reward structure gets a success rate of $6 2 . 1 \%$ . Mean-pooled communication (no attention) performs slightly better with a success rate of $6 4 . 3 \%$ , and TarMAC achieves the best success rate at $6 8 . 9 \%$ . Figure 5 visualizes predicted navigation trajectories of 4 agents. Note that the communication vectors are significantly more compact (32-d) than the high-dimensional observation space, making our approach particularly attractive for scaling to large teams.
169
+
170
+ <table><tr><td></td><td>Success rate</td></tr><tr><td>No communication</td><td>62.1±5.3%</td></tr><tr><td>No attention</td><td>64.3±2.3%</td></tr><tr><td>TarMAC</td><td>68.9±1.1%</td></tr></table>
171
+
172
+ Table 4: Success rates on a 4-agent cooperative find[fireplace] navigation task in House3D.
173
+
174
+ # 6 CONCLUSIONS AND FUTURE WORK
175
+
176
+ We introduced TarMAC, an architecture for multi-agent reinforcement learning which allows targeted interactions between agents and multiple stages of collaborative reasoning at every timestep.
177
+
178
+ ![](images/f196b2ffbc786f91e8cbfc725e81b5f6b5171e6de9fdeaaa94ccbb8e898f5059.jpg)
179
+ Figure 5: Agents navigating to the fireplace in House3D (marked in yellow). Note in particular that agent 4 is spawned facing away from it. It communicates with others, turns to face the fireplace, and moves towards it.
180
+
181
+ Evaluation on three diverse environments show that our model is able to learn intuitive attention behavior and improves performance, with downstream task-specific team reward as sole supervision.
182
+
183
+ While multi-agent navigation experiments in House3D show promising performance, we aim to exhaustively benchmark TarMAC on more challenging 3D navigation tasks because we believe this is where decentralized targeted communication can have the most impact – as it allows scaling to a large number of agents with large observation spaces. Given that the 3D navigation problem is hard in and of itself, it would be particularly interesting to investigate combinations with recent advances orthogonal to our approach (e.g. spatial memory, planning networks) with the TarMAC framework.
184
+
185
+ # REFERENCES
186
+
187
+ Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Dan Klein. Neural Module Networks. In CVPR, 2016. 2, 5
188
+
189
+ L. Busoniu, R. Babuska, and B. De Schutter. A Comprehensive Survey of Multiagent Reinforcement Learning. Trans. Sys. Man Cyber Part C, 2008. 2
190
+
191
+ 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. In EMNLP, 2014. 4
192
+
193
+ Abhishek Das, Satwik Kottur, José M.F. Moura, Stefan Lee, and Dhruv Batra. Learning Cooperative Visual Dialog Agents with Deep Reinforcement Learning. In ICCV, 2017. 3
194
+
195
+ Jakob Foerster, Yannis M Assael, Nando de Freitas, and Shimon Whiteson. Learning to communicate with deep multi-agent reinforcement learning. In NIPS, 2016. 1, 2, 3
196
+
197
+ Jakob Foerster, Gregory Farquhar, Triantafyllos Afouras, Nantas Nardelli, and Shimon Whiteson. Counterfactual multi-agent policy gradients. In AAAI, 2018. 2, 4
198
+
199
+ Matthew Hausknecht and Peter Stone. Deep Recurrent Q-Learning for Partially Observable MDPs. In AAAI, 2015. 2
200
+
201
+ Yedid Hoshen. VAIN: Attentional multi-agent predictive modeling. In NIPS. 2017. 2, 3
202
+
203
+ Max Jaderberg, Wojciech M. Czarnecki, Iain Dunning, Luke Marris, Guy Lever, Antonio Garcia Castaneda, Charles Beattie, Neil C. Rabinowitz, Ari S. Morcos, Avraham Ruderman, Nicolas Sonnerat, Tim Green, Louise Deason, Joel Z. Leibo, David Silver, Demis Hassabis, Koray Kavukcuoglu, and Thore Graepel. Human-level performance in first-person multiplayer games with population-based deep reinforcement learning. arXiv preprint arXiv:1807.01281, 2018. 2
204
+
205
+ Jiechuan Jiang and Zongqing Lu. Learning attentional communication for multi-agent cooperation. CoRR, 2018. 3
206
+
207
+ Emilio Jorge, Mikael Kågebäck, and Emil Gustavsson. Learning to play guess who? and inventing a grounded language as a consequence. In NIPS workshop on Deep Reinforcement Learning, 2016. 3
208
+
209
+ Satwik Kottur, José MF Moura, Stefan Lee, and Dhruv Batra. Natural language does not emerge ‘naturally’ in multi-agent dialog. In EMNLP, 2017. 3
210
+
211
+ Angeliki Lazaridou, Alexander Peysakhovich, and Marco Baroni. Multi-agent cooperation and the emergence of (natural) language. In ICLR, 2017. 3
212
+
213
+ Ryan Lowe, Yi Wu, Aviv Tamar, Jean Harb, Pieter Abbeel, and Igor Mordatch. Multi-agent actorcritic for mixed cooperative-competitive environments. In NIPS, 2017. 2, 3, 4
214
+
215
+ Igor Mordatch and Pieter Abbeel. Emergence of grounded compositional language in multi-agent populations. arXiv preprint arXiv:1703.04908, 2017. 3
216
+
217
+ Frans A. Oliehoek. Decentralized POMDPs. In Reinforcement Learning: State of the Art. Springer Berlin Heidelberg, 2012. 3
218
+
219
+ OpenAI. OpenAI Five. https://blog.openai.com/openai-five/, 2018. 2
220
+
221
+ Peng Peng, Quan Yuan, Ying Wen, Yaodong Yang, Zhenkun Tang, Haitao Long, and Jun Wang. Multiagent bidirectionally-coordinated nets for learning to play starcraft combat games. arXiv preprint arXiv:1703.10069, 2017. 2
222
+
223
+ Yoav Shoham and Kevin Leyton-Brown. Multiagent Systems: Algorithmic, Game-Theoretic, and Logical Foundations. Cambridge University Press, 2008. 2
224
+
225
+ Sainbayar Sukhbaatar, Arthur Szlam, and Rob Fergus. Learning multiagent communication with backpropagation. In NIPS, 2016. 1, 2, 3, 7
226
+
227
+ Richard S. Sutton and Andrew G. Barto. Introduction to Reinforcement Learning. MIT Press, 1998. 3, 4
228
+
229
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NIPS, 2017. 5
230
+
231
+ Yi Wu, Yuxin Wu, Georgia Gkioxari, and Yuandong Tian. Building Generalizable Agents With a Realistic And Rich 3D Environment. arXiv preprint arXiv:1801.02209, 2018. 2, 8
232
+
233
+ Manzil Zaheer, Satwik Kottur, Siamak Ravanbakhsh, Barnabas Poczos, Ruslan R Salakhutdinov, and Alexander J Smola. Deep sets. In NIPS, 2017. 2
md/train/H1laeJrKDB/H1laeJrKDB.md ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CONTROLLING GENERATIVE MODELS WITH CONTINUOUS FACTORS OF VARIATIONS
2
+
3
+ Antoine Plumerault∗†, Hervé Le Borgne∗, Céline Hudelot† $^ *$ CEA, LIST, Laboratoire Analyse Sémantique Texte et Image, Gif-sur-Yvette, F-91191 France $\dagger$ Université Paris-Saclay, CentraleSupélec, 91190, Gif-sur-Yvette, France.
4
+
5
+ # ABSTRACT
6
+
7
+ Recent deep generative models are able to provide photo-realistic images as well as visual or textual content embeddings useful to address various tasks of computer vision and natural language processing. Their usefulness is nevertheless often limited by the lack of control over the generative process or the poor understanding of the learned representation. To overcome these major issues, very recent work has shown the interest of studying the semantics of the latent space of generative models. In this paper, we propose to advance on the interpretability of the latent space of generative models by introducing a new method to find meaningful directions in the latent space of any generative model along which we can move to control precisely specific properties of the generated image like the position or scale of the object in the image. Our method does not require human annotations and is particularly well suited for the search of directions encoding simple transformations of the generated image, such as translation, zoom or color variations. We demonstrate the effectiveness of our method qualitatively and quantitatively, both for GANs and variational auto-encoders.
8
+
9
+ ![](images/3ef9b7c269dce1e2c3681a40bf816499fa40bec00a4d7777721f1088201acaed.jpg)
10
+ Figure 1: Images generated with our approach and a BigGAN model (Brock et al., 2018), showing that the position of the object can be controlled within the image.
11
+
12
+ # 1 INTRODUCTION
13
+
14
+ With the success of recent generative models to produce high-resolution photo-realistic images (Karras et al., 2018; Brock et al., 2018; Razavi et al., 2019), an increasing number of applications are emerging, such as image in-painting, dataset-synthesis, and deep-fakes. However, the use of generative models is often limited by the lack of control over the generated images. More control could be used to improve existing approaches which aim at generating new training examples (Bowles et al., 2018) by allowing the user to choose more specific properties of the generated images.
15
+
16
+ First attempts in this direction showed that one can modify an attribute of a generated image by adding a learned vector on its latent code (Radford et al., 2015) or by combining the latent code of two images (Karras et al., 2018). Moreover, the study of the latent space of generative models provides insights about its structure which is of particular interest as generative models are also powerful tools to learn unsupervised data representations. For example, Radford et al. (2015) observed on auto-encoders trained on datasets with labels for some factors of variations, that their latent spaces exhibit a vector space structure where some directions encode the said factors of variations.
17
+
18
+ We suppose that images result from underlying factors of variation such as the presence of objects, their relative positions or the lighting of the scene. We distinguish two categories of factors of variations. Modal factors of variation are discrete values that correspond to isolated clusters in the data distribution, such as the category of the generated object. On the other hand, the size of an object or its position are described by Continuous factors of variations, expressed in a range of possible values. As humans, we naturally describe images by using factors of variations suggesting that they are an efficient representation of natural images. For example, to describe a scene, one likely enumerates the objects seen, their relative positions and relations and their characteristics (Berg et al., 2012). This way of characterizing images is also described in Krishna et al. (2016). Thus, explaining the latent space of generative models through the lens of factors of variation is promising. However, the control over the image generation is often limited to discrete factors and requires both labels and an encoder model. Moreover, for continuous factors of variations described by a real parameter $t$ , previous works do not provide a way to get precise control over $t$ .
19
+
20
+ In this paper, we propose a method to find meaningful directions in the latent space of generative models that can be used to control precisely specific continuous factors of variations while the literature has mainly tackled semantic labeled attributes like gender, emotion or object category (Radford et al., 2015; Odena et al., 2016). We test our method on image generative models for three factors of variation of an object in an image: vertical position, horizontal position and scale. Our method has the advantage of not requiring a labeled dataset nor a model with an encoder. It could be adapted to other factors of variations such as rotations, change of brightness, contrast, color or more sophisticated transformations like local deformations. However, we focused on the position and scale as these are quantities that can be evaluated, allowing us to measure quantitatively the effectiveness of our method. We demonstrate both qualitatively and quantitatively that such directions can be used to control precisely the generative process and show that our method can reveal interesting insights about the structure of the latent space. Our main contributions are:
21
+
22
+ • We propose a method to find interpretable directions in the latent space of generative models, corresponding to parametrizable continuous factors of variations of the generated image.
23
+ We show that properties of generated images can be controlled precisely by sampling latent representations along linear directions.
24
+ • We propose a novel reconstruction loss for inverting generative models with gradient descent.
25
+ • We give insights of why inverting generative models with optimization can be difficult by reasoning about the geometry of the natural image manifold.
26
+ • We study the impacts of disentanglement on the ability to control the generative models.
27
+
28
+ # 2 LATENT SPACE DIRECTIONS OF A FACTOR OF VARIATION
29
+
30
+ We argue that it is easier to modify a property of an image than to obtain a label describing that property. For example, it is easier to translate an image than to determine the position of an object within said image. Hence, if we can determine the latent code of a transformed image, we can compute its difference with the latent code of the original image to find the direction in the latent space which corresponds to this specific transformation as in Radford et al. (2015).
31
+
32
+ Let us consider a generative model $G : z \in { \mathcal { Z } } \to { \mathcal { T } }$ , with $\mathcal { Z }$ its latent space of dimension $d$ and $\mathcal { T }$ the space of images, and a transformations $\mathcal { T } _ { t } : \mathcal { T } \mathcal { T }$ characterized by a continuous parameter $t$ . For example if $\tau$ is a rotation, then $t$ could be the angle, and if $\tau$ is a translation, then $t$ could be a component of the vector of the translation in an arbitrary frame of reference. Let $z _ { \mathrm { 0 } }$ be a vector of $\mathcal { Z }$ and $I = G ( z _ { 0 } )$ a generated image. Given a transformation $\mathcal { T } _ { T }$ , we aim at finding $z _ { T }$ such that $G ( z _ { T } ) \approx \mathcal { T } _ { T } ( I )$ to then use the difference between $z _ { \mathrm { 0 } }$ and $z _ { T }$ in order to estimate the direction encoding the factor of variation described by $\tau$ .
33
+
34
+ # 2.1 LATENT SPACE TRAJECTORIES OF AN IMAGE TRANSFORMATION
35
+
36
+ Given an image $I \in \mathcal { T }$ , we want to determine its latent code. When no encoder is available we can search an approximate latent code $\hat { z }$ that minimizes a reconstruction error $\mathcal { L }$ between $I$ and $\hat { I } = G ( \hat { z } )$ $\hat { I }$ can be seen as the projection of $I$ on $G ( { \mathcal { Z } } ) )$ ) i.e.
37
+
38
+ $$
39
+ \hat { z } = \underset { z \in \mathcal { Z } } { \arg \operatorname* { m i n } } \mathcal { L } ( I , G ( z ) )
40
+ $$
41
+
42
+ Solving this problem by optimization leads to solutions located in regions of low likelihood of the distribution used during training. It causes the reconstructed image $\hat { I } = G ( \hat { z } )$ to look unrealistic1. Since $_ z$ follows a normal distribution √ $\mathcal { N } ( 0 , \pmb { I } _ { d } )$ in a $d$ -dimensional space, we have $| | z | | \sim \chi _ { d }$ . Thus, $\begin{array} { r } { \operatorname* { l i m } _ { d \to + \infty } \mathbb { E } \left[ | | \pmb { z } | | \right] = \sqrt { d } } \end{array}$ and $\begin{array} { r } { \operatorname* { l i m } _ { d \to + \infty } \operatorname { V a r } \left( | | z | | \right) = 0 } \end{array}$ . Hence, when $d$ is large, the norm of $_ z$ is approximately equal to √ $\sqrt { d }$ . This can be used to regularize the optimization by constraining $_ { z }$ to verify $| | z | | \leq { \sqrt { d } }$ :
43
+
44
+ $$
45
+ \hat { z } = \underset { z \in \mathcal { Z } , | | z | | \leq \sqrt { d } } { \arg \operatorname* { m i n } } \mathcal { L } ( I , G ( z ) )
46
+ $$
47
+
48
+ # 2.1.1 CHOICE OF THE RECONSTRUCTION ERROR $\mathcal { L }$
49
+
50
+ One of the important choice regarding this optimization problem is that of $\mathcal { L }$ . In the literature, the most commonly used are the pixel-wise Mean Squared Error (MSE) and the pixel-wise cross-entropy as in Lipton & Tripathi (2017) and Creswell & Bharath (2016). However in practice, pixel-wise losses are known to produce blurry images. To address this issue, other works have proposed alternative reconstruction errors. However, they are based on an alternative neural network (Boesen Lindbo Larsen et al., 2015; Johnson et al., 2016) making them computationally expensive.
51
+
52
+ The explanation usually given for the poor performance of pixel-wise mean square error is that it favors the solution which is the expected value of all the possibilities (Mathieu et al., 2015)2. We propose to go deeper into this explanation by studying the effect of the MSE on images in the frequency domain. In particular, our hypothesis is that due to its limited capacity and the low dimension of its latent space, the generator can not produce arbitrary texture patterns as the manifold of textures is very high dimensional. This uncertainty over texture configurations explains why textures are reconstructed as uniform regions when using pixel-wise errors. In Appendix A, by expressing the MSE in the Fourier domain and assuming that the phase of high frequencies cannot be encoded in the latent space, we show that the contribution of high frequencies in such a loss is proportional to their square magnitude pushing the optimization to solutions with less high frequencies, that is to say more blurry. In order to get sharper results we therefore propose to reduce the weight of high frequencies into the penalization of errors with the following loss:
53
+
54
+ $$
55
+ \mathcal { L } ( I _ { 1 } , I _ { 2 } ) = | | \mathcal { F } \{ I _ { 1 } - I _ { 2 } \} \mathcal { F } \{ \sigma \} | | ^ { 2 } = | | ( I _ { 1 } - I _ { 2 } ) * \sigma | | ^ { 2 }
56
+ $$
57
+
58
+ where $\mathcal { F }$ is the Fourier transform, $^ *$ is the convolution operator and $\sigma$ is a Gaussian kernel. With a reduced importance given to the high frequencies to determine $\hat { z }$ when one uses this loss in equation 2, it allows to benefit from a larger range of possibilities for $G ( z )$ , including images with more details (i.e with more high frequencies) and appropriate texture to get more realistic generated images. A qualitative comparison to some reconstruction errors and choices of $\sigma$ can be found in Appendix C. We also report a quantitative comparison to other losses, based on the Learned Perceptual Image Patch Similarity (LPIPS), proposed by Zhang et al. (2018).
59
+
60
+ Algorithm 1: Create a dataset of trajectories in the latent space which corresponds to a transformation $\tau$ in the pixel space. The transformation is parametrized by a parameter $\delta t$ which controls a degree of transformation. We typically use $N = 1 0$ with $\left( \delta t _ { n } \right) _ { ( 0 \leq n \leq N ) }$ distributed regularly on the interval $[ 0 , T ]$ . Note that $z _ { 0 }$ and $\delta t _ { n }$ are retained in $D$ at each step to train the model of Section 2.2.
61
+
62
+ Input: number of trajectories $S$ , generator $G$ , transformation function $\tau$ , trajectories length $N$ , threshold $\Theta$ .
63
+ Result: dataset of trajectories $D$
64
+ $D \{ \}$ ;
65
+ for $i \in \mathbb { I } 1 , S \mathbb { I }$ do $z _ { 0 } \stackrel { - } { \sim } \mathcal { N } ( 0 , I )$ ; $I _ { 0 } G ( z _ { 0 } )$ ; $\boldsymbol { z } _ { \delta t } \gets \boldsymbol { z } _ { 0 }$ ; for $n \in [ 1 , N ]$ do $z _ { \delta t } \gets \mathrm { a r g } \operatorname* { m i n } _ { z } \mathcal { L } ( G ( z ) , \mathcal { T } _ { \delta t _ { n } } ( I _ { 0 } ) )$ ; if $\mathcal { L } ( G ( z ) , \mathcal { T } _ { \delta t _ { n } } ( I _ { 0 } ) ) < \Theta$ then $D \gets D \cup \{ ( z _ { 0 } , z _ { \delta t } , \delta t _ { n } ) \}$ ; end end
66
+ end
67
+
68
+ # 2.1.2 RECURSIVE ESTIMATION OF THE TRAJECTORY
69
+
70
+ Using equation 2, our problem of finding $z _ { T }$ such that $G ( z _ { T } ) \approx \mathcal { T } _ { T } ( I )$ , given transformation $\mathcal { T } _ { T }$ , can be solve through the following optimization problem:
71
+
72
+ $$
73
+ z _ { T } = \underset { z \in \mathcal { Z } , | | z | | \leq \sqrt { d } } { \arg \operatorname* { m i n } } \mathcal { L } ( G ( z ) , \mathcal { T } _ { T } ( I ) )
74
+ $$
75
+
76
+ In practice, this problem is difficult and an “unlucky” initialization can lead to a very slow convergence. Zhu et al. (2016) proposed to use an auxiliary network to estimate $z _ { T }$ and use it as initialization. Training a specific network to initialize this problem is nevertheless costly. One can easily observe that a linear combination of natural images is usually not a natural image itself, this fact highlights the highly curved nature of the manifold of natural images in pixel space. In practice, the trajectories corresponding to most transforms in pixel space may imply small gradients of the loss that slowdown the convergence of problem of Eq. ( 2) (see Appendix D). To address this, we guide the optimization on the manifold by decomposing the transformation $\mathcal { T } _ { T }$ into smaller transformations $[ \mathcal { T } _ { \delta t _ { 0 } } , \ldots , \mathcal { T } _ { \delta t _ { N } } ]$ such that $\mathscr { T } _ { \delta t _ { 0 } = 0 } = I d$ and $\delta t _ { N } = T$ and solve sequentially:
77
+
78
+ $$
79
+ z _ { n } = \underset { z \in \mathcal { Z } } { \arg \operatorname* { m i n } } \mathcal { L } \left( G \left( z ; z _ { i n i t } = z _ { n - 1 } \right) , \mathcal { T } _ { \delta t _ { n } } \left( G \left( z _ { 0 } \right) \right) \right) \quad \mathrm { ~ f o r ~ } n = 1 , \ldots , N
80
+ $$
81
+
82
+ each time initializing $_ z$ with the result of the previous optimization. In comparison to Zhu et al. (2016), our approach does not require extra training and can thus be used directly without training a new model. We compare qualitatively our method to a naive optimization in Appendix C.
83
+
84
+ A transformation on an image usually leads to undefined regions in the new image (for instance, for a translation to the right, the left hand side is undefined). Hence, we ignore the value of the undefined regions of the image to compute $\mathcal { L }$ . Another difficulty is that often the generative model cannot produce arbitrary images. For example a generative model trained on a given dataset is not expected to be able to produce images where the object shape position is outside of the distribution of object shape positions in the dataset. This is an issue when applying our method because as we generate images from a random start point, we have no guarantee that the transformed images is still on the data manifold. To reduce the impact of such outliers, we discard latent codes that give a reconstruction error above a threshold in the generated trajectories. In practice, we remove one tenth of the latent codes which leads to the worst reconstruction errors. It finally results into Algorithm 1 to generate trajectories in the latent space.
85
+
86
+ 2.2 ENCODING MODEL OF THE FACTOR OF VARIATION IN THE LATENT SPACE.
87
+
88
+ After generating trajectories with Algorithm 1, we need to define a model which describes how factors of variations are encoded in the latent space. We make the core hypothesis that the parameter $t$ of a specific factor of variations can be predicted from the coordinate of the latent code along an axis $\textbf { \em u }$ , thus we pose a model $f : \mathcal { Z } \to \mathbb { R }$ of the form $t = f ( z ) = g ( \langle z , \pmb { u } \rangle )$ , with $g : \mathbb { R } \mathbb { R }$ and $\langle \cdot , \cdot \rangle$ the euclidean scalar product in $\mathbb { R } ^ { d }$ .
89
+
90
+ When $g$ is a monotonic differentiable function, we can without loss of generality, suppose that $\lVert u \rVert = 1$ and that $g$ is an increasing function. Under these conditions, the distribution of $t = g ( \langle z , \pmb { u } \rangle )$ when $z \sim \mathcal { N } ( 0 , I )$ is given by $\varphi : \mathbb { R } \mathbb { R } _ { + }$ :
91
+
92
+ $$
93
+ \varphi ( t ) = \mathcal { N } ( g ^ { - 1 } ( t ) ; 0 , 1 ) \frac { d } { d t } g ^ { - 1 } ( t )
94
+ $$
95
+
96
+ For example, consider the dSprite dataset (Matthey et al., 2017) and the factor corresponding to the horizontal position of an object $x$ in an image, we have $x$ that follows a uniform distribution $\mathcal { U } ( [ - 0 . 5 , 0 . 5 ] )$ in the dataset while the projection of $_ z$ onto an axis $\textbf { \em u }$ follows a normal distribution $\mathcal { N } ( 0 , 1 )$ . Thus, it is natural to adopt $g : \mathbb { R } [ - 0 . 5 , 0 . 5 ]$ and for $x = g ( \langle z , \pmb { u } \rangle )$ :
97
+
98
+ $$
99
+ \begin{array} { r l } & { \varphi ( x ) = \mathcal { U } \left( x , [ - 0 . 5 , 0 . 5 ] \right) = \mathcal { N } ( g ^ { - 1 } ( x ) ; 0 , 1 ) \frac { d } { d x } g ^ { - 1 } ( x ) \quad \Longleftrightarrow } \\ & { 1 = \mathcal { N } ( \langle z , u \rangle ; 0 , 1 ) \frac { d } { d x } g ^ { - 1 } ( g ( \langle z , u \rangle ) ) \qquad } & { \Longleftrightarrow } \\ & { \frac { 1 } { \frac { d } { d x } g ^ { - 1 } \left( g \left( \langle z , u \rangle \right) \right) } = \frac { d } { d x } g \left( \langle z , u \rangle \right) = \mathcal { N } ( \langle z , u \rangle ; 0 , 1 ) \quad \Longleftrightarrow } \\ & { g ( \langle z , u \rangle ) = \frac { 1 } { 2 } \operatorname { e r f } \left( \frac { \langle z , u \rangle } { \sqrt { 2 } } \right) } \end{array}
100
+ $$
101
+
102
+ However, in general, the distribution of the parameter $t$ is not known. One can adopt a more general parametrized model $g _ { \theta }$ of the form:
103
+
104
+ $$
105
+ t = f _ { ( \theta , \mathbf { u } ) } ( z ) = g _ { \theta } \left( \langle \mathbf { \boldsymbol { u } } , z \rangle \right) \ \mathrm { w i t h } \ | | \mathbf { \boldsymbol { u } } | | = 1
106
+ $$
107
+
108
+ with $g _ { \theta } : \mathbb { R } \mathbb { R }$ and $( \theta , \pmb { u } )$ trainable parameters of the model. We typically used piece-wise linear functions for $g _ { \theta }$ .
109
+
110
+ However, this model cannot be trained directly as we do not have access to $t$ (in the case of horizontal translation the $x$ -coordinate for example) but only to the difference $\delta t = t _ { G ( z _ { \delta t } ) } - t _ { G ( z _ { 0 } ) }$ between an image $G ( z _ { 0 } )$ and its transformation $G ( \boldsymbol { z } _ { \delta t } )$ ( $\delta x$ or $\delta y$ in the case of translation). We solve this issue by modeling $\delta t$ instead of $t$ :
111
+
112
+ $$
113
+ \delta t = f _ { ( \theta , \boldsymbol { u } ) } ( z _ { \delta t } ) - f _ { ( \theta , \boldsymbol { u } ) } ( z _ { 0 } ) \mathrm { w i t h } | | \boldsymbol { u } | | = 1 \mathrm { a n d } g _ { \theta } ( 0 ) = 0
114
+ $$
115
+
116
+ Hence, $\textbf { \em u }$ and $\theta$ are estimated by training $f _ { ( \theta , { \pmb u } ) }$ to minimize the MSE between $\delta _ { t }$ and $f _ { \left( \theta , { \pmb u } \right) } ( z _ { \delta t } ) -$ $f _ { ( \boldsymbol { \theta } , \boldsymbol { u } ) } ( z _ { 0 } )$ with gradient descent on a dataset produced by Algorithm 1 for a given transformation.
117
+
118
+ An interesting application of this method is the estimation of the distribution of the images generated by $G$ by using Equation 6. With the knowledge of $g _ { \boldsymbol { \theta } }$ we can also choose how to sample images. For instance, let say that we want to have $t \sim \phi ( t )$ , with $\phi : \mathbb { R } \to \mathbb { R } _ { + }$ an arbitrary distribution, we can simply transform $z \sim \mathcal { N } ( 0 , 1 )$ as follows:
119
+
120
+ $$
121
+ z \gets z - \langle z , \boldsymbol { u } \rangle \boldsymbol { u } + \big ( h _ { \phi } \circ \psi \big ) \big ( \langle z , \boldsymbol { u } \rangle \big ) \boldsymbol { u }
122
+ $$
123
+
124
+ with $h _ { \phi } : [ 0 , 1 ] \to \mathbb { R }$ and $\psi$ such that:
125
+
126
+ $$
127
+ \psi ( x ) = \int _ { - \infty } ^ { x } { \mathcal { N } } ( t ; 0 , 1 ) d t ~ ; ~ h _ { \phi } ^ { - 1 } ( x ) = \int _ { - \infty } ^ { x } \phi ( g _ { \theta } ( t ) ) { \frac { d } { d t } } g _ { \theta } ( t ) d t
128
+ $$
129
+
130
+ These results are interesting to bring control not only on a single output of a generative model but also on the distribution of its outputs. Moreover, since generative models reflect the datasets on which they have been trained, the knowledge of these distributions could be applied to the training dataset to reveal potential bias.
131
+
132
+ # 3 EXPERIMENTS
133
+
134
+ Datasets: We performed experiments on two datasets. The first one is dSprites (Matthey et al., 2017), composed of 737280 binary $6 4 \times 6 4$ images containing a white shape on a dark background. Shapes can vary in position, scale and orientations making it ideal to study disentanglement. The second dataset is ILSVRC (Russakovsky et al., 2015), containing $1 . 2 M$ natural images from one thousand different categories.
135
+
136
+ Implementation details: All our experiments have been implemented with TensorFlow 2.0 (Abadi et al., 2015) and the corresponding code is available on github here. We used a BigGAN model (Brock et al., 2018) whose weights are taken from TensorFlow-Hub allowing easy reproduction of our results. The BigGAN model takes two vectors as inputs: a latent vector $z \in \bar { \mathbb { R } } ^ { 1 2 8 }$ and a one-hot vector to condition the model to generate images from one category. The latent vector $_ { z }$ is then split into six parts which are the inputs at different scale levels in the generator. The first part is injected at the bottom layer while next parts are used to modify the style of the generated image thanks to Conditional Batch Normalization layers (de Vries et al., 2017). We also trained several $\beta$ -VAEs (Higgins et al., 2017) to study the importance of disentanglement in the process of controlling generation. The exact $\beta$ -VAE architecture used is given in Appendix B. The models were trained on dSprites (Matthey et al., 2017) with an Adam optimizer during 1e5 steps with a batch size of 128 images and a learning rate of $5 \mathrm { e } { - 4 }$ .
137
+
138
+ # 3.1 QUANTITATIVE EVALUATION METHOD
139
+
140
+ Evaluating quantitatively the effectiveness of our method on complex datasets is intrinsically difficult as it is not always trivial to measure a factor of variation directly. We focused our analysis on two factors of variations: position and scale. On simple datasets such as dSprites, the position of the object can be estimated effectively by computing the barycenter of white pixels. However, for natural images sampled with the BigGAN model, we have to use first saliency detection on the generated image to produce a binary image from which we can extract the barycenter. For saliency detection, we used the model provided by Hou et al. (2016) which is implemented in the PyTorch framework (Paszke et al., 2017). The scale is evaluated by the proportion of salient pixels. The evaluation procedure is:
141
+
142
+ 1. Get the direction $\textbf { \em u }$ which should describe the chosen factor of variation with our method.
143
+ 2. Sample latent codes $_ z$ from a standard normal distribution.
144
+ 3. Generate images with latent code $z - \left. z , \pmb { u } \right. \pmb { u } + t \pmb { u }$ with $t \in [ - T , T ]$ .
145
+ 4. Estimate the real value of the factor of variation for all the generated images.
146
+ 5. Measure the standard deviation of this value with respect to $t$ .
147
+
148
+ Jahanian et al. (2019) proposed an alternative method for quantitative evaluation that relies on an object detector. Similarly to us, it allows an evaluation for $x$ and $y$ shift as well as scale but is restricted to image categories that can be recognized by a detector trained on some categories of ILSVRC. The proposed approach is thus more generic.
149
+
150
+ # 3.2 RESULTS ON BIGGAN
151
+
152
+ We performed quantitative analysis on ten chosen categories of objects of ILSVRC, avoiding non actual objects such as “beach” or ‘cliff”. Results are presented in Figure 2 (top). We observe that for the chosen categories of ILSVRC, we can control the position and scale of the object relatively precisely by moving along directions of the latent space found by our method.
153
+
154
+ However, one can still wonder whether the directions found are independent of the category of interest. To answer this question, we merged all the datasets of trajectories into one and learned a common direction on the resulting datasets. Results for the ten test categories are shown in Figure 2 (bottom). This figure shows that the directions which correspond to some factors of variations are indeed shared between all the categories. Qualitative results are also presented in Figure 3 for illustrative purposes. We also checked which parts of the latent code are used to encode position and scale. Indeed, BigGAN uses hierarchical latent code which means that the latent code is split into six parts which are injected at different level of the generator. We wanted to see by which part of the latent code these directions are encoded. The squared norm of each part of the latent code is reported in Figure 4 for horizontal position, vertical position and scale. This figure shows that the directions corresponding to spatial factors of variations are mainly encoded in the first part of the latent code. However, for the $y$ position, the contribution of level 5 is higher than for the $x$ position and the scale. We suspect that it is due to correlations between the vertical position of the object in the image and its background that we introduced by transforming the objects because the background is not invariant by vertical translation because of the horizon.
155
+
156
+ ![](images/b74f0d17e4b3921878c1040c74854ed79adf2ea9dd32fa772cde87df6bd1be87.jpg)
157
+ Figure 2: Quantitative results on the ten categories of the ILSVRC dataset used for training (Top) and for ten other categories used for validation (Bottom) for three geometric transformations: horizontal and vertical translations and scaling. In blue, the distribution of the measured transformation parameter and in red the standard deviation of the distribution with respect to $t$ . Note that for large scales the algorithm seems to fail. However, this phenomenon is very likely due to the poor performance of the saliency model when the object of interest covers almost the entire image (scale $\approx 1 . 0$ ). (best seen with zoom)
158
+
159
+ # .3 THE IMPORTANCE OF DISENTANGLED REPRESENTATIONS
160
+
161
+ To test the effect of disentanglement on the performance of our method, we trained several $\beta$ - VAE (Higgins et al., 2017) on dSprites (Matthey et al., 2017), with different $\beta$ values. Indeed, $\beta$ -VAE are known for having more disentangled latent spaces as the regularization parameter $\beta$ increases. Results can be seen in Figure 5. The figure shows that it is possible to control the position of the object on the image by moving in the latent space along the direction found with our method. As expected, the effectiveness of the method depends on the degree of disentanglement of the latent space since the results are better with a larger $\beta$ . Indeed we can see on Figure 5 that as $\beta$ increases, the standard deviation decreases (red curve), allowing a more precise control of the position of the generated images. This observation motivates further the interest of disentangled representations for control on the generative process.
162
+
163
+ # 4 RELATED WORKS
164
+
165
+ Our work aims at finding interpretable directions in the latent space of generative models to control their generative process. We distinguish two families of generative models: GAN-like models which do not provide an explicit way to get the latent representation of an image and auto-encoders which provide an encoder to get the latent representation of images. From an architectural point of view, conditional GANs (Odena et al., 2016) allows the user to choose the category of a generated object or some chosen properties of the generated image but this approach requires a labeled dataset and use a model which is explicitly designed to allow this control. Similarly regarding VAE, Engel et al. (2018) identified that they suffer from a trade-off between reconstruction accuracy and sample plausibility and proposed to identify regions of the latent space that correspond to plausible samples to improve reconstruction accuracy. They also use conditional reconstruction to control the generative process. In comparison to these approaches, our method does not directly requires labels. With InfoGan, Chen et al. (2016) shows that adding a code to the the input of the GAN generator and optimizing with an appropriate regularization term leads to disentangle the latent space and make possible to find a posteriori meaningfully directions. In contrast, we show that it is possible to find such directions in several generative models, without changing the learning process (our approach could even be applied to InfoGAN) and with an a priori knowledge of the factor of variation sought. More recently, Bau et al. (2018) analyze the activations of the network’s neurons to determine those that result in the presence of an object in the generated image, and thus allows to control such a presence. In contrast, our work focuses on the latent space and not on the intermediate activations inside the generator.
166
+
167
+ ![](images/cf7512799acb126661bafad805ac2d2f3d916a7f14f8e0dda1f7886a069c4bdc.jpg)
168
+ Figure 3: Qualitative results for some categories of ILSVRC dataset for three geometric transformations: horizontal and vertical translations and scaling.
169
+
170
+ ![](images/ba04b4f390f39e283e818cd4a012a3e23d626309d4ce301ae0e6b3d98b628123.jpg)
171
+ Figure 4: Squared norm of each part of the latent code for horizontal position, vertical position and scale.
172
+
173
+ ![](images/90d0e5f9dd960c0b9b2669fe745540e51b0d77f39b4de11cc97f1516a9b70668.jpg)
174
+ Figure 5: Results of our evaluation procedure with four $\beta$ -VAE for $\beta = 1 , 5 , 1 0 , 2 0$ . Note the erf shape of the results which indicates that the distribution of the shape positions has been correctly learned by the VAE. See Figure 2 for additional information on how to read this figure.
175
+
176
+ One of our contribution and a part of our global method is a procedure to find the latent representation of an image when an encoder is not available. Several previous works have studied how to invert the generator of a GAN to find the latent code of an image. Creswell & Bharath (2016) showed on simple datasets (MNIST (Lecun et al., 1998) and Omniglot (Lake et al., 2015)) that this inversion process can be achieved by optimizing the latent code to minimize the reconstruction error between the generated image and the target image. Lipton & Tripathi (2017) introduced tricks to improve the results on a more challenging dataset (CelebA (Liu et al., 2015)). However we observed that these methods fail when applied on a more complex datasets (ILSVRC (Russakovsky et al., 2015)). The reconstruction loss introduced in Section 2.1.1 is adapted to this particular problem and improves the quality of reconstructions significantly. We also theoretically justify the difficulties to invert a generative model, compared to other optimization problems. In the context of vector space arithmetic in a latent space, White (2016) argues that replacing a linear interpolation by a spherical one allows to reduce the blurriness as well. This work also propose an algorithmic data augmentation, named “synthetic attribute”, to generate image with less noticeable blur with a VAE. In contrast, we act directly on the loss.
177
+
178
+ The closest works were released on ArXiv very recently (Goetschalckx et al., 2019; Jahanian et al., 2019) indicating that finding interpretable directions in the latent space of generative models to control their output is of high interest for the community. In these papers, the authors describe a method to find interpretable directions in the latent space of the BigGAN model (Brock et al., 2018). If their method exhibits similarities with ours (use of transformation, linear trajectories in the latent space), it also differs on several points. From a technical point of view our training procedure differs in the sense that we first generate a dataset of interesting trajectories to then train our model while they train their model directly. Our evaluation procedure is also more general as we use a saliency model instead of a MobileNet-SSD v1 Liu et al. (2016) trained on specific categories of the ILSVRC dataset allowing us to measure performance on more categories. We provide additional insight on how auto-encoders can also be controlled with the method, the impact of disentangled representations on the control and on the structure of the latent space of BigGAN. Moreover we also propose an alternative reconstruction error to invert generators. However, the main difference we identify between the two works is the model of the latent space used. Our model allows a more precise control over the generative process and can be being adapted to more cases.
179
+
180
+ # 5 CONCLUSIONS
181
+
182
+ Generative models are increasingly more powerful but suffer from little control over the generative process and the lack of interpretability in their latent representations. In this context, we propose a method to extract meaningful directions in the latent space of such models and use them to control precisely some properties of the generated images. We show that a linear subspace of the latent space of BigGAN can be interpreted in term of intuitive factors of variation (namely translation and scale). It is an important step toward the understanding of the representations learned by generative models.
183
+
184
+ # REFERENCES
185
+
186
+ Martín Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dandelion Mané, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viégas, Oriol Vinyals, Pete Warden, Martin Wattenberg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL https://www.tensorflow.org/. Software available from tensorflow.org.
187
+
188
+ David Bau, Jun-Yan Zhu, Hendrik Strobelt, Bolei Zhou, Joshua B. Tenenbaum, William T. Freeman, and Antonio Torralba. GAN Dissection: Visualizing and Understanding Generative Adversarial Networks. arXiv e-prints, art. arXiv:1811.10597, 11 2018.
189
+
190
+ A. C. Berg, T. L. Berg, H. Daumé, J. Dodge, A. Goyal, X. Han, A. Mensch, M. Mitchell, A. Sood, K. Stratos, and K. Yamaguchi. Understanding and predicting importance in images. In 2012 IEEE Conference on Computer Vision and Pattern Recognition, pp. 3562–3569, June 2012.
191
+
192
+ Anders Boesen Lindbo Larsen, Søren Kaae Sønderby, Hugo Larochelle, and Ole Winther. Autoencoding beyond pixels using a learned similarity metric. arXiv e-prints, art. arXiv:1512.09300, Dec 2015.
193
+
194
+ Christopher Bowles, Liang Chen, Ricardo Guerrero, Paul Bentley, Roger Gunn, Alexander Hammers, David Alexander Dickie, Maria Valdés Hernández, Joanna Wardlaw, and Daniel Rueckert. GAN Augmentation: Augmenting Training Data using Generative Adversarial Networks. arXiv e-prints, art. arXiv:1810.10863, Oct 2018.
195
+
196
+ Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale GAN training for high fidelity natural image synthesis. CoRR, abs/1809.11096, 2018. URL http://arxiv.org/abs/ 1809.11096.
197
+
198
+ Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. InfoGAN: Interpretable Representation Learning by Information Maximizing Generative Adversarial Nets. arXiv e-prints, art. arXiv:1606.03657, 06 2016.
199
+
200
+ Antonia Creswell and Anil Anthony Bharath. Inverting The Generator Of A Generative Adversarial Network. arXiv e-prints, art. arXiv:1611.05644, 11 2016.
201
+
202
+ Harm de Vries, Florian Strub, Jérémie Mary, Hugo Larochelle, Olivier Pietquin, and Aaron Courville. Modulating early visual processing by language. arXiv e-prints, art. arXiv:1707.00683, Jul 2017.
203
+
204
+ Jesse Engel, Matthew Hoffman, and Adam Roberts. Latent constraints: Learning to generate conditionally from unconditional generative models. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ Sy8XvGb0-.
205
+
206
+ Lore Goetschalckx, Alex Andonian, Aude Oliva, and Phillip Isola. GANalyze: Toward Visual Definitions of Cognitive Image Properties. arXiv e-prints, art. arXiv:1906.10112, Jun 2019.
207
+
208
+ Irina Higgins, Loïc Matthey, Arka Pal, Christopher Burgess, Xavier Glorot, Matthew Botvinick, Shakir Mohamed, and Alexander Lerchner. beta-vae: Learning basic visual concepts with a constrained variational framework. In International Conference on Learning Representation, 2017.
209
+
210
+ Qibin Hou, Ming-Ming Cheng, Xiao-Wei Hu, Ali Borji, Zhuowen Tu, and Philip Torr. Deeply supervised salient object detection with short connections. arXiv e-prints, art. arXiv:1611.04849, 11 2016.
211
+
212
+ Ali Jahanian, Lucy Chai, and Phillip Isola. On the “steerability” of generative adversarial networks. arXiv e-prints, art. arXiv:1907.07171, Jul 2019.
213
+
214
+ Justin Johnson, Alexandre Alahi, and Li Fei-Fei. Perceptual Losses for Real-Time Style Transfer and Super-Resolution. arXiv e-prints, art. arXiv:1603.08155, Mar 2016.
215
+
216
+ Tero Karras, Samuli Laine, and Timo Aila. A Style-Based Generator Architecture for Generative Adversarial Networks. arXiv e-prints, art. arXiv:1812.04948, 12 2018.
217
+
218
+ Ranjay Krishna, Yuke Zhu, Oliver Groth, Justin Johnson, Kenji Hata, Joshua Kravitz, Stephanie Chen, Yannis Kalantidis, Li-Jia Li, David A Shamma, Michael Bernstein, and Li Fei-Fei. Visual genome: Connecting language and vision using crowdsourced dense image annotations. In arXiv preprint arXiv:1602.07332, 2016., 2016.
219
+
220
+ Brenden M. Lake, Ruslan Salakhutdinov, and Joshua B. Tenenbaum. Human-level concept learning through probabilistic program induction. Science, 350(6266):1332–1338, 2015. ISSN 0036-8075. doi: 10.1126/science.aab3050. URL https://science.sciencemag.org/content/ 350/6266/1332.
221
+
222
+ Yann Lecun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. In Proceedings of the IEEE, pp. 2278–2324, 1998.
223
+
224
+ Zachary C. Lipton and Subarna Tripathi. Precise Recovery of Latent Vectors from Generative Adversarial Networks. In ICLR workshop, 2017.
225
+
226
+ Wei Liu, Dragomir Anguelov, Dumitru Erhan, Christian Szegedy, Scott Reed, Cheng-Yang Fu, and Alexander C Berg. Ssd: Single shot multibox detector. In European conference on computer vision, pp. 21–37. Springer, 2016.
227
+
228
+ Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), 12 2015.
229
+
230
+ Michael Mathieu, Camille Couprie, and Yann LeCun. Deep multi-scale video prediction beyond mean square error. arXiv e-prints, art. arXiv:1511.05440, Nov 2015.
231
+
232
+ Loic Matthey, Irina Higgins, Demis Hassabis, and Alexander Lerchner. dsprites: Disentanglement testing sprites dataset. https://github.com/deepmind/dsprites-dataset/, 2017.
233
+
234
+ Augustus Odena, Christopher Olah, and Jonathon Shlens. Conditional Image Synthesis With Auxiliary Classifier GANs. arXiv e-prints, art. arXiv:1610.09585, 10 2016.
235
+
236
+ Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. 2017.
237
+
238
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks. arXiv e-prints, art. arXiv:1511.06434, 11 2015.
239
+
240
+ Ali Razavi, Aaron van den Oord, and Oriol Vinyals. Generating Diverse High-Fidelity Images with VQ-VAE-2. arXiv e-prints, art. arXiv:1906.00446, Jun 2019.
241
+
242
+ 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.
243
+
244
+ Tom White. Sampling generative networks: Notes on a few effective techniques. CoRR, abs/1609.04468, 2016. URL http://arxiv.org/abs/1609.04468.
245
+
246
+ Richard Zhang, Phillip Isola, Alexei A. Efros, Eli Shechtman, and Oliver Wang. The Unreasonable Effectiveness of Deep Features as a Perceptual Metric. arXiv e-prints, art. arXiv:1801.03924, Jan 2018.
247
+
248
+ Zhou Wang, A. C. Bovik, H. R. Sheikh, and E. P. Simoncelli. Image quality assessment: from error visibility to structural similarity. IEEE Transactions on Image Processing, 13(4):600–612, April 2004. doi: 10.1109/TIP.2003.819861.
249
+
250
+ Jun-Yan Zhu, Philipp Krähenbühl, Eli Shechtman, and Alexei A. Efros. Generative Visual Manipulation on the Natural Image Manifold. arXiv e-prints, art. arXiv:1609.03552, 09 2016.
251
+
252
+ # A PENALTY ON THE AMPLITUDE OF FREQUENCIES DUE TO MSE
253
+
254
+ In Section 2.1, we consider a target image $I \in \mathcal { T }$ and a generated image $\hat { I } = G ( \hat { z } )$ to be determined according to a reconstruction loss $\mathcal { L }$ (Equation 1). Let us note $\mathcal F \{ \cdot \}$ the Fourier transform. If $\mathcal { L }$ is the usual MSE, from the Plancherel theorem, we have $| | \hat { I } - I | | ^ { 2 } = | | \mathcal { F } \{ \hat { I } \} - \mathcal { F } \{ I \} | | ^ { 2 }$ . Let us consider a particular frequency $\omega$ in the Fourier space and compute its contribution to the loss. The Fourier transform of $I$ (resp. $\hat { I }$ ) having a magnitude $r$ (resp. $\hat { r }$ ) and a phase $\theta$ (resp. $\hat { \theta }$ ) at $\omega$ , we have:
255
+
256
+ $$
257
+ \begin{array} { r l } & { | \mathcal { F } \{ \hat { I } \} ( \omega ) - \mathcal { F } \{ I \} ( \omega ) | ^ { 2 } = | \hat { r } e ^ { i \hat { \theta } } - r e ^ { i \theta } | ^ { 2 } } \\ & { \qquad = ( \hat { r } c o s ( \hat { \theta } ) - r c o s ( \theta ) ) ^ { 2 } + ( \hat { r } s i n ( \hat { \theta } ) - r s i n ( \theta ) ) ^ { 2 } } \\ & { \qquad = \hat { r } ^ { 2 } + r ^ { 2 } - 2 \hat { r } r \left( c o s ( \hat { \theta } ) c o s ( \theta ) + s i n ( \hat { \theta } ) s i n ( \theta ) \right) } \\ & { \qquad = \hat { r } ^ { 2 } + r ^ { 2 } - 2 \hat { r } r \left( c o s ( \hat { \theta } ) c o s ( \theta ) + s i n ( \hat { \theta } ) s i n ( \theta ) \right) } \end{array}
258
+ $$
259
+
260
+ If we model the disability of the generator to model every high frequency patterns as an uncertainty on the phase of high frequency of the generated image, i.e by posing $\hat { \theta } \sim \mathcal { U } ( [ 0 , 2 \pi ] )$ , the expected value of the high frequency contributions to the loss is equal to:
261
+
262
+ $$
263
+ \begin{array} { r l } & { \mathbb { E } \left[ | { \mathcal { F } } \{ \hat { I } \} ( \omega ) - { \mathcal { F } } \{ I \} ( \omega ) | ^ { 2 } \right] = \hat { r } ^ { 2 } + r ^ { 2 } - 2 \hat { r } r \left( \underbrace { \mathbb { E } \left[ c o s ( \hat { \theta } ) \right] } _ { = 0 } c o s ( \theta ) + \underbrace { \mathbb { E } \left[ s i n ( \hat { \theta } ) \right] } _ { = 0 } s i n ( \theta ) \right) } \\ & { \qquad = \hat { r } ^ { 2 } + r ^ { 2 } } \end{array}
264
+ $$
265
+
266
+ The term $r ^ { 2 }$ is a constant w.r.t the optimization of $\mathcal { L }$ and can thus be ignored. The contribution to the total loss $\mathcal { L }$ thus directly depends on $\hat { r } ^ { 2 }$ . While minimizing $\mathcal { L }$ , the optimization process tends to favour images $\hat { I } = G ( \hat { z } )$ with smaller magnitudes in the high frequencies, that is to say smoother images, with less high frequencies.
267
+
268
+ # B $\beta$ -VAE ARCHITECTURE
269
+
270
+ The $\beta$ -VAE framework was introduced by Higgins et al. (2017) to discover interpretable factorised latent representations for images without supervision. For our experiments, we designed a simple convolutional VAE architecture to generate images of size $6 4 \mathrm { x } 6 4$ , the decoder network is the opposite of the encoder with transposed convolutions.
271
+
272
+ Table 1: $\beta$ -VAE architecture used during experiments with the dSprites dataset.
273
+
274
+ <table><tr><td rowspan=1 colspan=1>Encoder</td></tr><tr><td rowspan=1 colspan=1>Convolution + ReLUfilters=32 size=4 stride=2 pad=SAME</td></tr><tr><td rowspan=1 colspan=1>Convolution+ ReLUfilters=32 size=4 stride=2 pad=SAME</td></tr><tr><td rowspan=1 colspan=1>Convolution+ ReLUfilters=32 size=4 stride=2 pad=SAME</td></tr><tr><td rowspan=1 colspan=1>Convolution+ReLUfilters=32 size=4 stride=2 pad=SAME</td></tr><tr><td rowspan=1 colspan=1>Dense + ReLUunits=256</td></tr><tr><td rowspan=1 colspan=1>Dense+ReLUunits=256</td></tr><tr><td rowspan=1 colspan=1>μ Dense+Identity0: Dense + Exponentialunits=10</td></tr></table>
275
+
276
+ <table><tr><td rowspan=1 colspan=1>Decoder</td></tr><tr><td rowspan=1 colspan=1>Dense+ReLUunits=256</td></tr><tr><td rowspan=1 colspan=1>Dense+ReLUunits=256</td></tr><tr><td rowspan=1 colspan=1>Reshapeshape=4x4x32</td></tr><tr><td rowspan=1 colspan=1>Transposed Convolution + ReLUfilters=32 size=4 stride=2 pad=SAME</td></tr><tr><td rowspan=1 colspan=1>Transposed Convolution + ReLUfilters=32 size=4 stride=2 pad=SAME</td></tr><tr><td rowspan=1 colspan=1>Transposed Convolution + ReLUfilters=32 size=4 stride=2 pad=SAME</td></tr><tr><td rowspan=1 colspan=1>Transposed Convolution + Sigmoidfilters=1 size=4 stride=2 pad=SAME</td></tr></table>
277
+
278
+ # C QUALITATIVE AND QUANTITATIVE EXPERIMENTS WITH OURRECONSTRUCTION ERROR
279
+
280
+ ![](images/65759f49b860f1cbbb86b06a2155190c75293255c710a1f16ea3e41ea3f605ad.jpg)
281
+ Figure 6: Reconstruction results with different $\sigma$ values. We typically used a standard deviation of 3 pixels for the kernel.
282
+
283
+ ![](images/aa54838fae0c60a6bf69ba268c1b5893b80f5ac1ae1a729834e106038e591ee1.jpg)
284
+ Figure 7: Reconstruction results obtained with different reconstruction errors: MSE, DSSIM (Zhou Wang et al., 2004) and our loss. With or without the constraint on $| | z | |$ . Note the artifacts when using our loss without constraining $_ z$ (best seen with zoom).
285
+
286
+ On Fig. 6 we show qualitative reconstruction results with our method (Eq. 3) for several values of $\sigma$ . On this representative example, we observe quite good results with $\sigma = 3$ and $\sigma = 5$ . Higher values penalizes too low frequencies that lead to a less accurate reconstruction.
287
+
288
+ We also illustrate on Fig. 7 a comparison of our approach to two others, namely classical Mean Square Error (MSE) and Structural dissimilarity (DSSIM) proposed by Zhou Wang et al. (2004). Results are also presented with an unconstrained latent code during optimization (Eq. 1) and the approach proposed (Eq. 2). This example show the accuracy of the reconstruction obtained with our approach,√ as well as the fact that the restriction of $z$ to a ball of radius $\sqrt { d }$ avoids the presence of artifacts.
289
+
290
+ We also performed a quantitative evaluation of the performance of our approach. We randomly selected one image for each of the 1000 categories of the ILSVRC dataset and reconstructed it with our method with a budget of 3000 iterations. We then computed the Learned Perceptual Image Patch Similarity (LPIPS), proposed by Zhang et al. (2018), between the final reconstruction and the target image. We used the official implementation of the LPIPS paper with default parameters. Results are reported in Table 2. It suggests that images reconstructed using our reconstruction error are perceptually closer to the target image than those obtained with MSE or DSSIM. The higher standard deviation for the MSE reconstructed image LPIPS suggests that some images are downgraded in
291
+
292
+ terms of perception. It can be the case for the textured ones in particular, for the reasons explained in the Section A.
293
+
294
+ <table><tr><td>reconstruction error</td><td>mean LPIPS</td><td> std LPIPS</td></tr><tr><td>MSE</td><td>0.57</td><td>0.14</td></tr><tr><td>DSSIM</td><td>0.58</td><td>0.12</td></tr><tr><td>Our (σ = 3)</td><td>0.52</td><td>0.12</td></tr></table>
295
+
296
+ Table 2: Perceptual similarity measurements between an image and its reconstruction for different reconstruction errors.
297
+
298
+ # D ON THE DIFFICULTY OF OPTIMISATION ON THE NATURAL IMAGE MANIFOLD.
299
+
300
+ The curvature of the natural image manifold makes the optimisation problem of Equation 2 difficult to solve. This is especially true for factors of variation which correspond to curved walks in pixel-space (for example translation or rotation by opposition to brightness or contrast changes which are linear).
301
+
302
+ To illustrate this fact, we show that the trajectory described by an image undergoing common transformations is curved in pixel space. We consider three types of transformations, namely translation, rotation and scaling, and get images from the dSprites (Matthey et al., 2017) dataset which correspond to the progressive transformation (interpolation) of an image. To visualize, we compute the PCA of the resulting trajectories and plot the trajectories on the two main axes of the PCA. The result of this experiment can be seen in Figure 8.
303
+
304
+ ![](images/f406fe874573a0d723781955f944846cded61d6fa5cf70bd66843a665525374e.jpg)
305
+ Figure 8: Two trajectories are shown in the pixel space, between an image and its transformed version, for three types of transformations: translation, scale and orientation. Red: shortest path (interpolation) between the two extremes of the trajectory. Blue: trajectory of the actual transformation. At each position along the trajectories, we report the corresponding image (best seen with zoom).
306
+
307
+ In this figure, we can see that for large translations, the direction of the shortest path between two images in pixel-space is near orthogonal to the manifold. The same problem occurs for rotation and, at a smaller extent, for scale. However this problem does not exist for brightness for example, as its change is a linear transformation in pixel-space. This is problematic during optimization of the latent code because the gradient of the reconstruction loss with respect to the generated image is tangent to this direction. Thus, when we are in the case of near orthogonality, the gradient of the error with respect to the latent code is small.
308
+
309
+ Indeed, let us consider an ideal case where $G$ is a bijection between $\mathcal { Z }$ and the manifold of natural images. Let be $z \in { \mathcal { Z } }$ , a basis of vectors tangent to the manifold at point $G ( z )$ is given by $\left( \frac { \partial G ( z ) } { \partial z _ { 1 } } , . . . , \frac { \partial G ( z ) } { \partial z _ { d } } \right)$
310
+
311
+ If $\nabla _ { G ( z ) } \mathcal { L } ( G ( z ) , I _ { \mathrm { t a r g e t } } )$ is near orthogonal to the manifold then:
312
+
313
+ $$
314
+ \forall i \in 1 , . . . , d : \langle \nabla _ { G ( z ) } \mathcal { L } ( G ( z ) , I _ { \mathrm { t a p e t } } ) , \frac { \partial G ( z ) } { \partial z _ { i } } \rangle = \epsilon _ { i } \mathrm { w i t h } \epsilon _ { i } \approx 0
315
+ $$
316
+
317
+ Thus,
318
+
319
+ $$
320
+ \| \nabla _ { z } \mathcal { L } ( G ( z ) , I _ { \mathrm { t a r g e t } } ) \| = \left\| \frac { \partial G ( z ) } { \partial z } ^ { * } \nabla _ { G ( z ) } \mathcal { L } ( G ( z ) , I _ { \mathrm { t a r g e t } } ) \right\| = \sqrt { \sum _ { i = 1 } ^ { d } \epsilon _ { i } ^ { 2 } } \approx 0
321
+ $$
322
+
323
+ It shows that when the direction of descent in pixel space is near orthogonal to the manifold described by the generative model, optimization gets slowed down and can stop if the gradient of the loss with respect to the generated image is orthogonal to the manifold.
324
+
325
+ For example, let assume we have an ideal GAN which generates a small white circle on a black background, with a latent space of dimension 2 that encodes the position of the circle. Let consider a generated image with the circle on the left of the image and we want to move it to the right. Obviously, we thus have $\mathrm { \bar { \nabla } } \eta _ { z } | | G ( z ) - \mathcal { T } _ { T } ( G ( z _ { 1 } ) ) | | ^ { 2 } = 0$ if the intersection of the two circles is empty (see Figure 8) since a small translation of the object does not change the reconstruction error.
326
+
327
+ # E ADDITIONAL QUALITATIVE EXAMPLES
328
+
329
+ ![](images/bb78299ae99aeb8eb9b253a00f8c619e7f97fe6777217bca53e4ff6f9054272d.jpg)
330
+ Figure 9: Qualitative results for 10 categories of ILSVRC dataset for three geometric transformations (horizontal and vertical translations and scaling) and for brightness.
331
+
332
+ We show qualitative examples for images generated with the BigGAN model for position, scale and brightness. The images latent codes are sampled in the following way: $z - \left. z , \boldsymbol u \right. \boldsymbol u + \alpha \boldsymbol u$ with $\alpha \in [ - 3 , 3 ]$ and $\textbf { \em u }$ the learned direction. We have chosen the categories to produce interesting results: for position and scale categories are objects, for brightness categories are likely to be seen in a bright or dark environment. Notice that for some of the chosen categories, we failed to control the brightness of the image. It is likely due to the absence of dark images for these categories in the training data. for position and scale, the direction is learned on the ten categories presented here while for brightness only the five top categories are used.
333
+
334
+ # F QUALITATIVE COMPARISON BETWEEN OUR OPTIMIZATION METHOD AND THE NAIVE METHOD.
335
+
336
+ ![](images/972862ec4e6b2fa544608de6c22ddbcd0115e62bd2e0d838b6ab5027616ff60c.jpg)
337
+ Figure 10: Comparison of the speed of convergence on a single example for our method (top) given by equation 5 and a naive approach (bottom) given by equation 4. The numbers indicate the step of optimization. Both experiences have been conducted with Adam optimizer with a learning rate of 1e−1.
md/train/H1xFWgrFPS/H1xFWgrFPS.md ADDED
@@ -0,0 +1,341 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EXPLANATION BY PROGRESSIVE EXAGGERATION
2
+
3
+ Sumedha Singla Department of Computer Science University of Pittsburgh
4
+
5
+ Brian Pollack, Junxiang Chen Department of Biomedical Informatics University of Pittsburgh
6
+
7
+ Kayhan Batmanghelich Department of Biomedical Informatics Department of Computer Science Intelligent Systems Program University of Pittsburgh
8
+
9
+ # ABSTRACT
10
+
11
+ As machine learning methods see greater adoption and implementation in high stakes applications such as medical image diagnosis, the need for model interpretability and explanation has become more critical. Classical approaches that assess feature importance (e.g., saliency maps) do not explain how and why a particular region of an image is relevant to the prediction. We propose a method that explains the outcome of a classification black-box by gradually exaggerating the semantic effect of a given class. Given a query input to a classifier, our method produces a progressive set of plausible variations of that query, which gradually changes the posterior probability from its original class to its negation. These counter-factually generated samples preserve features unrelated to the classification decision, such that a user can employ our method as a “tuning knob” to traverse a data manifold while crossing the decision boundary. Our method is model agnostic and only requires the output value and gradient of the predictor with respect to its input.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ With the explosive adoption of deep learning for real-world applications, explanation and model interpretability have received substantial attention from the research community (Kim, 2015; DoshiVelez & Kim, 2017; Molnar, 2019; Guidotti et al., 2019). Explaining an outcome of a model in high stake applications, such as medical diagnosis from radiology images, is of paramount importance to detect hidden biases in data (Cramer et al., 2018), evaluate the fairness of the model (Doshi-Velez & Kim, 2017), and build trust in the system (Glass et al., 2008). For example, consider evaluating a computer-aided diagnosis of Alzheimer’s disease from medical images. The physician should be able to assess whether or not the model pays attention to age-related or disease-related variations in an image in order to trust the system. Given a query, our model provides an explanation that gradually exaggerates the semantic effect of one class, which is equivalent to traversing the decision boundary from side to another.
16
+
17
+ Although not always clear, there are subtle differences between interpretability and explanation (Turner, 2016). While the former mainly focuses on building or approximating models that are locally or globally interpretable (Ribeiro et al., 2016), the latter aims at explaining a predictor aposteriori. The explanation approach does not compromise the prediction performance. However, a rigorous definition for what is a good explanation is elusive. Some researchers focused on providing feature importance (e.g., in the form of a heatmap (Selvaraju et al., 2017)) that influence the outcome of the predictor. In some applications (e.g., diagnosis with medical images) the causal changes are spread out across a large number of features (i.e., large portions of the image are impacted by a disease). Therefore, a heatmap may not be informative or useful, as almost all image features are highlighted. Furthermore, those methods do not explain why a predictor returns an outcome. Others have introduced local occlusion or perturbations to the input (Zhou et al., 2014; Fong & Vedaldi, 2017) by assessing which manipulations have the largest impact on the predictors. There is also recent interest in generating counterfactual inputs that would change the black box classification decision with respect to the query inputs (Goyal et al., 2019; Liu et al., 2019). Local perturbations of a query are not guaranteed to generate realistic or plausible inputs, which diminishes the usefulness of the explanation, especially for end users (e.g., physicians). We argue that the explanation should depend not only on the predictor function but also on the data. Therefore, it is reasonable to train a model that learns from data as well as the black-box classifier (e.g., (Chang et al., 2019; Dabkowski & Gal, 2017; Fong & Vedaldi, 2017)).
18
+
19
+ Our proposed method falls into the local explanation paradigm. Our approach is model agnostic and only requires access to the predictor values and its gradient with respect to the input. Given a query input to a black-box, we aim at explaining the outcome by providing plausible and progressive variations to the query that can result in a change to the output. The plausibility property ensures that perturbation is natural-looking. A user can employ our method as a “tuning knob” to progressively transform inputs, traverse the decision boundary from one side to the other, and gain understanding about how the predictor makes a decision. We introduce three principles for an explanation function that can be used beyond our application of interest. We evaluate our method on a set of benchmarks as well as real medical imaging data. Our experiments show that the counterfactually generated samples are realistic-looking and in the real medical application, satisfy the external evaluation. We also show that the method can be used to detect bias in training of the predictor.
20
+
21
+ # 2 METHOD
22
+
23
+ Consider a black box classifier that maps an input space $\mathcal { X }$ (e.g., images) to an output space $\mathcal { V }$ (e.g., labels). In this paper, we consider binary classification problems where $\mathcal { V } = \{ - 1 , + 1 \}$ . To model the black-box, we use $f ( \mathbf { x } ) = \mathbb { P } ( y | \mathbf { x } )$ to denote the posterior probability of the classification. We assume that $f$ is a differentiable function and we have access to its value as well as its gradient with respect to the input $\nabla _ { \mathbf x } f ( \mathbf x )$ .
24
+
25
+ ![](images/22fb0fc40466986b3bfa680913394b4630d9d19ea475bd2efb9eeff36f7b9fcf.jpg)
26
+ Figure 1: (a) The schematic of the method: $f$ is the black-box function producing the posterior probability. $\delta$ is the required change in black-box’s output $f ( \mathbf { x } )$ . $\mathcal { T } _ { f } ( \mathbf { x } , \delta )$ is an explainer function for $f$ , which shifts the value of $f ( \bar { \bf x } )$ by $\delta$ . The $E ( \cdot )$ is an encoder that maps the data manifold $\mathcal { M } _ { x }$ to the embedding manifold $\mathcal { M } _ { z }$ . $\mathbf { x } _ { \delta }$ is an abbreviation for $\mathcal { T } _ { f } ( \mathbf { x } , \delta )$ . (b) The architecture of our model: $E$ is the encoder, $G _ { f } ^ { \delta }$ denotes the conditional generator $G ( \cdot , c _ { f } ( x , \delta ) )$ , $f$ is the black-box and $D$ is the discriminator. The circles denote loss functions.
27
+
28
+ We view the (visual) explanation of the black-box as a generative process that produces an input for the black-box that slightly perturbs current prediction $( f ( \mathbf { x } ) + \delta )$ while remaining plausible and realistic. By repeating this process towards each end of the binary classification spectrum, we can traverse the prediction space from one end to the other and exaggerate the underlying effect. We conceptualize the traversal from one side of the decision boundary to the other as walking across a data manifold, $\mathcal { M } _ { x }$ . We assume the walk has a fixed step size and each step of the walk makes $\delta$ change to the posterior probability of the the classifier, $f$ . Since the output of $f$ is bounded between [0, 1], we can take at-most $\left\lfloor { \frac { 1 } { \delta } } \right\rfloor$ steps. Each positive (negative) step increases (decreases) the posterior probability of the previous step. We assume that there is a low-dimensional embedding space $( \mathcal { M } _ { z } )$ that encodes the walk. An encoder, $E : { \mathcal { M } } _ { x } { \mathcal { M } } _ { z }$ , maps an input, $\mathbf { x }$ , from the data manifold, $\mathcal { M } _ { x }$ , to the embedding space. A generator, $G : \mathcal { M } _ { z } \mathcal { M } _ { y }$ , takes both the embedding coordinate and the number of steps and maps it back to the data manifold (see Figure1).
29
+
30
+ We use $\mathcal { T } _ { f } ( \cdot , \cdot )$ to denote the explainer function. Formally, $\mathcal { T } _ { f } ( \mathbf { x } , \delta ) : ( \mathcal { X } , \mathbb { R } ) \mathcal { X }$ is a function that takes two arguments: a query image $\mathbf { x }$ and the desired perturbation $\delta$ . This function generates a perturbed image which is then passed through function $f$ . The difference between the outputs of $f$ given the original image and the perturbed image should be the desired change i.e., $f ( \mathbf { x } _ { \delta } ) - f ( \mathbf { x } ) =$ $\delta$ . We use $\mathbf { x } _ { \delta }$ to denote $\mathcal { T } _ { f } ( \mathbf { x } , \delta )$ . This formulation enables us to use $\delta$ as a knob to exaggerate the visual explanations of the query sample while it is crossing the decision boundary given by function $f$ . Our proposed interpretability function $\mathcal { T } _ { f }$ should satisfy the following properties:
31
+
32
+ 1. Data Consistency: perturbed samples generated by $\mathcal { T } _ { f }$ should lie on the data manifold, $\mathcal { M } _ { x }$ , to be consistent with real data. In other words, the generated samples should look realistic when compared to other samples.
33
+ 2. Compatibility with $f$ : changing the second argument in $\mathcal { T } _ { f } ( \mathbf { x } , \cdot )$ should produce the desired outcome from classifier $f$ , i.e., $f ( \mathcal { T } _ { f } ( \mathbf { x } , \delta ) ) \tilde { ) } \approx f ( \mathbf { x } ) + \bar { \delta }$ .
34
+ 3. Self Consistency: Applying reverse perturbation should bring $\mathbf { x }$ back to its original form i.e., $\mathcal { T } _ { f } ( \mathbb { Z } _ { f } ( \mathbf { x } , \delta ) , - \delta ) = \mathbf { x }$ . Also, applying setting $\delta$ to zero should return the query, i.e., $\mathcal { T } _ { f } ( \mathbf { x } , 0 ) = \mathbf { x }$ .
35
+
36
+ Each criterion is enforced via a loss function which are discussed in the following sections.
37
+
38
+ # 2.1 DATA CONSISTENCY
39
+
40
+ We adopt the Generative Adversarial Networks (GANs) framework for our model (Goodfellow et al., 2014). The GANs implicitly model the underlying data distribution by setting up a min-max game between generative $( G )$ and discriminative $( D )$ networks:
41
+
42
+ where $\mathbf { z }$ and $P _ { \mathbf { z } }$ are the noise distribution and the corresponding canonical distribution. There has been significant progress toward improving GANs stability as well as sample quality (Brock et al., 2019; Karras et al., 2019). The advantage of GANs is that they produce realistic-looking samples without an explicit likelihood assumption about the underlying probability distribution. This property is appealing for our application.
43
+
44
+ Furthermore, we need to provide the desired amount of perturbation to the black-box, $f$ . Hence, we use a Conditional GAN (cGAN) that allows the incorporation of a context as a condition to the GAN (Mirza $\&$ Osindero, 2014; Miyato & Koyama, 2018). To define the condition, we fix the step size, $\delta$ , and descritize the walk which effectively cuts the posterior probability range of the predictor (i.e., $[ 0 , 1 ] )$ into $\left\lfloor { \frac { 1 } { \delta } } \right\rfloor$ equally-sized bins. Hence, one can view the perturbation from $f ( \mathbf { x } )$ to $f ( \mathbf { x } ) + \delta$ as changing the bin index from the current value $c _ { f } ( \mathbf { x } , 0 )$ to $c _ { f } ( \mathbf { x } , \delta )$ where $c _ { f } ( \mathbf { x } , \delta )$ returns the bin index of $f ( \mathbf { x } ) + \delta$ . We use $c _ { f } ( \mathbf { x } , \delta )$ as a condition to the cGAN.
45
+
46
+ The cGAN optimizes the following loss function:
47
+
48
+ $\mathcal { L } _ { \mathrm { c G a N } } ( D , G ) = \mathbb { E } _ { \mathbf { x } , c \sim P ( \mathbf { x } , c ) } \left[ \log \left( D ( \mathbf { x } , c ) \right) \right] + \mathbb { E } _ { \mathbf { z } \sim P _ { \mathbf { z } } , c \sim P _ { c } } \left[ \log \left( 1 - D ( G ( \mathbf { z } , c ) , c ) \right) \right] ,$ (1) where $c$ denotes a condition. Instead of generating random samples from $P _ { \mathbf { z } }$ , we use the output of an encoder, $E ( \mathbf { x } )$ , as input to the generator. Finally, the explainer function is defined as:
49
+
50
+ $$
51
+ \begin{array} { r } { \mathcal { T } _ { f } ( \mathbf { x } , \delta ) = G ( E ( \mathbf { x } ) , c _ { f } ( \mathbf { x } , \delta ) ) . } \end{array}
52
+ $$
53
+
54
+ Our architecture is based on Projection GAN (Miyato & Koyama, 2018), a modification of cGAN. An advantage of the Projection GAN is that it scales well with the number of classes allowing $\delta 0$ . The Projection GAN imposes the following structure on the discriminator loss function:
55
+
56
+ $$
57
+ \mathcal { L } _ { \mathrm { c G A N } } ( D , \hat { G } ) ( \mathbf { x } , \mathbf { c } ) = \log \frac { p _ { \mathrm { d a t a } } ( \mathbf { c } | \mathbf { x } ) } { q ( \mathbf { c } | \mathbf { x } ) } + \log \frac { p _ { \mathrm { d a t a } } ( \mathbf { x } ) } { q ( \mathbf { x } ) } : = r ( c | \mathbf { x } ) + \psi ( \phi ( \hat { G } ( \mathbf { z } ) ) ) ,
58
+ $$
59
+
60
+ where $\mathcal { L } _ { \mathrm { c G A N } } ( D , \hat { G } )$ indicates the loss function in Eq. 1 when $\hat { G }$ is fixed, $\phi ( \cdot )$ and $\psi ( \cdot )$ are networks producing vector (feature) and scalar outputs respectively. The $r ( c | \mathbf { x } )$ is a conditional ratio function which will be discussed in Section 2.2.
61
+
62
+ # 2.2 COMPATIBILITY WITH THE BLACK BOX
63
+
64
+ In our model, the condition $c$ is an ordered variable i.e., $c _ { f } ( \mathbf { x } , \delta _ { 1 } ) < c _ { f } ( \mathbf { x } , \delta _ { 2 } )$ when $\delta _ { 1 } < \delta _ { 2 }$ . Therefore, we adapt the first term in Eq. 3 to account for ordinal multi-class regression by transforming $c _ { f } ( \mathbf { x } , \delta )$ into $\begin{array} { r } { \lfloor \frac { 1 } { \delta } \rfloor - 1 } \end{array}$ binary classification terms (Frank & Hall, 2001):
65
+
66
+ $$
67
+ r ( c = k | \mathbf { x } ) : = \sum _ { i < k } \mathbf { v } _ { i } ^ { T } \phi ( \mathbf { x } ) ,
68
+ $$
69
+
70
+ where $\phi ( \cdot )$ is the feature network in Eq. 3 and $\mathbf { v } _ { i }$ ’s are parameters. We also need to ensure that plugging $\mathbf { x } _ { \delta }$ into $f ( \cdot )$ yields $f ( \mathbf { x } ) + \delta$ (i.e., compatible with $f$ ). This condition is enforce by a KullbackLeibler (KL) divergence loss term. Adding the KL loss and the conditional ratio function we arrive at the following loss:
71
+
72
+ $$
73
+ \mathcal { L } _ { f } ( D , G ) : = r ( c | \mathbf { x } ) + D _ { \mathrm { K L } } \left( f ( \mathbf { x } ) + \delta \| f ( \mathcal { T } _ { f } ( \mathbf { x } , \delta ) ) \right) .
74
+ $$
75
+
76
+ While the first term is a function of both $G$ and $D$ , the second term influences only the generator $G$
77
+
78
+ # 2.3 SELF CONSISTENCY
79
+
80
+ We use a reconstruction loss term to enforce encoder-decoder consistency and satisfy the identity constraint of $\mathbf { x } = \mathcal { T } _ { f } ( \mathbf { x } , 0 )$ ,
81
+
82
+ $$
83
+ \mathcal { L } _ { \mathrm { r e c } } ( G ) = | | \mathbf { x } - G \left( E ( \mathbf { x } ) , c _ { f } ( \mathbf { x } , 0 ) \right) | | _ { 1 } ,
84
+ $$
85
+
86
+ We also require that the perturbation is reversible (i.e., $\mathcal { T } _ { f } ( \mathbb { Z } _ { f } ( \mathbf { x } , \delta ) , - \delta ) = \mathbf { x } )$ . We use a cycleconsistency (Zhu et al., 2017) loss to reconstruct the input from its corresponding perturbed image,
87
+
88
+ $$
89
+ \mathcal { L } _ { \mathrm { c y c } } ( G ) = | | \mathbf { x } - G ( E ( \mathbf { x } _ { \delta } ) , c _ { f } ( \mathbf { x } , 0 ) ) | | _ { 1 } .
90
+ $$
91
+
92
+ Note that the conditions for the generators in Eq. 5 and 6 are the same. However, in the former, we are reconstructing the input $\mathbf { x }$ from its latent space, but in the latter, we perturb $\mathbf { x } _ { \delta }$ from the bin index $c _ { f } ( \mathbf { x } , \delta )$ back to original bin index $c _ { f } ( \mathbf { x } , 0 )$ .
93
+
94
+ # 2.4 OBJECTIVE FUNCTIONS
95
+
96
+ We adapted the hinge version of the adversarial loss for $\mathcal { L } _ { \mathrm { c G A N } } ( G , D )$ .
97
+
98
+ $$
99
+ \begin{array} { r l } & { \mathcal { L } _ { \mathrm { c G A N } } ( D ) = - \mathbb { E } _ { { \mathbf { x } } \sim p _ { \mathrm { d a t a } } } \big [ \operatorname* { m i n } ( 0 , - 1 + D ( { \mathbf { x } } , c _ { f } ( { \mathbf { x } } , 0 ) ) ) \big ] } \\ & { \qquad - \mathbb { E } _ { { \mathbf { x } } \sim p _ { \mathrm { d a t a } } , c _ { f } ( { \mathbf { x } } , \delta ) \in [ 0 , \frac { 1 } { \delta } ] } \big [ \operatorname* { m i n } ( 0 , - 1 - D ( G ( E ( { \mathbf { x } } ) , c _ { f } ( { \mathbf { x } } , \delta ) ) , c _ { f } ( { \mathbf { x } } , \delta ) ) ) \big ] } \\ & { \qquad \mathcal { L } _ { \mathrm { c G A N } } ( G , E ) = - \mathbb { E } _ { { \mathbf { x } } \sim p _ { \mathrm { d a t a } } , c _ { f } ( { \mathbf { x } } , \delta ) \in [ 0 , \frac { 1 } { \delta } ] } \big [ D ( G ( E ( { \mathbf { x } } ) , c _ { f } ( { \mathbf { x } } , \delta ) ) , c _ { f } ( { \mathbf { x } } , \delta ) ) \big ] } \end{array}
100
+ $$
101
+
102
+ The overall objective function is
103
+
104
+ $$
105
+ \operatorname* { m i n } _ { E , G } \operatorname* { m a x } _ { D } \lambda _ { \mathrm { c G A N } } \mathcal { L } _ { \mathrm { c G A N } } ( D , G ) + \lambda _ { f } \mathcal { L } _ { f } ( D , G ) + \lambda _ { \mathrm { r e c } } \mathcal { L } _ { \mathrm { r e c } } ( G ) + \lambda _ { \mathrm { r e c } } \mathcal { L } _ { \mathrm { c y c } } ( G )
106
+ $$
107
+
108
+ where $\lambda _ { \mathrm { c G A N } } , \lambda _ { f } , \lambda _ { \mathrm { r e c } }$ are the hyper-parameters that balance the importance of the loss terms.
109
+
110
+ # 3 RELATED WORK
111
+
112
+ Our work broadly relates to literature in interpretation methods that are designed to provide a visual explanation of the decisions made by a black-box function $f$ , for a given query sample $\mathbf { x }$ .
113
+
114
+ Perturbation-based methods: These methods provide interpretation by showing what minimal changes are required in $\mathbf { x }$ to induce a desirable output of $f$ . Some methods employed image manipulation via the removal of image patches (Zhou et al., 2014) or the occlusion of image regions (Zhou et al., 2014) to change the classification score. Recently, the use of influence function, as proposed by (Koh & Liang, 2017) are applied as a form of data perturbation to modify a classifier’s response. The authors in (Fong & Vedaldi, 2017) proposed the use of optimal perturbation, defined as removing the smallest possible image region in $\mathbf { x }$ that results in the maximum drop in classification score. In another approach, (Chang et al., 2019) proposed a generative process to find and fill the image regions that correspond to the largest change in the decision output of a classifier. To switch the decision of a classifier, (Goyal et al., 2019) suggested generating counterfactuals by replacing the regions of $\mathbf { x }$ with patches from images with a different class label. All of the aforementioned works perform pixel- or patch-level manipulation to $\mathbf { x }$ , which may not result in natural-looking images. In contrast, our model enforces that the perturbed data be consistent with the unperturbed data to ensure that the perturbation is plausible. Furthermore, our method can be applied to general data and is not restricted to the imaging domain.
115
+
116
+ Saliency map-based methods: Saliency maps explains the decision of $f$ on $\mathbf { x }$ by highlighting the relevant regions of $x$ . Some earlier work in this direction(Simonyan et al., 2013; Springenberg et al., 2015; Bach et al., 2015) focuses on computing the gradient of the target class with respect to $\mathbf { x }$ and considers the image regions with large gradients as most informative. Building on this work, the class activation map (CAM) (Zhou et al., 2016) and its generalized version Grad-CAM Selvaraju et al. (2017) and other variants such as LPR (Bach et al., 2015) use a linear or non-linear combination of the activation layers to derive relevance score for every pixel in an image. These gradient-based methods are not model-agnostic and require access to intermediate layers. Recently, Adebayo et al. (2018) have shown that some saliency methods are independent both of the model and of the data generating process. We used their propose evaluation to validate our interpretation model. The saliency maps are also prone to adversarial attacks as shown by Ghorbani et al. (2019) and Kindermans et al. (2017). Furthermore, if the causal effect of a class is distributed across an image, which is the case in radiology images, the saliency approaches highlight large sections of the image, which greatly reduce the usefulness of the interpretation.
117
+
118
+ Generative explanation-based methods: These are interpretation models that uses a generative process to produce visual explanations. The contrastive explanations method (CEM) (Dhurandhar et al., 2018) generates explanations that show minimum regions in x which must be present/absent for a particular classification decision. In another work, (Liu et al., 2019; Joshi et al., 2019; Samangouei et al., 2018) generates explanations that highlight what features should be changed in x so that the classifier confidence in the prediction is strengthen (prototype) or weakened (counterfactual). Our approach is aligned with these latter lines of work, although our method and model architecture is different. Our method allows for the gradual change of the class effect, and our consistency criteria result in high-quality feasible perturbation in x. We rigorously evaluate our method on real medical imaging applications, in addition to the curated computer vision datasets.
119
+
120
+ # 4 EXPERIMENTS
121
+
122
+ We set up four experiments to evaluate our method. First, we assess if our method satisfies the three criteria of the explainer function introduced in Section 2. We report both qualitative and quantitative results. Second, we apply our method on a medical image diagnosis task. We use external domain knowledge about the disease to perform a quantitative evaluation of the explanation. Third, we train two classifiers on biased and unbiased data and examine the performance of our method in identifying the bias. While our method does not produce a saliency map, in our last experiment, we use the two counterfactual samples on the boundary $[ 0 , 1 ]$ to generate a saliency map and compare it with the other methods. In Appendix A, we show further experiments to evaluate our model in human experiments, to demonstrate its compatibility with a multi-label classifier and, an ablation study, to show the relative importance of each of the three criteria of the explainer function.
123
+
124
+ Our experiments are conducted on the CelebA (Liu et al., 2015) and CheXpert (Irvin et al., 2019) datasets. CelebA contains 200K celebrity face images, each with forty attribute labels. We considered binary classifier trained on the “smiling” and “young” attributes. CheXpert is a medical dataset containing 224K chest $\mathbf { X }$ -ray images from 65K patients and has labels for fourteen radio-graphic observations. We considered Cardiomegaly as the target class for generating explanations. All images are re-sized to $1 2 8 \times 1 2 8$ before processing.
125
+
126
+ # 4.1 EVALUATING THE CRITERIA OF THE EXPLAINER
127
+
128
+ Figure 2 reports the qualitative results on three datasets. Given a query image $\mathbf { x }$ at inference time, our model generates a series of images $\mathbf { x } _ { \delta }$ as visual explanations, which gradually increase the posterior probability $f ( \mathbf { x } _ { \delta } )$ (top label). We show results for three prediction tasks: smiling or not-smiling, young or old, and Cardiomegaly or healthy. The values on the top of each figure report the $f ( \mathbf { x } _ { \delta } )$ ’s. For Cardiomegaly, we show the outlines of the heart as well as its normalized size (values inside the parenthesis), which is indicative of the disease.
129
+
130
+ ![](images/6de9d95a4ce7cac06ff89ceef16b3b82673aeea8c033d928b0d6d2ec457b5ca7.jpg)
131
+ Figure 2: Visual explanations generated for three prediction tasks: smiling/not-smiling face (first two rows), young/old face (middle two rows) and Cardiomegaly/healthy chest x-ray (bottom two rows). The first column shows the query image, followed by the corresponding generated explanations. The values above each image are the output of the classifier $f$ . For Cardiomegaly, we show the segmentation of the heart (yellow edge) and report normalized heart size (values in parenthesis), which is indicative of the disease.
132
+
133
+ Data Consistency: The generated explanations are synthesized variations of the query image. To quantitatively compare their visual quality, we consider Frechet Inception Distance (FID) ( ´ Heusel et al., 2017). We compared our results against the counterfactual explanations produced by xGEM (Joshi et al., 2018). The details of the xGEM model are given in appendix A.2. We divided the real and fake (i.e., generated explanations) images into two groups (on either boundary of $f ( \mathbf { x } ) \in [ 0 , 1 ] )$ and reported the FID for each group and the overall score. Our method significantly outperforms xGEM, producing crisper and more realistic-looking images. xGEM is based on variational autoencoder (VAE) which are known to produce blurry images (see Figure 7).
134
+
135
+ Compatibility with the black-box $f$ : To quantify whether the generation process is aligned with the desire perturbation $\delta$ , we plotted the expected outcome $f ( \mathbf { x } ) + \delta$ against the actual response of the classifier for the generated explanations, $f ( \mathbf { x } _ { \delta } )$ . Figure 3 shows how our model performs when generating a series of explanations starting from a wide range of initial query images. The performance is almost perfect for Young/Old, but less so for more challenging classification problems such as Smiling or Cardiomegaly. The plot also validates that we are producing perturb images covering the entire classification range, [0, 1]. Appendix A.3 shows additional result from CelebA dataset.
136
+
137
+ <table><tr><td colspan="3"></td><td colspan="2">CelebA:Smiling</td><td colspan="2">CelebA:Young</td><td colspan="2"> Xray:Cardiomegaly</td></tr><tr><td>Target Class</td><td></td><td></td><td>xGEM</td><td>Ours</td><td>xGEM</td><td>Ours</td><td>xGEM</td><td>Ours</td></tr><tr><td>Present (f(xs) ∈[0.9,1])</td><td></td><td></td><td>111.0</td><td>46.9</td><td>115.2</td><td>67.6</td><td>368.6</td><td>82.9</td></tr><tr><td>Absent (f(xs) ∈ [0,0.1])</td><td></td><td></td><td>112.9</td><td>56.3</td><td>170.3</td><td>74.4</td><td>394.6</td><td>84.8</td></tr><tr><td>Overall(f(xs) ∈[0,1])</td><td></td><td></td><td>106.3</td><td>35.8</td><td>117.9</td><td>53.4</td><td>326.3</td><td>58.1</td></tr></table>
138
+
139
+ Table 1: The Frechet Inception Distance (FID) score, measuring the quality of the generated explanations for ´ the three prediction tasks. Lower FID corresponds to better image quality. Top (bottom) row corresponds the top (bottom) $10 \%$ of the decision interval.
140
+
141
+ ![](images/3c68a51b483eb959b17d0238affafa3c41b547d111e75a5b9cb50815593755b2.jpg)
142
+ Figure 3: Plot of the expected outcome from the classifier, $f ( \mathbf { x } ) { + } \delta$ , against the actual response of the classifier on generated explanations, $f ( \mathbf { x } _ { \delta } )$ . The monotonically increasing trend shows a positive correlation between $f ( \mathbf { x } ) + \delta$ and $f { \bar { ( \mathbf { x } _ { \delta } ) } }$ , and thus the generated explanations are consistent with the expected condition.
143
+
144
+ Identity preservation: The generated explanations should differ only in semantic features associated with the target class, while retaining the identity of the query image. We extracted the latent embedding for real images $( E ( \mathbf { x } ) )$ and their corresponding explanations $( E ( \mathbf { x } _ { \delta } ) )$ , for different values of $\delta$ . We calculated latent space closeness as the percentage of the times, $\mathbf { x } _ { \delta }$ is closest to the query image $\mathbf { x }$ as compared to other generated explanations
145
+
146
+ $$
147
+ \forall \delta , \mathbf { x } \in \mathcal { X } , \quad | | E ( \mathbf { x } ) - E ( \mathbf { x } _ { \delta } ) | | _ { 2 } < \operatorname* { m i n } _ { \mathbf { m } \in \mathcal { Z } _ { f } ( \mathcal { X } - \{ \mathbf { x } \} , \delta ) } | | E ( \mathbf { x } _ { \delta } ) - E ( \mathbf { m } ) | | _ { 2 } ,
148
+ $$
149
+
150
+ where, $\mathbf { m } \in \mathcal { T } _ { f } ( \mathcal { X } - \{ \mathbf { x } \} , \delta ) )$ is the set of explanations generated for all the real images excluding the query image x. Another, popular approach to quantify identity of two face images, is to perform face verification. We used state-of-the-art face recognition model trained on VGGFace2 dataset (Cao et al., 2018) as feature extractor for both real images and their corresponding fake explanations. For face verification, we calculated the closeness between real and fake image as cosine distance between their feature vectors. The faces were considered as verified i.e., fake explanation have same identity as real image, if the distance is below 0.5. Table 2 summarizes the results.
151
+
152
+ Our method achieved high performance on localized attribute “smiling”, which alters a relatively small region of the face image as compare to attribute “age” which affects the entire face. Medical images like chest $\mathbf { X }$ -ray have very fine grain details which are difficult to preserve in the generative process of GAN. Our explainer function preserves the high level features like shape and size of the lung, but it struggles to retain the low level features like anatomy of the breast and shape of the collar bones. Also, it should be noted that both the datasets have multiple images for same person, but we ignore this information in our analysis and treat each image as a different identity. We compared our performance against xGEM (Joshi et al., 2018). VAE explicitly minimizes for latent space closeness. The generated explanation by xGEM were blurry version of the query image. Hence, although they were close to query image in latent space, but they didn’t preserve the identity of the individual as shown in face verification task and is evident in Figure 7 in appendix A.2. In comparison, our model achieved good performance on both the tasks.
153
+
154
+ # 4.2 COUNTERFACTUAL EVALUATION ON MEDICAL DATA
155
+
156
+ Cardiomegaly refers to an abnormal enlargement of the heart (Brakohiapa et al., 2017). To understand the explanations derived for Cardiomegaly target class, we overlaid the heart segmentation over the $\mathbf { X }$ -ray image and visualize the gradual change in heart size. The heart segmentation is shown as outlines in Figure 2, with their corresponding heart size (top values in parentheses). The heart segmentation is derive by training a UNet (Ronneberger et al., 2015) model on the segmentation in chest radiograph (SCR) dataset (van Ginneken et al., 2006). We registered $\mathbf { x }$ with its associated $\mathbf { x } _ { \delta }$ and applied the resulting transformation to the heart masks of $\mathbf { x }$ to derive the heart masks for $\mathbf { x } _ { \delta }$ .
157
+
158
+ Table 2: Identity preserving performance on three prediction tasks.
159
+
160
+ <table><tr><td rowspan="2"></td><td colspan="2">CelebA:Smiling</td><td colspan="2">CelebA:Young</td><td colspan="2"> Xray:Cardiomegaly</td></tr><tr><td>xGEM</td><td>Ours</td><td>xGEM</td><td>Ours</td><td>xGEM</td><td>Ours</td></tr><tr><td>Latent Space Closeness</td><td>88.2</td><td>88.0</td><td>89.5</td><td>81.6</td><td>2.2</td><td>27.9</td></tr><tr><td>Face Verification Accuracy</td><td>0.0</td><td>85.3</td><td>0.0</td><td>72.2</td><td>1</td><td>1</td></tr></table>
161
+
162
+ For population-level analysis, we plotted the average heart size of $\mathbf { x } _ { \delta }$ vs the condition used for generation $( f ( \mathbf { x } ) + \delta )$ in Figure 4 (a). The plot shows a positive correlation between the heart size and the response of the classifier $f ( \mathbf { x } )$ , which agrees with the definition of Cardiomegaly. To better understand the results, we divided the population into two groups, the first group $( \mathbf { x } ^ { h } ; f ( \mathbf { x } ^ { h } ) < 0 . 1 )$ consists of real images of healthy $\mathbf { X }$ -rays, and the second group $( \mathbf { x } ^ { c }$ $\mathfrak { x } ^ { c } ; f ( \mathbf { x } ^ { c } ) > 0 . 9 )$ contains real images of abnormal $\mathbf { X }$ -rays positive for Cardiomegaly. For $\mathbf { x } ^ { h }$ we generated counterfactual as $\mathbf { x } _ { \delta } ^ { c }$ such that $f ( \mathbf { x } _ { \delta } ^ { c } ) ~ > ~ 0 . 9$ . Similarly, counterfactuals for $\mathbf { x } ^ { c }$ are derived as $\mathbf { x } _ { \delta } ^ { h }$ such that $f ( \mathbf { x } _ { \delta } ^ { h } ) ~ <$ 0.1. In Figure 4 (b), we show the distribution of heart size in the four groups. We reported the dependent t-test statistics for paired samples $\mathbf { \Delta x } ^ { h }$ and $\mathbf { x } _ { \delta } ^ { c }$ , $\mathbf { \Psi } _ { \mathbf { X } } ^ { c }$ and $\mathbf { x } _ { \delta } ^ { h }$ . A significant $\mathsf { p }$ -value $\ll$ 0.001 rejected the null hypothesis (i.e., that the two groups have similar distributions). We also reported the independent two-sample t-test statistics for healthy $\mathbf { \bar { x } } ^ { h }$ and $\mathbf { x } _ { \delta } ^ { h }$ , p-value $> 0 . 0 1$  and abnormal $\mathbf { x } ^ { c }$ and $\mathbf { x } _ { \delta } ^ { c }$ , p-value $< 0 . 0 1 \AA \AA ,$ ) populations. Given higher p-values, we cannot reject the null hypothesis of identical average distributions with high confidence. Our model derived explanations successfully captured the change in heart size while generating counterfactual explanations.
163
+
164
+ ![](images/d39888c553e45320ac15dc7ec307e7d51106beb70913ede77cb9227604f3c00a.jpg)
165
+ Figure 4: Cardiomegaly disease is associated with large heart size. In (a) we show the positive correlation between the heart size and the response of the classifier $f ( \mathbf { x } )$ . (b) Comparison of the distribution of the heart size in the four groups. (c) Plot to show the drop in accuracy of the classifier as we perturb the most relevant pixels (relevance calculated from saliency map) in the image.
166
+
167
+ # 4.3 SALIENCY MAP
168
+
169
+ Saliency maps show the importance of each pixel of an image in the context of classification. Our method is not designed to produce saliency maps as a continuous score for every feature of the input. We extract an approximate saliency map by quantifying the regions that changed the most when comparing explanations at the opposing ends of the classification spectrum. For each query image, we generated two visual explanations corresponding to the two extremes of the decision boundary $\bar { \ b { f } } ( \mathbf { x } _ { \delta } ) = 0$ and $f ( \mathbf { x } _ { \delta } ) = 1 $ . The absolute difference between these explanations is our saliency map. Figure 5 shows the saliency map obtain from our method and its comparison with popular gradient based methods. We restricted the saliency maps obtained from different methods to have positive values and normalize them to range [0,1]. Subjective, the saliency maps produced by our method are very localized and are comparable to the other methods.
170
+
171
+ We adapted the metric introduced in (Samek et al., 2016) to compare the different saliency maps. In an iterative procedure, we progressively replace a percentage of the most relevant pixels in an image (as given by the saliency map) with random values sampled from a uniform distribution. We observe the corresponding change in the classification performance as shown in Figure 4 (c). All the methods experienced a drop in the accuracy of the classifier with increase in the fraction of perturb pixels. The saliency maps produced by our model is significantly better than random maps and are comparable to the other saliency map methods. It should be noted that, there are many ways to quantify important regions in a image, using the series of explanations generated by our method. We didn’t optimize to find the best saliency map and showed results for one such method.
172
+
173
+ ![](images/3c7c08f2250348ce2951c4ff6f9389d6ab411d3b65317447ee44214f68a3e2e9.jpg)
174
+ Figure 5: Our comparison with popular gradient-based saliency map producing methods on the prediction task of identifying smiling faces in CelebA dataset.
175
+
176
+ # 4.4 BIAS DETECTION
177
+
178
+ Our model can discover confounding bias in the data used for training the black-box classifier. Confounding bias provides an alternative explanation for an association between the data and the target label. For example, a classifier trained to predict the presence of a disease may make decisions based on hidden attributes like gender, race, or age. In a simulated experiment, we trained two classifiers to identify smiling vs not-smiling images in the CelebA dataset. The first classifier $f _ { \mathrm { B i a s e d } }$ is trained on a biased dataset, confounded with gender such that all smiling images are of male faces. We train a second classifier $f _ { \mathrm { N o - b i a s e d } }$ on an unbiased dataset, with data uniformly distributed with respect to gender. Note that we evaluate both the classifiers on the same validation set. Additionally, we assume access to a proxy Oracle classifier $f _ { \mathrm { G e n d e r } }$ that perfectly classifies the confounding attribute i.e., gender. As shown in Cohen et al. (2018), if the training data for the GAN is biased, then the inference would reflect that bias. In Figure 6, we compare the explanations generated for the two classifiers. The visual explanations for the biased classifier change gender as it increases the amount of smile. We adapted the confounding metric proposed in Joshi et al. (2018) to summarize our results in Table 3. Given the data $\mathcal { D } = \{ ( \mathbf { x } _ { i } , y _ { i } , a _ { i } ) , \mathbf { x } _ { i } \in \mathcal { X } , y _ { i } , a _ { i } \in \mathcal { Y } \}$ , we quantify that a classifier is confounded by an attribute $a$ if the generated explanation $\hat { x } _ { \delta }$ has a different attribute $a$ , as compared to query image x, when processed through the Oracle classifier $f _ { \mathrm { G e n d e r } }$ . The metric is formally defined as $\bar { \mathbb { E } } _ { \mathcal { D } } [ 1 ( \bar { g } ^ { * } ( \mathbf { x } _ { \delta } ) \neq a ) ] / | \mathcal { D } |$ . For a biased classifier, the Oracle function predicted the female class for the majority of the images, while the unbiased classifier is consistent with the true distribution of the validation set for gender. Thus, we the fraction of generated explanations that changed the confounding attribute “gender’ was found to be high for the biased classifier.
179
+
180
+ <table><tr><td></td><td colspan="2">Target Label</td></tr><tr><td>Black-box classifier</td><td>Smiling</td><td>Not-Smiling</td></tr><tr><td rowspan="3">fBiased</td><td>Male: 0.52</td><td>Male: 0.18</td></tr><tr><td>Female: 0.48</td><td>Female: 0.82</td></tr><tr><td>Overall: 0.12</td><td>Overall: 0.35</td></tr><tr><td rowspan="3">fNo-biased</td><td>Male: 0.48</td><td>Male: 0.47</td></tr><tr><td>Female: 0.52</td><td>Female: 0.53</td></tr><tr><td>Overall: 0.07</td><td>Overall: 0.08</td></tr></table>
181
+
182
+ Table 3: Confounding metric for biased detection. For target label “Smiling” and “Not-Smiling”, the explanations are generated using condition $f ( x ) + \delta > 0 . 9$ and $\bar { f } ( x ) + \delta < 0 . 1$ respectively. The Male and Female values quantifies the fraction of the generated explanations classifier as male or female, respectively by oracle classifier $f _ { \mathrm { G e n d e r } }$ . The overall value quantifies the fraction of the generated explanations who have different gender as compared to the query image. A small overall value shows least bias.
183
+
184
+ ![](images/26b8b74793e1eaa292351b6623afa673c2276f30711a7ab370318b9bf0e6b3bd.jpg)
185
+ Figure 6: The visual explanations for two classifiers, both trained to classify “Smiling” attribute on CelebA dataset. For each example, the top row shows results from “Biased” classifier whose data distribution is confounded with “Gender”. The bottom row shows explanations from “No-Biased” classifier with uniform data distribution w.r.t gender. The top label indicates output of the classifier and the bottom label is the output of an oracle classifier for the con-founding attribute gender. The visual explanations for the “Biased” classifier changes the gender as it adds smile on the face.
186
+
187
+ # 5 CONCLUSION
188
+
189
+ In this paper, we proposed a novel interpretation method that explains the decision of a black-box classifier by producing natural-looking, gradual perturbations of the query image, resulting in an equivalent change in the output of the classifier. We evaluated our model on two very different datasets, including a medical imaging dataset. Our model produces high-quality explanations while preserving the identity of the query image. Our analysis shows that our explanations are consistent with the definition of the target disease without explicitly using that information. Our method can also be used to generate a saliency map in a model agnostic setting. In addition to the interpretability advantages, our proposed method can also identify plausible confounding biases in a classifier.
190
+
191
+ # REFERENCES
192
+
193
+ Julius Adebayo, Justin Gilmer, Michael Muelly, Ian Goodfellow, Moritz Hardt, and Been Kim. Sanity checks for saliency maps. In Advances in Neural Information Processing Systems, pp. 9505–9515, 2018.
194
+
195
+ Sebastian Bach, Alexander Binder, Grgoire Montavon, Frederick Klauschen, Klaus-Robert Muller, and Wojciech Samek. On pixel-wise explanations for non-linear classifier decisions by layer-wise relevance propagation. PloS one, 10(7):e0130140, 2015.
196
+
197
+ Edmund Kwadwo Kwakye Brakohiapa, Benard Ohene Botwe, Benjamin Dabo Sarkodie, Eric Kwesi Ofori, and Jerry Coleman. Radiographic determination of cardiomegaly using cardiothoracic ratio and transverse cardiac diameter: can one size fit all? Part one. The Pan African medical journal, 27:201, 2017. ISSN 1937-8688. doi: 10.11604/pamj.2017.27.201. 12017. URL http://www.ncbi.nlm.nih.gov/pubmed/28904726http://www. pubmedcentral.nih.gov/articlerender.fcgi?artid $=$ PMC5579422.
198
+
199
+ Andrew Brock, Jeff Donahue, and Karen Simonyan. Large Scale GAN Training for High Fidelity Natural Image Synthesis. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id ${ \underline { { \underline { { \mathbf { \Pi } } } } } } =$ B1xsqj09Fm.
200
+
201
+ Q Cao, L Shen, W Xie, O M Parkhi, and A Zisserman. VGGFace2: A dataset for recognising faces across pose and age. In International Conference on Automatic Face and Gesture Recognition, 2018.
202
+
203
+ Chun-Hao Chang, Elliot Creager, Anna Goldenberg, and David Duvenaud. Explaining Image Classifiers by Counterfactual Generation, 2019. URL https://openreview.net/forum?id= B1MXz20cYQ.
204
+
205
+ Joseph Paul Cohen, Margaux Luck, and Sina Honari. Distribution matching losses can hallucinate features in medical image translation. In Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics), volume 11070 LNCS, pp. 529–536. Springer Verlag, 2018. ISBN 9783030009274. doi: 10.1007/978-3-030-00928- $1 \bar \{ $ .
206
+
207
+ Henriette Cramer, Jean Garcia-Gathright, Aaron Springer, and Sravana Reddy. Assessing and addressing algorithmic bias in practice. interactions, 25(6):58–63, 2018.
208
+
209
+ Piotr Dabkowski and Yarin Gal. Real time image saliency for black box classifiers. In Advances in Neural Information Processing Systems, pp. 6967–6976, 2017.
210
+
211
+ Amit Dhurandhar, Pin-Yu Chen, Ronny Luss, Chun-Chen Tu, Paishun Ting, Karthikeyan Shanmugam, and Payel Das. Explanations based on the missing: Towards contrastive explanations with pertinent negatives. In Advances in Neural Information Processing Systems, pp. 592–603, 2018.
212
+
213
+ Finale Doshi-Velez and Been Kim. Towards a rigorous science of interpretable machine learning. arXiv preprint arXiv:1702.08608, 2017.
214
+
215
+ Ruth C. Fong and Andrea Vedaldi. Interpretable Explanations of Black Boxes by Meaningful Perturbation. In Proceedings of the IEEE International Conference on Computer Vision, 2017. ISBN 9781538610329. doi: 10.1109/ICCV.2017.371.
216
+
217
+ Eibe Frank and Mark Hall. A simple approach to ordinal classification. In European Conference on Machine Learning, pp. 145–156, 2001.
218
+
219
+ Amirata Ghorbani, Abubakar Abid, and James Zou. Interpretation of neural networks is fragile. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 3681–3688, 2019.
220
+
221
+ Alyssa Glass, Deborah L McGuinness, and Michael Wolverton. Toward establishing trust in adaptive agents. In Proceedings of the 13th international conference on Intelligent user interfaces, pp. 227–236. ACM, 2008.
222
+
223
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative Adversarial Nets. In Z Ghahramani, M Welling, C Cortes, N D Lawrence, and K Q Weinberger (eds.), Advances in Neural Information Processing Systems 27, pp. 2672–2680. Curran Associates, Inc., 2014. URL http://papers.nips.cc/ paper/5423-generative-adversarial-nets.pdf.
224
+
225
+ Yash Goyal, Ziyan Wu, Jan Ernst, Dhruv Batra, Devi Parikh, and Stefan Lee. Counterfactual Visual Explanations. In International Conference on Machine Learning, pp. 2376–2384, 2019. URL http://arxiv.org/abs/1904.07451.
226
+
227
+ Riccardo Guidotti, Anna Monreale, Salvatore Ruggieri, Franco Turini, Fosca Giannotti, and Dino Pedreschi. A survey of methods for explaining black box models. ACM computing surveys (CSUR), 51(5):93, 2019.
228
+
229
+ Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. In Advances in Neural Information Processing Systems, pp. 6626–6637, 2017.
230
+
231
+ Jeremy Irvin, Pranav Rajpurkar, Michael Ko, Yifan Yu, Silviana Ciurea-Ilcus, Chris Chute, Henrik Marklund, Behzad Haghgoo, Robyn Ball, Katie Shpanskaya, Jayne Seekins, David A. Mong, Safwan S. Halabi, Jesse K. Sandberg, Ricky Jones, David B. Larson, Curtis P. Langlotz, Bhavik N. Patel, Matthew P. Lungren, and Andrew Y. Ng. CheXpert: A Large Chest Radiograph Dataset with Uncertainty Labels and Expert Comparison, 1 2019. URL http://arxiv.org/abs/ 1901.07031.
232
+
233
+ Shalmali Joshi, Oluwasanmi Koyejo, Been Kim, and Joydeep Ghosh. xGEMs: Generating Examplars to Explain Black-Box Models. arXiv preprint arXiv:1806.08867, 2018.
234
+
235
+ Shalmali Joshi, Oluwasanmi Koyejo, Warut Vijitbenjaronk, Been Kim, and Joydeep Ghosh. Towards Realistic Individual Recourse and Actionable Explanations in Black-Box Decision Making Systems. CoRR, abs/1907.09615, 2019. URL http://arxiv.org/abs/1907.09615.
236
+
237
+ Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4401–4410, 2019.
238
+
239
+ Been Kim. Interactive and interpretable machine learning models for human machine collaboration. PhD thesis, Massachusetts Institute of Technology, 2015.
240
+
241
+ Pieter-Jan Kindermans, Sara Hooker, Julius Adebayo, Maximilian Alber, Kristof T Schutt, Sven ¨ Dahne, Dumitru Erhan, and Been Kim. The (un) reliability of saliency methods. ¨ Explainable AI: Interpreting, Explaining and Visualizing Deep Learning, pp. 267–280, 2017.
242
+
243
+ Pang Wei Koh and Percy Liang. Understanding black-box predictions via influence functions. In 34th International Conference on Machine Learning, ICML 2017, 2017. ISBN 9781510855144.
244
+
245
+ Shusen Liu, Bhavya Kailkhura, Donald Loveland, and Yong Han. Generative Counterfactual Introspection for Explainable Deep Learning. arXiv, 2019.
246
+
247
+ Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep Learning Face Attributes in the Wild. In Proceedings of the IEEE international conference on computer vision, pp. 3730–3738, 2015.
248
+
249
+ Mehdi Mirza and Simon Osindero. Conditional Generative Adversarial Nets. CoRR, abs/1411.1784, 2014. URL http://arxiv.org/abs/1411.1784.
250
+
251
+ Takeru Miyato and Masanori Koyama. cGANs with Projection Discriminator. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum? id $=$ ByS1VpgRZ.
252
+
253
+ Christoph Molnar. Interpretable Machine Learning. Github, 2019. https://christophm. github.io/interpretable-ml-book/.
254
+
255
+ Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. Why should i trust you?: Explaining the predictions of any classifier. In Proceedings of the 22nd ACM SIGKDD international conference on knowledge discovery and data mining, pp. 1135–1144. ACM, 2016.
256
+
257
+ Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-Net: Convolutional Networks for Biomedical Image Segmentation. In Medical Image Computing and Computer-Assisted Intervention (MICCAI), 2015. URL http://arxiv.org/abs/1505.04597.
258
+
259
+ Pouya Samangouei, Ardavan Saeedi, Liam Nakagawa, and Nathan Silberman. Explaingan: Model explanation via decision boundary crossing transformations. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 666–681, 2018.
260
+
261
+ Wojciech Samek, Alexander Binder, Grgoire Montavon, Sebastian Lapuschkin, and Klaus-Robert Muller. Evaluating the visualization of what a deep neural network has learned. ¨ IEEE transactions on neural networks and learning systems, 28(11):2660–2673, 2016.
262
+
263
+ Ramprasaath R Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. Grad-cam: Visual explanations from deep networks via gradient-based localization. In Proceedings of the IEEE International Conference on Computer Vision, pp. 618–626, 2017.
264
+
265
+ Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. Computing Research Repository, 2013.
266
+
267
+ Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin A Riedmiller. Striving for Simplicity: The All Convolutional Net. In ICLR (workshop track), 2015.
268
+
269
+ Ryan Turner. A model explanation system. In 2016 IEEE 26th International Workshop on Machine Learning for Signal Processing (MLSP), pp. 1–6. IEEE, 2016.
270
+
271
+ B van Ginneken, M B Stegmann, and M Loog. Segmentation of anatomical structures in chest radiographs using supervised methods: a comparative study on a public database. Medical Image Analysis, 10(1):19–40, 2006.
272
+
273
+ Anthony J Viera, Joanne M Garrett, and others. Understanding interobserver agreement: the kappa statistic. Fam med, 37(5):360–363, 2005.
274
+
275
+ Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. Object detectors emerge in deep scene cnns. Computing Research Repository, 2014.
276
+
277
+ Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. Learning deep features for discriminative localization. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2921–2929, 2016.
278
+
279
+ Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks. In Proceedings of the IEEE international conference on computer vision, pp. 2223–2232, 2017. URL http://arxiv.org/abs/1703. 10593.
280
+
281
+ # A APPENDIX
282
+
283
+ # A.1 IMPLEMENTATION DETAILS
284
+
285
+ The architecture for the generator and discriminator is adapted from Miyato & Koyama (2018). The image encoding learned by encoder $E ( \mathbf { x } )$ is fed into the generator. The condition $c _ { f } ( \mathbf { x } , \delta )$ is passed to each resnet block in the generator, using conditional batch normalization. The generator has five resnet blocks, where each block consists of BN-ReLU-Conv3-BN-ReLU-Conv3. BN is batch normalization, ReLU is activation function, and Conv3 is the convolution filter. The encoder function uses the same structure but downsamples the image. The discriminator function has five resnet blocks, each of which has the form ReLU-Conv3-ReLU-Conv3.
286
+
287
+ # A.2 XGEM IMPLEMENTATION
288
+
289
+ We refers to Joshi et al. (2019) for the implementation of xGEM. First, VAE is trained to generate face images. The VAE used is available at:https://github.com/LynnHo/VAE-Tensorflow. All settings and architectures were set to default values. The original code generates an image of dimension $6 4 \mathrm { x } 6 4$ . We extended the given network to produce an image with dimensions $1 2 8 \mathrm { x } 1 2 8$ . The pretrained VAE is then extended to incorporate the cross-entropy loss for flipping the label of the query image. The model evaluates the cross-entropy loss by passing the generated image through the classifier. Figure 7 shows the qualitative difference between the explanations generated by our proposed method and xGEM.
290
+
291
+ # A.3 EXTENDED RESULTS FOR EVALUATING THE CRITERIA OF THE EXPLAINER
292
+
293
+ Here, we provide results for four more prediction tasks on celebA dataset: no-beard or beard, heavy makeup or light makeup, black hair or not back hair, and bangs or no-bangs. Figure 8 shows the qualitative results, an extended version of results in Figure 2. We evaluated the results from these prediction tasks for compatibility with black-box $f$ (see Figure 9), data consistency and self consistency (see Table 4).
294
+
295
+ <table><tr><td rowspan="2">Prediction Task</td><td colspan="3">Data Consistency (FID)</td><td colspan="2">Self Consistency</td></tr><tr><td>Present</td><td>Absent</td><td>Overall</td><td>LSC</td><td>FVA</td></tr><tr><td>Smiling vs Not-smiling</td><td>46.9</td><td>56.3</td><td>35.8</td><td>88.0</td><td>85.3</td></tr><tr><td>Young vs Old</td><td>67.5</td><td>74.4</td><td>53.4</td><td>81.6</td><td>72.2</td></tr><tr><td>No beard vs Beard</td><td>79.2</td><td>72.3</td><td>45.4</td><td>89.6</td><td>83.3</td></tr><tr><td>Heavy makeup vs Light makeup</td><td>64.9</td><td>98.2</td><td>39.2</td><td>89.2</td><td>75.3</td></tr><tr><td>Blackhair vs Notblack hair</td><td>55.8</td><td>72.8</td><td>34.8</td><td>79.4</td><td>81.6</td></tr><tr><td>Bangs vs No bangs</td><td>54.1</td><td>57.8</td><td>40.6</td><td>76.5</td><td>87.3</td></tr></table>
296
+
297
+ Table 4: Our model results for six prediction tasks on CelebA dataset. FID (Frechet Inception ´ Distance) score measures the quality of the generated explanations. Lower FID is better. LSC (Latent Space Closeness) quantifies the fraction of the population where generated explanation is nearest to the query image than any other generated explanation in embedding space. FVA (Face verification accuracy) measures percentage of the times the query image and generated explanation have same face identity as per model trained on VGGFace2. Higher LSC and FVA is better.
298
+
299
+ # A.4 HUMAN EVALUATION
300
+
301
+ We used Amazon Mechanical Turk (AMT) to conduct human experiments to demonstrate that the progressive exaggeration produced by our model is visually perceivable to humans. We presented AMT workers with three tasks. In the first task, we evaluated if humans can detect the relative order between two explanations produced for a given image. We ask the AMT workers, “Given two images of the same person, in which image is the person younger (or smiling more)?” (see Figure 10). We experimented with 200 query images and generated two pairs of explanations for each query image (i.e., 400 hits). The first pair (easy) imposed the two images are samples from opposite ends of the explanation spectrum (counterfactuals), while the second pair (hard) makes no such assumption.
302
+
303
+ In the second task, we evaluated if humans can identify the target class for which our model has provided the explanations. We ask the AMT workers, “What is changing in the images? (age, smile, hair-style or beard)”. We experimented with 100 query images from each of the four attributes (i.e., 400 hits). In the third task, we demonstrate that our model can help the user to identify problems like possible bias in the black-box training. Here, we used the same setting as in the second task but also showed explanations generated for a biased classifier. We ask the AMT workers, “What is changing in the images? (smile or smile and gender)” (see Figure 10). We generated explanations for 200 query images each, from a biased-classifier $f _ { \mathrm { B i a s e d } } )$ explainer from Section 4.4 and an unbiased classifier $( f _ { \mathrm { N o - b i a s e d } } )$ explainer (i.e., 400 hits). In all the three tasks, we collected eight votes for each task, evaluated against the ground truth, and used the majority vote for calculating accuracy.
304
+
305
+ We summarize our results in Table 5. In the first task, the annotators achieved high accuracy for the easy pair when there was a significant difference among the two explanation images, as compared to the hard pair when the two explanations can have very subtle differences. Overall, the annotators were successful in identifying the relative order between the two explanation images.
306
+
307
+ In the second task, the annotators were generally successful in correctly identifying the target class. The target class “bangs” proved to be the most difficult to identify, which was expected. The generated images for “bangs” were qualitatively, the most subtle. For the third task, the correct answer was always the target class i.e., “smile”. In the case of biased classifier explainer, the annotators selected “Smile and Gender” $12 . 5 \%$ of the times. The gradual progression made by the explainer for a biased classifier was very subtle and was changing large regions of the face as compared to the unbiased explainer. The difference is much more visible when we compare the explanation generated for the same query image for a biased and no-biased classifier, as in Figure 6. But in a realistic scenario, the no-biased classifier would not be available to compare against. Nevertheless, the annotators detected bias at roughly the same level of accuracy as our classifier (Table 3). Future work could improve upon bias detection.
308
+
309
+ Table 5: Summarizing the results of human evaluation. The $\kappa$ -statistics measure inter-rater agreement for qualitative classification of items into some mutually exclusive categories. One possible interpretation of $\kappa$ as given in Viera et al. (2005) is $< 0 . 0$ : Poor, $0 . 0 1 - 0 . 2 $ : Slight, $0 . 2 1 - 0 . 4 0$ : Fair, $0 . 4 1 - 0 . 6 0$ : Moderate, $0 . 6 1 - 0 . 8 0$ : Substantial and $0 . 8 1 - 1 . 0 0$ : Almost perfect agreement.
310
+
311
+ <table><tr><td rowspan="2">Annotation Task</td><td colspan="2">Overall</td><td colspan="3">Sub categories</td></tr><tr><td>Accuracy</td><td>K-statistic</td><td>Category</td><td>Accuracy</td><td>K-statistic</td></tr><tr><td>Task-1 (Age)</td><td>83.5%</td><td>0.41 (Moderate)</td><td>Hard</td><td>73%</td><td>0.31 (Fair)</td></tr><tr><td rowspan="2">Task-1 (Smile)</td><td></td><td></td><td>Easy</td><td>94%</td><td>0.51 (Moderate)</td></tr><tr><td>77.5%</td><td>0.28 (Fair)</td><td>Hard</td><td>66%</td><td>0.23 (Fair)</td></tr><tr><td rowspan="2">Task-2 (Identify Target Class)</td><td>77%</td><td></td><td>Easy</td><td>89.5%</td><td>0.32 (Fair)</td></tr><tr><td></td><td>0.35 (Fair)</td><td>Age</td><td>72%</td><td></td></tr><tr><td rowspan="2"></td><td></td><td></td><td>Smile</td><td>99%</td><td></td></tr><tr><td></td><td></td><td>Bangs Beard</td><td>50% 87%</td><td></td></tr><tr><td rowspan="2">Task-3 (Bias Detection)</td><td>93.75%</td><td>0.14 (Slight)</td><td>fBiased</td><td>87.5%</td><td>=</td></tr><tr><td></td><td></td><td>fNo-biased</td><td>100%</td><td>0.09 (Slight) 0.02 (Slight)</td></tr></table>
312
+
313
+ # A.5 EVALUATING CLASS DISCRIMINATION
314
+
315
+ In multi-label settings, multiple labels can be true for a given image. In this test, we evaluated the sensitivity of our generated explanations to the class being explained. We consider a classifier trained to identify multiple attributes: young, smiling, black-hair, no-beard and bangs in face images from CelebA dataset. We used our model to generate explanations while considering one of the attributes as the target. Ideally, an explanation model trained to explain a target attribute should produce explanations consistent with the query image on all the attributes beside the target. Figure 11 plots the fraction of the generated explanations, that have flipped in source attribute as compared to the query image. Each column represents one source attribute. Each row is one run of our method to explain a given target attribute.
316
+
317
+ # A.6 ABLATION STUDY
318
+
319
+ Our proposed model has three types of loss functions: adversarial loss from cGAN, KL loss, and reconstruction loss. The three losses enforce the three properties of our proposed explainer function: data consistency, compatibility with $f$ , and self-consistency, respectively. In the ablation study, we quantify the importance of each of these components by training different models, which differ in one hyper-parameter while rest are equivalent $\lambda _ { \mathrm { c G A N } } = 1$ , $\lambda _ { f } ~ = ~ 1$ and $\lambda _ { \mathrm { r e c } } ~ = ~ 1 0 0$ ). For data consistency, we evaluate Frechet Inception Distance (FID). FID score measures the visual quality ´ of the generated explanations by comparing them with the real images. We show results for two groups. In the first group, we consider real and fake images where the classifier has high confidence in presence of the target label i.e., $f ( \mathbf { x } _ { \delta } ) , f ( \mathbf { x } ) \in [ 0 . 9 , 1 . 0 ]$ . In second group, the target label is absent i.e., $f ( \mathbf { x } _ { \delta } ) , f ( \mathbf { \bar { x } } ) \in [ 0 . 0 , 0 . 1 )$ . We also report an overall score by considering all the real and generated explanations together. For compatability with $f$ we plotted the desired output of the classifier i.e., $f ( \mathbf { x } ) + \delta$ against the actual output of the classifier $f ( \mathbf { x } _ { \delta } )$ for the generated explanations. For self consistency, we calculated the Latent Space Closeness (LSC) measure and Face verification accuracy (FVA). LSC quantifies the fraction of the population in which the generated explanation is nearest to the query image than any other generated explanation in embedding space. FVA measures the percentage of the instances in which the query image and generated explanation have the same face identity as per the model trained on VGGFace2. For the ablation study, we consider the prediction task of young vs old on the CelebA dataset. Figure 12 shows the results for compatibility with $f$ . Table 6 summarizes the results for data consistency and self-consistency.
320
+
321
+ <table><tr><td colspan="3">Configuration</td><td colspan="3">Data Consistency (FID)</td><td colspan="2">Self Consistency</td></tr><tr><td>入cGAN</td><td>入f</td><td>Xrec</td><td>Present</td><td>Absent</td><td>Overall</td><td>LSC</td><td>FVA</td></tr><tr><td>0</td><td>1</td><td>100</td><td>69.7</td><td>105.7</td><td>67.2</td><td>96.1</td><td>99.8</td></tr><tr><td>1</td><td>1</td><td>100</td><td>67.5</td><td>74.4</td><td>53.4</td><td>81.6</td><td>72.2</td></tr><tr><td>10</td><td>1</td><td>100</td><td>89.4</td><td>105.2</td><td>63.0</td><td>68.0</td><td>82.7</td></tr><tr><td>100</td><td>1</td><td>100</td><td>71.6</td><td>80.6</td><td>44.26</td><td>75.3</td><td>18.0</td></tr><tr><td>1</td><td>0</td><td>100</td><td>66.2</td><td>66.2</td><td>44.9</td><td>77.2</td><td>99.4</td></tr><tr><td>1</td><td>1</td><td>100</td><td>67.5</td><td>74.4</td><td>53.4</td><td>81.6</td><td>72.2</td></tr><tr><td>1</td><td>10</td><td>100</td><td>95.5</td><td>90.4</td><td>62.4</td><td>71.83</td><td>96.8</td></tr><tr><td>1</td><td>100</td><td>100</td><td>77.4</td><td>73.1</td><td>71.2</td><td>55.4</td><td>42.23</td></tr><tr><td>1</td><td>1</td><td>0</td><td>116.2</td><td>118.9</td><td>72.2</td><td>16.6</td><td>0.0</td></tr><tr><td>1</td><td>1</td><td>1</td><td>63.0</td><td>78.6</td><td>61.6</td><td>32.2</td><td>5.5</td></tr><tr><td>1</td><td>1</td><td>10</td><td>87.6</td><td>83.6</td><td>65.7</td><td>71.5</td><td>88.8</td></tr><tr><td>1</td><td>1</td><td>100</td><td>67.5</td><td>74.4</td><td>53.4</td><td>81.6</td><td>72.2</td></tr></table>
322
+
323
+ Table 6: Our model with ablation on prediction task of young vs old on CelebA dataset. FID (Frechet ´ Inception Distance) score measures the quality of the generated explanations. Lower FID is better. LSC (Latent Space Closeness) quantifies the fraction of the population where generated explanation is nearest to the query image than any other generated explanation in embedding space. FVA (Face verification accuracy) measures percentage of the times the query image and generated explanation have same face identity as per model trained on VGGFace2. Higher LSC and FVA is better.
324
+
325
+ ![](images/356fc289dce358b1a83ad1fd5bdd90125c72a976edb7e735693852bd1ce44cc8.jpg)
326
+ Figure 7: Visual explanations generated for three prediction tasks on CelebA dataset. The first column shows the query image, followed by the corresponding generated explanations.
327
+
328
+ ![](images/0a8bb8c4bac1c096fe1a219aca970fff44fb1b4bb7830b014978205a0a48b89c.jpg)
329
+ Figure 8: Visual explanations generated for six prediction tasks on CelebA dataset. The first column shows the query image, followed by the corresponding generated explanations. The values above each image are the output of the classifier $f$ .
330
+
331
+ ![](images/dd24b8e6b78195b456f89ff7f50d7b3cc9a97f443f9d0c77feaebd00eb022dc8.jpg)
332
+ Figure 9: Plot of the expected outcome from the classifier, $f ( \mathbf { x } ) + \delta$ , against the actual response of the classifier on generated explanations, $f ( \mathbf { x } _ { \delta } )$ . The monotonically increasing trend shows a positive correlation between $f ( \mathbf { x } ) + \delta$ and $f ( \mathbf { x } _ { \delta } )$ , and thus the generated explanations are consistent with the expected condition.
333
+
334
+ ![](images/3092953d2d61882f68ca9bf6c722f823f2346edcdcfdb017972db6255f57fe3b.jpg)
335
+ Figure 10: The interface for the human evaluation done using Amazon Mechanical Turk (AMT). Task-1 evaluated if humans can detect the relative order between two explanations. Task-2 evaluated if humans can identify the target class for which our model has provided the explanations. Task-3 demonstrated that our model can help the user to identify problems like possible bias in the blackbox training.
336
+
337
+ ![](images/147bd118334d620bbfefae28c5617a7863f22206577a424363ae4afdf653dc76.jpg)
338
+ Figure 11: Each cell is the fraction of the generated explanations, that have flipped in source attribute as compared to the query image. The $\mathbf { X }$ -axis is source attribute and y-axis is the target attribute for which explanation is generated. Note: This is not a confusion matrix.
339
+
340
+ ![](images/f7080e4eddf5c7fb70acc1be1c01f662ed9cfd6d9e5753ce2fad39734b784b4b.jpg)
341
+ Figure 12: Ablation study to show the effect of KL loss term. Plot of the expected outcome from the classifier, $f ( \mathbf { x } ) + \delta$ , against the actual response of the classifier on generated explanations, $f ( \mathbf { x } _ { \delta } )$ .
md/train/H1xQVn09FX/H1xQVn09FX.md ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GANSYNTH: ADVERSARIAL NEURAL AUDIO SYNTHESIS
2
+
3
+ Jesse Engel, Kumar Krishna Agrawal, Shuo Chen, Ishaan Gulrajani, Chris Donahue,
4
+ & Adam Roberts
5
+ Google AI
6
+ Mountain View, CA 94043, USA
7
+
8
+ # ABSTRACT
9
+
10
+ Efficient audio synthesis is an inherently difficult machine learning task, as human perception is sensitive to both global structure and fine-scale waveform coherence. Autoregressive models, such as WaveNet, model local structure but have slow iterative sampling and lack global latent structure. In contrast, Generative Adversarial Networks (GANs) have global latent conditioning and efficient parallel sampling, but struggle to generate locally-coherent audio waveforms. Herein, we demonstrate that GANs can in fact generate high-fidelity and locally-coherent audio by modeling log magnitudes and instantaneous frequencies with sufficient frequency resolution in the spectral domain. Through extensive empirical investigations on the NSynth dataset, we demonstrate that GANs are able to outperform strong WaveNet baselines on automated and human evaluation metrics, and efficiently generate audio several orders of magnitude faster than their autoregressive counterparts.1
11
+
12
+ # 1 INTRODUCTION
13
+
14
+ Neural audio synthesis, training generative models to efficiently produce audio with both highfidelity and global structure, is a challenging open problem as it requires modeling temporal scales over at least five orders of magnitude ( ${ \sim } 0 . 1 \mathrm { m s }$ to ${ \sim } 1 0 0 \mathrm { s } ,$ ). Large advances in the state-of-the art have been pioneered almost exclusively by autoregressive models, such as WaveNet, which solve the scale problem by focusing on the finest scale possible (a single audio sample) and rely upon external conditioning signals for global structure (van den Oord et al., 2016). This comes at the cost of slow sampling speed, since they rely on inefficient ancestral sampling to generate waveforms one audio sample at a time. Due to their high quality, a lot of research has gone into speeding up generation, but the methods introduce significant overhead such as training a secondary student network or writing highly customized low-level kernels (van den Oord et al., 2018; Paine et al., 2016). Furthermore, since these large models operate at a fine timescale, their autoencoder variants are restricted to only modeling local latent structure due to memory constraints (Engel et al., 2017).
15
+
16
+ On the other end of the spectrum, Generative Adversarial Networks (GANs) (Goodfellow et al., 2014) have seen great recent success at generating high resolution images (Radford et al., 2016; Arjovsky et al., 2017; Gulrajani et al., 2017; Berthelot et al., 2017; Kodali et al., 2017; Karras et al., 2018a; Miyato et al., 2018). Typical GANs achieve both efficient parallel sampling and global latent control by conditioning a stack of transposed convolutions on a latent vector, The potential for audio GANs extends further, as adversarial costs have unlocked intriguing domain transformations for images that could possibly have analogues in audio (Isola et al., 2017; Zhu et al., 2017; Wolf et al., 2017; Jin et al., 2017). However, attempts to adapt image GAN architectures to generate waveforms in a straightforward manner (Donahue et al., 2019) fail to reach the same level of perceptual fidelity as their image counterparts.
17
+
18
+ ![](images/accf3d02b14949732afe525ce95cfafbfdb1ac012f0ed8ef2a6ebd8e9c9e47c1.jpg)
19
+ Figure 1: Frame-based estimation of audio waveforms. Much of sound is made up of locallycoherent waves with a local periodicity, pictured as the red-yellow sinusoid with black dots at the start of each cycle. Frame-based techniques, whether they be transposed convolutions or STFTs, have a given frame size and stride, here depicted as equal with boundaries at the dotted lines. The alignment between the two (phase, indicated by the solid black line and yellow boxes), precesses in time since the periodicity of the audio and the output stride are not exactly the same. Transposed convolutional filters thus have the difficult task of covering all the necessary frequencies and all possible phase alignments to preserve phase coherence. For an STFT, we can unwrap the phase over the $2 \pi$ boundary (orange boxes) and take its derivative to get the instantaneous radial frequency (red boxes), which expresses the constant relationship between audio frequency and frame frequency. The spectra are shown for an example trumpet note from the NSynth dataset.
20
+
21
+ # 1.1 GENERATING INSTRUMENT TIMBRES
22
+
23
+ GAN researchers have made rapid progress in image modeling by evaluating models on focused datasets with limited degrees of freedom, and gradually stepping up to less constrained domains. For example, the popular CelebA dataset (Liu et al., 2015) is restricted to faces that have been centered and cropped, removing variance in posture and pose, and providing a common reference for qualitative improvements (Radford et al., 2016; Karras et al., 2018a) in generating realistic texture and fine-scale features. Later models then built on that foundation to generalize to broader domains (Karras et al., 2018b; Brock et al., 2019).
24
+
25
+ The NSynth dataset (Engel et al., $2 0 1 7 ) ^ { 2 }$ was introduced with similar motivation for audio. Rather than containing all types of audio, NSynth consists solely of individual notes from musical instruments across a range of pitches, timbres, and volumes. Similar to CelebA, all the data is aligned and cropped to reduce variance and focus on fine-scale details, which in audio corresponds to timbre and fidelity. Further, each note is also accompanied by an array of attribute labels to enable exploring conditional generation.
26
+
27
+ The original NSynth paper introduced both autoregressive WaveNet autoencoders and bottleneck spectrogram autoencoders, but without the ability to unconditionally sample from a prior. Follow up work has explored diverse approaches including frame-based regression models (Defossez et al., 2018), inverse scattering networks (Andreux & Mallat, 2018), VAEs with perceptual priors (Esling et al., 2018), and adversarial regularization for domain transfer (Mor et al., 2019). This work builds on these efforts by introducing adversarial training and exploring effective representations for noncausal convolutional generation as typical found in GANs.
28
+
29
+ # 1.2 EFFECTIVE AUDIO REPRESENTATIONS FOR GANS
30
+
31
+ Unlike images, most audio waveforms—such as speech and music—are highly periodic. Convolutional filters trained for different tasks on this data commonly learn to form logarithmically-scaled frequency selective filter banks spanning the range of human hearing (Dieleman & Schrauwen, 2014; Zhu et al., 2016). Human perception is also highly sensitive to discontinuities and irregularities in periodic waveforms, so maintaining the regularity of periodic signals over short to intermediate timescales $( 1 \mathrm { { m s } - 1 0 0 \mathrm { { m s } ) } }$ is crucial. Figure 1 shows that when the stride of the frames does not exactly equal a waveform’s periodicity, the alignment (phase) of the two precesses over time. This condition is assured as at any time there are typically many different frequencies in a given signal. This is a challenge for a synthesis network, as it must learn all the appropriate frequency and phase combinations and activate them in just the right combination to produce a coherent waveform. This phase precession is exactly the same phenomena observed with a short-time Fourier transform (STFT), which is composed of strided filterbanks just like convolutional networks. Phase precession also occurs in situations where filterbanks overlap (window or kernel size $<$ stride).
32
+
33
+ In the middle of Figure 1, we diagram another approach to generating coherent waveforms loosely inspired by the phase vocoder (Dolson, 1986). A pure tone produces a phase that precesses. Unwrapping the phase, by adding $2 \pi$ whenever it crosses a phase discontinuity, causes the precessing phase to grow linearly. We then observe that the derivative of the unwrapped phase with respect to time remains constant and is equal to the angular difference between the frame stride and signal periodicity. This is commonly referred to as the instantaneous angular frequency, and is a time varying measure of the true signal oscillation. With a slight abuse of terminology we will simply refer to it as the instantaneous frequency (IF) (Boashash, 1992). Note that for the spectra at the bottom of Figure 1, the pure harmonic frequencies of a trumpet cause the wrapped phase spectra to oscillate at different rates while the unwrapped phase smoothly diverges and the IF spectra forms solid bands where the harmonic frequencies are present.
34
+
35
+ # 1.3 CONTRIBUTIONS
36
+
37
+ In this paper, we investigate the interplay of architecture and representation in synthesizing coherent audio with GANs. Our key findings include:
38
+
39
+ • Generating log-magnitude spectrograms and phases directly with GANs can produce more coherent waveforms than directly generating waveforms with strided convolutions.
40
+ • Estimating IF spectra leads to more coherent audio still than estimating phase.
41
+ • It is important to keep harmonics from overlapping. Both increasing the STFT frame size and switching to mel frequency scale improve performance by creating more separation between the lower harmonic frequencies. Harmonic frequencies are multiples of the fundamental, so low pitches have tightly-spaced harmonics, which can cause blurring and overlap.
42
+ • On the NSynth dataset, GANs can outperform a strong WaveNet baseline in automatic and human evaluations, and generate examples ${ \sim } 5 4 { , } 0 0 0$ times faster.
43
+ • Global conditioning on latent and pitch vectors allow GANs to generate perceptually smooth interpolation in timbre, and consistent timbral identity across pitch.
44
+
45
+ # 2 EXPERIMENTAL DETAILS
46
+
47
+ # 2.1 DATASET
48
+
49
+ We focus our study on the NSynth dataset, which contains 300,000 musical notes from 1,000 different instruments aligned and recorded in isolation. NSynth is a difficult dataset composed of highly diverse timbres and pitches, but it is also highly structured with labels for pitch, velocity, instrument, and acoustic qualities (Liu et al., 2015; Engel et al., 2017). Each sample is four seconds long, and sampled at 16kHz, giving 64,000 dimensions. As we wanted to included human evaluations on audio quality, we restricted ourselves to training on the subset of acoustic instruments and fundamental pitches ranging from MIDI 24-84 (∼32-1000Hz), as those timbres are most likely to sound natural to an average listener. This left us with 70,379 examples from instruments that are mostly strings, brass, woodwinds, and mallets. We created a new test/train 80/20 split from shuffled data, as the original split was divided along instrument type, which isn’t desirable for this task.
50
+
51
+ # 2.2 ARCHITECTURE AND REPRESENTATIONS
52
+
53
+ Taking inspiration from successes in image generation, we adapt the progressive training methods of Karras et al. (2018a) to instead generate audio spectra 3. While e search over a variety of hyperparameter configurations and learning rates, we direct readers to the original paper for an in-depth analysis (Karras et al., 2018a), and the appendix for complete details.
54
+
55
+ Briefly, the model samples a random vector $\mathbf { z }$ from a spherical Gaussian, and runs it through a stack of transposed convolutions to upsample and generate output data $x = G ( \mathbf { z } )$ , which is fed into a discriminator network of downsampling convolutions (whose architecture mirrors the generator’s) to estimate a divergence measure between the real and generated distributions (Arjovsky et al., 2017). As in Karras et al. (2018a), we use a gradient penalty (Gulrajani et al., 2017) to promote Lipschitz continuity, and pixel normalization at each layer. We also try training both progressive and nonprogressive variants, and see comparable quality in both. While it is not essential for success, we do see slightly better convergence time and sample diversity for progressive training, so for the remainder of the paper, all models are compared with progressive training.
56
+
57
+ Unlike Progressive GAN, our method involves conditioning on an additional source of information. Specifically, we append a one-hot representation of musical pitch to the latent vector, with the musically-desirable goal of achieving independent control of pitch and timbre. To encourage the generator to use the pitch information, we also add an auxiliary classification (Odena et al., 2017) loss to the discriminator that tries to predict the pitch label.
58
+
59
+ For spectral representations, we compute STFT magnitudes and phase angles using TensorFlow’s built-in implementation. We use an STFT with 256 stride and 1024 frame size, resulting in $7 5 \%$ frame overlap and 513 frequency bins. We trim the Nyquist frequency and pad in time to get an “image” of size (256, 512, 2). The two channel dimension correspond to magnitude and phase. We take the log of the magnitude to better constrain the range and then scale the magnitudes to be between -1 and 1 to match the tanh output nonlinearity of the generator network. The phase angle is also scaled to between -1 and 1 and we refer to these variants as “phase” models. We optionally unwrap the phase angle and take the finite difference as in Figure 1; we call the resulting models “instantaneous frequency” (“IF”) models. We also find performance is sensitive to having sufficient frequency resolution at the lower frequency range. Maintaining $7 5 \%$ overlap we are able to double the STFT frame size and stride, resulting in spectral images with size (128, 1024, 2), which we refer to as high frequency resolution, $\mathbf { \ddot { \mathbf { \mathbf { \mathbf { \mathbf { \mathbf { \mathbf { \mathbf } } } } } } } } + \mathbf { \mathbf { \mathbf { H } } } \mathbf { \boldsymbol { \mathbf { \boldsymbol { \mathbf { \mathit { \mathbf { \mathbf { \mathbf } } } } } } } }$ , variants. Lastly, to provide even more separation of lower frequencies we transform both the log magnitudes and instantaneous frequencies to a mel frequency scale without dimensional compression (1024 bins), which we refer to as “IF-Mel” variants. To convert back to linear STFTs we just use the approximate inverse linear transformation, which, perhaps surprisingly does not harm audio quality significantly.
60
+
61
+ It is important for us to compare against strong baselines, so we adapt WaveGAN (Donahue et al., 2019), the current state of the art in waveform generation with GANs, to accept pitch conditioning and retrain it on our subset of the NSynth dataset. We also independently train our own waveform generating GANs off the progressive codebase and our best models achieve similar performance to WaveGAN without progressive training, so we opt to primarily show numbers from WaveGAN instead (see appendix Table 2 for more details).
62
+
63
+ Beyond GANs, WaveNet (van den Oord et al., 2016) is currently the state of the art in generative modeling of audio. Prior work on the NSynth dataset used an WaveNet autoencoder to interpolate between sounds (Engel et al., 2017), but is not a generative model as it requires conditioning on the original audio. Thus, we create strong WaveNet baselines by adapting the architecture to accept the same one-hot pitch conditioning signal as the GANs. We train variants using both a categorical 8-bit mu law and 16-bit mixture of logistics for the output distributions, but find that the 8-bit model is more stable and outperforms the 16-bit model (see appendix Table 2 for more details).
64
+
65
+ # 3 METRICS
66
+
67
+ Evaluating generative models is itself a difficult problem: because our goals (perceptually-realistic audio generation) are hard to formalize, the most common evaluation metrics tend to be heuristic and have “blind spots” (Theis et al., 2016). To mitigate this, we evaluate all of our models against a diverse set of metrics, each of which captures a distinct aspect of model performance. Our evaluation metrics are as follows:
68
+
69
+ • Human Evaluation We use human evaluators as our gold standard of audio quality because it is notoriously hard to measure in an automated manner. In the end, we are interested in training networks to synthesize coherent waveforms, specifically because human perception is extremely sensitive to phase irregularities and these irregularities are disruptive to a listener. We used Amazon Mechanical Turk to perform a comparison test on examples from all models presented in Table 1 (this includes the hold-out dataset). The participants were presented with two 4s examples corresponding to the same pitch. On a five-level Likert scale, the participants evaluate the statement ”Sample A has better audio quality / has less audio distortions than Sample $B ^ { \prime \prime }$ . For the study, we collected 3600 ratings and each model is involved in 800 comparisons.
70
+ • Number of Statistically-Different Bins (NDB) We adopt the metric proposed by Richardson & Weiss (2018) to measure the diversity of generated examples: the training examples are clustered into $k = 5 0$ Voronoi cells by $k$ -means in log-spectrogram space, the generated examples are also mapped into the same space and are assigned to the nearest cell. NDB is reported as the number of cells where the number of training examples is statistically significantly different from the number of generated examples by a two-sample Binomial test.
71
+ • Inception Score (IS) (Salimans et al., 2016) propose a metric for evaluating GANs which has become a de-facto standard in GAN literature (Gulrajani et al., 2017; Miyato et al., 2018; Karras et al., 2018a). Generated examples are run through a pretrained Inception classifier and the Inception Score is defined as the mean KL divergence between the imageconditional output class probabilities and the marginal distribution of the same. IS penalizes models whose examples aren’t each easily classified into a single class, as well as models whose examples collectively belong to only a few of the possible classes. Though we still call our metric “IS” for consistency, we replace the Inception features with features from a pitch classifier trained on spectrograms of our acoustic NSynth dataset.
72
+ • Pitch Accuracy (PA) and Pitch Entropy (PE) Because the Inception Score can conflate models which don’t produce distinct pitches and models which produce only a few pitches, we also separately measure the accuracy of the same pretrained pitch classifier on generated examples (PA) and the entropy of its output distribution (PE).
73
+ • Frechet Inception Distance (FID) ´ (Heusel et al., 2017) propose a metric for evaluating GANs based on the 2-Wasserstein (or Frechet) distance between multivariate Gaussians fit ´ to features extracted from a pretrained Inception classifier and show that this metric correlates with perceptual quality and diversity on synthetic distributions. As with Inception Score, we use pitch-classifier features instead of Inception features.
74
+
75
+ # 4 RESULTS
76
+
77
+ Table 1 presents a summary of our results on all model and representation variants. Our most discerning measure of audio quality, human evaluation, shows a clear trend, summarized in Figure 2. Quality decreases as output representations move from IF-Mel, IF, Phase, to Waveform. The highest quality model, IF-Mel, was judged comparably but slightly inferior to real data. The WaveNet baseline produces high-fidelity sounds, but occasionally breaks down into feedback and self oscillation, resulting in a score that is comparable to the IF GANs.
78
+
79
+ While there is no a priori reason that sample diversity should correlate with audio quality, we indeed find that NDB follows the same trend as the human evaluation. Additionally, high frequency resolution improves the NDB score across models types. The WaveNet baseline receives the worst NDB score. Even though the generative model assigns high likelihood to all the training data, the autoregressive sampling itself has a tendency gravitate to the same type of oscillation for each given pitch conditioning, leading to an extreme lack of diversity. Histograms of the sample distributions showing peaky distributions for the different models can be found in the appendix.
80
+
81
+ Table 1: Metrics for different models. $\tilde { \mathbf { \Gamma } } + \mathrm { H } ^ { \prime \prime }$ stands for higher frequency resolution, and ”Real Data” is drawn from the test set.
82
+
83
+ <table><tr><td colspan="6">Human Eval</td></tr><tr><td>Examples</td><td>(wins)</td><td>NDB</td><td>FID</td><td>IS</td><td>PA</td><td>PE</td></tr><tr><td>Real Data</td><td>549</td><td>2.2</td><td>13</td><td>47.1</td><td>98.2</td><td>0.22</td></tr><tr><td>IF-Mel + H</td><td>485</td><td>29.3</td><td>167</td><td>38.1</td><td>97.9</td><td>0.40</td></tr><tr><td>IF+H</td><td>308</td><td>36.0</td><td>104</td><td>41.6</td><td>98.3</td><td>0.32</td></tr><tr><td>Phase +H</td><td>225</td><td>37.6</td><td>592</td><td>36.2</td><td>97.6</td><td>0.44</td></tr><tr><td>IF-Mel</td><td>479</td><td>37.0</td><td>600</td><td>29.6</td><td>94.1</td><td>0.63</td></tr><tr><td>IF</td><td>283</td><td>37.0</td><td>708</td><td>36.3</td><td>96.8</td><td>0.44</td></tr><tr><td>Phase</td><td>203</td><td>41.4</td><td>687</td><td>24.4</td><td>94.4</td><td>0.77</td></tr><tr><td>WaveNet</td><td>359</td><td>45.9</td><td>320</td><td>29.1</td><td>92.7</td><td>0.70</td></tr><tr><td>WaveGAN</td><td>216</td><td>43.0</td><td>461</td><td>13.7</td><td>82.7</td><td>1.40</td></tr></table>
84
+
85
+ ![](images/5c79b8177204bb26d801ee19df8fafbb20f52480114e5262b09047b8ca9bab06.jpg)
86
+ Figure 2: Number of wins on pair-wise comparison across different output representations and baselines. Ablation comparing highest performing models of each type. Higher scores represent better perceptual quality to participants. The ranking observed here correlates well with the evaluation on quantitative metrics as in Table 1.
87
+
88
+ FID provides a similar story to the first two metrics with significantly lower scores for for IF models with high frequency resolution. Comparatively, Mel scaling has much less of an effect on the FID then it does in the listener study. Phase models have high FID, even at high frequency resolution, reflecting their poor sample quality.
89
+
90
+ Many of the models do quite well on the classifier metrics of IS, Pitch Accuracy, and Pitch Entropy, because they have explicit conditioning telling them what pitches to generate. All of the high-resolution models actually generate examples classified with similar accuracy to the real data. As this accuracy and entropy can be a strong function of the distribution of generated examples, which most certainly does not match the training distribution due to mode collapse and other issues, there is little discriminative information to gain about sample quality from differences among such high scores. The metrics do provide a rough measure of which models are less reliably generating classifiable pitches, which seems to be the low frequency models to some extent and the baselines.
91
+
92
+ # 5 QUALITATIVE ANALYSIS
93
+
94
+ While we do our best to visualize qualitative audio concepts, we highly recommend the reader to listen to the accompanying audio examples provided at https://goo.gl/magenta/ gansynth-examples.
95
+
96
+ ![](images/fc64b1b727defb1a0bb619b511a6b99b0a1e06fc4af6257c01419b3b480e8021.jpg)
97
+ Figure 3: Phase coherence. Examples are selected to be roughly similar between the models for illustrative purposes. The top row shows the waveform modulo the fundamental periodicity of the note (MIDI C60), for 1028 examples taken in the middle of the note. Notice that the real data completely overlaps itself as the waveform is extremely periodic. The WaveGAN and PhaseGAN, however, have many phase irregularities, creating a blurry web of lines. The IFGAN is much more coherent, having only small variations from cycle-to-cycle. In the Rainbowgrams below, the real data and IF models have coherent waveforms that result in strong consistent colors for each harmonic, while the PhaseGAN has many speckles due to phase discontinuities, and the WaveGAN model is quite irregular.
98
+
99
+ # 5.1 PHASE COHERENCE
100
+
101
+ Figure 3 visualizes the phase coherence of examples from different GAN variants. It is clear from the waveforms at the top, which are wrapped at the fundamental frequency, that the real data and IF models produce waveforms that are consistent from cycle-to-cycle. The PhaseGAN has some phase discontinuities, while the WaveGAN is quite irregular. Below we use Rainbowgrams (Engel et al., 2017) to depict the log magnitude of the frequencies as brightness and the IF as the color on a rainbow color map. This visualization helps to see clear phase coherence of the harmonics in the real data and IFGAN by the strong consistent colors. In contrast, the PhaseGAN discontinuities appear as speckled noise, and the WaveGAN appears largely incoherent.
102
+
103
+ # 5.2 INTERPOLATION
104
+
105
+ As discussed in the introduction, GANs also allow conditioning on the same latent vector the entire sequence, as opposed to only short subsequences for memory intensive autoregressive models like WaveNet. WaveNet autoencoders, such as ones in (Engel et al., 2017), learn local latent codes that control generation on the scale of milliseconds but have limited scope, and have a structure of their own that must be modelled and does not fit a compact prior. In Figure 4 we take a pretrained WaveNet autoencoder 5 and compare interpolating between examples in the raw waveform (top), the distributed latent code of a WaveNet autoencoder, and the global code of an IF-Mel GAN.
106
+
107
+ Interpolating the waveform is perceptually equivalent to mixing between the amplitudes of two distinct sounds. WaveNet improves upon this for the two notes by mixing in the space of timbre, but the linear interpolation does not correspond to the complex prior on latents, and the intermediate sounds have a tendency to fall apart, oscillate and whistle, which are the natural failure modes for a WaveNet model. However, the GAN model has a spherical gaussian prior which is decoded to produce the entire sound, and spherical interpolation stays well-aligned with the prior. Thus, the perceptual change during interpolation is smooth and all intermediate latent vectors are decoded to produce sounds without additional artifacts. As a more musical example, in the audio examples, we interpolate the timbre between 15 random points in latent space while using the pitches from the prelude to Bach’s Suite No. 1 in G major 6. As seen in appendix Figure 7, the timbre of the sounds morph smoothly between many instruments while the pitches consistently follow the composed piece.
108
+
109
+ ![](images/25dc0d5e17ebb314d71d4e5cf63cedff4e2f3bee062c8a20902a3af0ac6213bf.jpg)
110
+ Figure 4: Global interpolation. Examples available for listening4. Interpolating between waveforms perceptually results in crossfading the volumes of two distinct sounds (rainbowgrams at top). The WaveNet autoencoder (middle) only has local conditioning distributed in time, and no compact prior over those time series, so linear interpolation ventures off the true prior / data manifold, and produces in-between sounds that are less realistic examples and feature the default failure mode of autoregressive wavenets (feedback harmonics). Meanwhile, the IF-Mel GAN (bottom) has global conditioning so interpolating in perceptual attributes while staying along the prior at all intermediate points, so they produce high-fidelity audio examples like the endpoints.
111
+
112
+ # 5.3 CONSISTENT TIMBRE ACROSS PITCH
113
+
114
+ While timbre slightly varies for a natural instrument across register, on the whole it remains consistent, giving the instrument its unique character. In the audio examples 7, we fix the latent conditioning variable and generate examples by varying the pitch conditioning over five octaves. It’s clear that the timbral identity of the GAN remains largely intact, creating a unique instrument identity for the given point in latent space. As seen in appendix Figure 7, the Bach prelude rendered with a single latent vector has a consistent harmonic structure across a range of pitches.
115
+
116
+ # 6 FAST GENERATION
117
+
118
+ One of the advantages of GANs with upsampling convolutions over autoregressive models is that the both the training and generation can be processed in parallel for the entire audio sample. This is quite amenable to modern GPU hardware which is often I/O bound with iterative autoregressive algorithms. This can be seen when we synthesize a single four second audio sample on a TitanX GPU and the latency to completion drops from 1077.53 seconds for the WaveNet baseline to 20 milliseconds for the IF-Mel GAN making it around 53,880 times faster. Previous applications of WaveNet autoencoders trained on the NSynth dataset for music performance relied on prerendering all possible sounds for playback due to the long synthesis latency 8. This work opens up the intriguing possibility for realtime neural network audio synthesis on device, allowing users to explore a much broader pallete of expressive sounds.
119
+
120
+ # 7 RELATED WORK
121
+
122
+ Much of the work on deep generative models for audio tends to focus on speech synthesis (van den Oord et al., 2018; Sotelo et al., 2017; Wang et al., 2017). These datasets require handling variable length conditioning (phonemes/text) and audio, and often rely on recurrent and/or autoregressive models for variable length inputs and outputs. It would be interesting to compare adversarial audio synthesis to these methods, but we leave this to future work as adapting GANs to use variable-length conditioning or recurrent generators is a non-trivial extension of the current work.
123
+
124
+ In comparison to speech, audio generation for music is relatively under-explored. van den Oord et al. (2016) and Mehri et al. (2017) propose autoregressive models and demonstrate their ability to synthesize musical instrument sounds, but these suffer from the aforementioned slow generation. Donahue et al. (2019) first applied GANs to audio generation with coherent results, but fell short of the audio fidelity of autoregressive likelihood models.
125
+
126
+ Our work also builds on multiple recent advances in GAN literature. Gulrajani et al. (2017) propose a modification to the loss function of GANs and demonstrate improved training stability and architectural robustness. Karras et al. (2018a) further introduce progressive training, in which successive layers of the generator and discriminator are learned in a curriculum, leading to improved generation quality given a limited training time. They also propose a number of architectural tricks to further improve quality, which we employ in our best models.
127
+
128
+ The NSynth dataset was first introduced as a “CelebA of audio” (Liu et al., 2015; Engel et al., 2017), and used WaveNet autoencoders to interpolate between timbres of musical instruments, but with very slow sampling speeds. Mor et al. (2019) expanded on this work by incoporating an adversarial domain confusion loss to achieve timbre transformations between a wide range of audio sources. Defossez et al. (2018) achieve significant sampling speedups $( \sim 2 , 5 0 0 \mathrm { x } )$ over wavenet autoencoders by training a frame-based regression model to map from pitch and instrument labels to raw waveforms. They consider a unimodal likelihood regression loss in log spectrograms and backpropagate through the STFT, which yeilds good frequency estimation, but provides no incentive to learn phase coherency or handle multimodal distributions. Their architecture also requires a large amount of channels, slowing down sample generation and training.
129
+
130
+ # 8 CONCLUSION
131
+
132
+ By carefully controlling the audio representation used for generative modeling, we have demonstrated high-quality audio generation with GANs on the NSynth dataset, exceeding the fidelity of a strong WaveNet baseline while generating samples tens of thousands of times faster. While this is a major advance for audio generation with GANs, this study focused on a specific controlled dataset, and further work is needed to validate and expand it to a broader class of signals including speech and other types of natural sound. This work also opens up possible avenues for domain transfer and other exciting applications of adversarial losses to audio. Issues of mode collapse and diversity common to GANs exist for audio as well, and we leave it to further work to consider combining adversarial losses with encoders or more straightforward regression losses to better capture the full data distribution.
133
+
134
+ # ACKNOWLEDGMENTS
135
+
136
+ We would like to thank Rif A. Saurous and David Berthelot for fruitful discussions and help in reviewing the manuscript.
137
+
138
+ # REFERENCES
139
+
140
+ Mathieu Andreux and Stephane Mallat. Music generation and transformation with moment matching-scattering inverse networks. In International Society for Music Information Retrevial Conference, 2018. URL http://ismir2018.ircam.fr/doc/pdfs/131_Paper.pdf.
141
+
142
+ Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein generative adversarial networks. ´ In Doina Precup and Yee Whye Teh (eds.), Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pp. 214–223, International Convention Centre, Sydney, Australia, 06–11 Aug 2017. PMLR. URL http:// proceedings.mlr.press/v70/arjovsky17a.html.
143
+
144
+ David Berthelot, Thomas Schumm, and Luke Metz. BEGAN: Boundary equilibrium generative adversarial networks. arXiv preprint arXiv:1703.10717, 2017.
145
+
146
+ Boualem Boashash. Estimating and interpreting the instantaneous frequency of a signal. Proceedings of the IEEE, 80(4):540–568, 1992.
147
+
148
+ Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale GAN training for high fidelity natural image synthesis. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ B1xsqj09Fm.
149
+
150
+ Alexandre Defossez, Neil Zeghidour, Nicolas Usunier, Leon Bottou, and Francis Bach. Sing: Symbol-to-instrument neural generator. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems 31, pp. 9041–9051. Curran Associates, Inc., 2018. URL http://papers.nips.cc/paper/ 8118-sing-symbol-to-instrument-neural-generator.pdf.
151
+
152
+ Sander Dieleman and Benjamin Schrauwen. End-to-end learning for music audio. In ICASSP, pp. 6964–6968, 2014.
153
+
154
+ Mark Dolson. The phase vocoder: A tutorial. Computer Music Journal, 10(4):14–27, 1986.
155
+
156
+ Chris Donahue, Julian McAuley, and Miller Puckette. Adversarial audio synthesis. In ICLR, 2019.
157
+
158
+ Jesse Engel, Cinjon Resnick, Adam Roberts, Sander Dieleman, Douglas Eck, Karen Simonyan, and Mohammad Norouzi. Neural audio synthesis of musical notes with WaveNet autoencoders. In ICML, 2017.
159
+
160
+ Philippe Esling, Axel Chemla-Romeu-Santos, and Adrien Bitton. Bridging audio analysis, perception and synthesis with perceptually-regularized variational timbre spaces. In Proceedings of the 19th International Society for Music Information Retrieval Conference, ISMIR 2018, Paris, France, September 23-27, 2018, pp. 175–181, 2018. URL http://ismir2018.ircam.fr/ doc/pdfs/219_Paper.pdf.
161
+
162
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In NIPS, pp. 2672–2680, 2014.
163
+
164
+ Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron C Courville. Improved training of Wasserstein GANs. In NIPS, pp. 5767–5777, 2017.
165
+
166
+ Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. GANs trained by a two time-scale update rule converge to a local Nash equilibrium. In NIPS, pp. 6626–6637. 2017.
167
+
168
+ Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. In CVPR, 2017.
169
+
170
+ Yanghua Jin, Jiakai Zhang, Minjun Li, Yingtao Tian, Huachun Zhu, and Zhihao Fang. Towards the automatic anime characters creation with generative adversarial networks. arXiv preprint arXiv:1708.05509, 2017.
171
+
172
+ Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of GANs for improved quality, stability, and variation. In ICLR, 2018a.
173
+
174
+ Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. CoRR, abs/1812.04948, 2018b. URL http://arxiv.org/abs/1812. 04948.
175
+
176
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014. URL http://arxiv.org/abs/1412.6980.
177
+
178
+ Naveen Kodali, Jacob Abernethy, James Hays, and Zsolt Kira. On convergence and stability of gans. arXiv preprint arXiv:1705.07215, 2017.
179
+
180
+ Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), 2015.
181
+
182
+ Soroush Mehri, Kundan Kumar, Ishaan Gulrajani, Rithesh Kumar, Shubham Jain, Jose Sotelo, Aaron Courville, and Yoshua Bengio. SampleRNN: An unconditional end-to-end neural audio generation model. In ICLR, 2017.
183
+
184
+ Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. In ICLR, 2018.
185
+
186
+ Noam Mor, Lior Wolf, Adam Polyak, and Yaniv Taigman. Autoencoder-based music translation. In International Conference on Learning Representations, 2019. URL https://openreview. net/forum?id ${ . } = { }$ HJGkisCcKm.
187
+
188
+ Augustus Odena, Christopher Olah, and Jonathon Shlens. Conditional image synthesis with auxiliary classifier gans. In ICML, 2017.
189
+
190
+ Tom Le Paine, Pooya Khorrami, Shiyu Chang, Yang Zhang, Prajit Ramachandran, Mark A Hasegawa-Johnson, and Thomas S Huang. Fast WaveNet generation algorithm. arXiv preprint arXiv:1611.09482, 2016.
191
+
192
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In ICLR, 2016.
193
+
194
+ Eitan Richardson and Yair Weiss. On GANs and GMMs. CoRR, abs/1805.12462, 2018. URL http://arxiv.org/abs/1805.12462.
195
+
196
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In NIPS, pp. 2234–2242, 2016.
197
+
198
+ Tim Salimans, Andrej Karpathy, Xi Chen, and Diederik P. Kingma. Pixelcnn $^ { + + }$ : Improving the pixelcnn with discretized logistic mixture likelihood and other modifications. CoRR, abs/1701.05517, 2017. URL http://arxiv.org/abs/1701.05517.
199
+
200
+ Jose Sotelo, Soroush Mehri, Kundan Kumar, Joao Felipe Santos, Kyle Kastner, Aaron Courville, and Yoshua Bengio. Char2wav: End-to-end speech synthesis. 2017.
201
+
202
+ Lucas Theis, Aaron van den Oord, and Matthias Bethge. A note on the evaluation of generative ¨ models. In ICLR, 2016.
203
+
204
+ Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, ¨ Nal Kalchbrenner, Andrew W Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. In SSW, pp. 125, 2016.
205
+
206
+ Aaron van den Oord, Yazhe Li, Igor Babuschkin, Karen Simonyan, Oriol Vinyals, Koray Kavukcuoglu, George van den Driessche, Edward Lockhart, Luis Cobo, Florian Stimberg, Norman Casagrande, Dominik Grewe, Seb Noury, Sander Dieleman, Erich Elsen, Nal Kalchbrenner, Heiga Zen, Alex Graves, Helen King, Tom Walters, Dan Belov, and Demis Hassabis. Parallel WaveNet: Fast high-fidelity speech synthesis. In Jennifer Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 3918–3926, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018. PMLR. URL http://proceedings.mlr.press/v80/oord18a.html.
207
+
208
+ Yuxuan Wang, RJ Skerry-Ryan, Daisy Stanton, Yonghui Wu, Ron J Weiss, Navdeep Jaitly, Zongheng Yang, Ying Xiao, Zhifeng Chen, Samy Bengio, et al. Tacotron: Towards end-to-end speech synthesis. In INTERSPEECH, 2017.
209
+
210
+ Lior Wolf, Yaniv Taigman, and Adam Polyak. Unsupervised creation of parameterized avatars. CoRR, abs/1704.05693, 2017.
211
+
212
+ Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In ICCV, 2017.
213
+
214
+ Zhenyao Zhu, Jesse H Engel, and Awni Y Hannun. Learning multiscale features directly fromwaveforms. CoRR, vol. abs/1603.09509, 2016.
215
+
216
+ ![](images/db57bbd09e2d44176addffb284990fd4bbc485158a2ac319388becbd9ad155a9.jpg)
217
+ A MEASURING DIVERSITY ACROSS GENERATED EXAMPLES
218
+
219
+ ![](images/222a79b2ad32e269faae27441b4b98334300fafec679b2fc2fb77707f1eee842.jpg)
220
+ Figure 5: NDB bin proportions for the IF-Mel $+ \textrm { H }$ model and the WaveGAN baseline (evaluated with examples of pitch 60).
221
+ Figure 6: NDB bin proportions for the WaveNet baseline (evaluated with examples of pitch 60).
222
+
223
+ # B TIMBRAL SIMILARITY ACROSS PITCH
224
+
225
+ Bach Prelude -- Single Latent Vector
226
+
227
+ ![](images/7654cd0fadcb374b77e36efbaba7b697b7261985788cd5dd3775bc522c3e4059.jpg)
228
+ Figure 7: The first 20 seconds (10 seconds per a row) of the prelude to Bach’s Suite No. 1 in G major 9, for pitches synthesized with a single latent vector (top), and with spherical interpolation in latent space (bottom). The timbre is constant for a single latent vector, shown by the consistency of the upper harmonic structure, while it varies dramatically as the latent vector changes. Listening examples are provided at https://goo.gl/magenta/gansynth-examples
229
+
230
+ C BASELINE MODEL COMPARISONS
231
+
232
+ Table 2: Comparison of models generating waveforms directly. Our Waveform GAN baseline performs similar to the WaveGAN baseline, but the progressive training does not improve performance, so we only compare to the WaveGAN baseline for the paper. The 8-bit categorical WaveNet outperforms the 16-bit mixture of logistics, likely due to the decreased stability of the 16-bit model with only pitch conditioning, despite the increased fidelity.
233
+
234
+ <table><tr><td>Examples</td><td>NDB</td><td>FID</td><td>IS</td><td>PA</td><td>PE</td></tr><tr><td>WaveGAN</td><td>43.0</td><td>461</td><td>13.7</td><td>82.7</td><td>1.40</td></tr><tr><td>Waveform NoProg</td><td>48.2</td><td>447</td><td>14.8</td><td>96.3</td><td>1.61</td></tr><tr><td>Waveform Prog</td><td>45.0</td><td>375</td><td>2.5</td><td>56.7</td><td>3.59</td></tr><tr><td>WaveNet 8-bit</td><td>44.8</td><td>320</td><td>29.1</td><td>92.7</td><td>0.70</td></tr><tr><td>WaveNet 16-bit</td><td>45.9</td><td>656</td><td>9.5</td><td>64.6</td><td>1.71</td></tr></table>
235
+
236
+ # D TRAINING DETAILS
237
+
238
+ GAN architectures were directly adapted from an open source implementation in Tensorflow 10. Full details are given in Table 3, including adding a pitch classifier to the end of the discriminator as in AC-GAN. All models were trained with the ADAM optimizer (Kingma & Ba, 2014). We sweep over learning rates (2e-4, 4e-4, 8e-4) and weights of the auxiliary classifier loss (0.1, 1.0, 10), and find that for all variants (spectral representation, progressive/no progressive, frequency resolution) a learning rate of 8e-4 and classifier loss of 10 perform the best.
239
+
240
+ As in the original progressive GAN paper, both networks use box upscaling/downscaling and the generators use pixel normalization,
241
+
242
+ $$
243
+ x = x _ { n h w c } / ( \frac { 1 } { C } \sum _ { c } x _ { n h w c } ^ { 2 } ) ^ { 0 . 5 }
244
+ $$
245
+
246
+ where $n , h , w$ , and $c$ refer to the batch, height, width, and channel dimensions respectively, $x$ is the activations, and $C$ is the total number of channels. The discriminator also appends the standard deviation of the minibatch activations as a scalar channel near the end of the convolutional stack as seen in Table 3.
247
+
248
+ Since we find it helpful to use a Tanh output nonlinearity for the generator, we normalize real data before passing to the discriminator. We measure the maximum range over 100 examples and independently shift and scale the log-magnitudes and phases to [-0.8, 0.8] to allow for outliers and use more of the linear regime of the Tanh nonlinearity.
249
+
250
+ We train each GAN variant for 4.5 days on a single V100 GPU, with a batch size of 8. For nonprogressive models, this equates to training on ${ \sim } 5 \mathbf { M }$ examples. For progressive models, we train on 1.6M examples per a stage (7 stages), 800k during alpha blending and $8 0 0 \mathrm { k }$ after blending. At the last stage we continue training until the 4.5 days completes. Because the earlier stages train faster, the progressive models train on ${ \sim } 1 1 \mathbf { M }$ examples.
251
+
252
+ For the WaveNet baseline, we also adapt the open source Tensorflow implementation 11. The decoder is composed of 30 layers of dilated convolution, each of 512 channels and receptive field of 3, and each with a 1x1 convolution skip connection to the output. The layers are divided into 3 stacks of 10, with dilation in each stack increasing from $2 ^ { 0 }$ to $2 ^ { 9 }$ , and then repeating. We replace the audio encoder stack with a conditioning stack operating on a one-hot pitch conditioning signal distributed in time (3 seconds on, 1 second off). The conditioning stack is 5 layers of dilated convolution, increasing to $2 ^ { 5 }$ , and then 3 layers of regular convolution, all with 512 channels. This conditioning signal is then passed through a 1x1 convolution for each layer of the decoder and added to the output of each layer, as in other implementations of WaveNet conditioning. For the 8-bit model we use mulaw encoding of the audio and a categorical loss, while for the 16-bit model we use a quantized mixture of 10 logistics (Salimans et al., 2017). WaveNets converged to $1 5 0 \mathrm { k }$ iterations in 2 days with 32 V100 GPUs trained with synchronous SGD with batch size 1 per GPU, for a total batch size of 32.
253
+
254
+ Table 3: Model architecture for hi-frequency resolution. Low frequency resolution starts with a width of 4, and height of 8, but is otherwise the same. ”PN” stands for pixel norm, and ”LReLU” stands for leaky rectified linear unit, with a slope of 0.2. The latent vector Z has 256 dimensions and the pitch conditioning is a 61 dimensional one-hot vector.
255
+
256
+ <table><tr><td>Generator</td><td>Output Size</td><td>kwidth</td><td>kHeight</td><td>kFilters</td><td>Nonlinearity</td></tr><tr><td>concat(Z, Pitch)</td><td>(1,1,317)</td><td>1</td><td>1</td><td>1</td><td>1</td></tr><tr><td>conv2d</td><td>(2,16,256)</td><td>2</td><td>16</td><td>256</td><td>PN(LReLU)</td></tr><tr><td>conv2d</td><td>(2, 16,256)</td><td>3</td><td>3</td><td>256</td><td>PN(LReLU)</td></tr><tr><td>upsample 2x2</td><td>(4,32,256)</td><td></td><td></td><td></td><td></td></tr><tr><td>conv2d</td><td>(4, 32, 256)</td><td>3</td><td>3</td><td>256</td><td>PN(LReLU)</td></tr><tr><td>conv2d</td><td>(4, 32,256)</td><td>3</td><td>3</td><td>256</td><td>PN(LReLU)</td></tr><tr><td>upsample 2x2</td><td>(8, 64,256)</td><td>1</td><td></td><td></td><td></td></tr><tr><td>conv2d</td><td>(8, 64,256)</td><td>3</td><td>3</td><td>256</td><td>PN(LReLU)</td></tr><tr><td>conv2d</td><td>(8, 64,256)</td><td>3</td><td>3</td><td>256</td><td>PN(LReLU)</td></tr><tr><td>upsample 2x2</td><td>(16,128, 256)</td><td></td><td></td><td>-</td><td></td></tr><tr><td>conv2d</td><td>(16,128, 256)</td><td>3</td><td>3</td><td>256</td><td>PN(LReLU)</td></tr><tr><td>conv2d</td><td>(16,128,256)</td><td>3</td><td>3</td><td>256</td><td>PN(LReLU)</td></tr><tr><td>upsample 2x2</td><td>(32, 256,256)</td><td>=</td><td>1</td><td></td><td></td></tr><tr><td>conv2d</td><td>(32,256, 128)</td><td>3</td><td>3</td><td>128</td><td>PN(LReLU)</td></tr><tr><td>conv2d</td><td>(32,256, 128)</td><td>3</td><td>3</td><td>128</td><td>PN(LReLU)</td></tr><tr><td>upsample 2x2</td><td>(64,512, 128)</td><td></td><td></td><td></td><td></td></tr><tr><td>conv2d</td><td>(64, 512, 64)</td><td>3</td><td>3</td><td>64</td><td>PN(LReLU)</td></tr><tr><td>conv2d</td><td>(64,512, 64)</td><td>3</td><td>3</td><td>64</td><td>PN(LReLU)</td></tr><tr><td>upsample 2x2</td><td>(128,1024, 64)</td><td>=</td><td>■</td><td>1</td><td></td></tr><tr><td>conv2d</td><td>(128,1024,32)</td><td>3</td><td>3</td><td>32</td><td>PN(LReLU)</td></tr><tr><td>conv2d</td><td>(128,1024,32)</td><td>3</td><td>3</td><td>32</td><td>PN(LReLU)</td></tr><tr><td>generator output</td><td>(128,1024,2)</td><td>1</td><td>1</td><td>2</td><td>Tanh</td></tr><tr><td>Discriminator</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>image</td><td>(128,1024,2)</td><td>1</td><td></td><td>1</td><td></td></tr><tr><td>conv2d</td><td>(128,1024,32)</td><td>1</td><td>1</td><td>32</td><td></td></tr><tr><td>conv2d</td><td>(128,1024,32)</td><td>3</td><td>3</td><td>32</td><td>LReLU</td></tr><tr><td>conv2d</td><td>(128,1024, 32)</td><td>3</td><td>3</td><td>32</td><td>LReLU</td></tr><tr><td>downsample 2x2</td><td>(64,512,32)</td><td></td><td></td><td>1</td><td></td></tr><tr><td>conv2d</td><td>(64, 512, 64)</td><td>3</td><td>3</td><td>64</td><td>LReLU</td></tr><tr><td>conv2d</td><td>(64, 512, 64)</td><td>3</td><td>3</td><td>64</td><td>LReLU</td></tr><tr><td>downsample 2x2</td><td>(32,256,64)</td><td>■</td><td></td><td>=</td><td></td></tr><tr><td>conv2d</td><td>(32, 256,128)</td><td>3</td><td>3</td><td>128</td><td>LReLU</td></tr><tr><td>conv2d</td><td>(32,256, 128)</td><td>3</td><td>3</td><td>128</td><td>LReLU</td></tr><tr><td>downsample 2x2</td><td>(16,128, 128)</td><td>1</td><td></td><td>1</td><td></td></tr><tr><td>conv2d</td><td>(16,128,256)</td><td>3</td><td>3</td><td>256</td><td>LReLU</td></tr><tr><td>conv2d</td><td>(16,128, 256)</td><td>3</td><td>3</td><td>256</td><td>LReLU</td></tr><tr><td>downsample 2x2</td><td>(8, 64,256)</td><td>-</td><td>1</td><td>1</td><td></td></tr><tr><td>conv2d</td><td>(8,64,256)</td><td>3</td><td>3</td><td>256</td><td>LReLU</td></tr><tr><td>conv2d</td><td>(8, 64,256)</td><td>3</td><td>3</td><td>256</td><td>LReLU</td></tr><tr><td>downsample 2x2</td><td>(4,32,256)</td><td></td><td>1</td><td></td><td></td></tr><tr><td>conv2d</td><td>(4,32,256)</td><td>3</td><td>3</td><td>256</td><td>LReLU</td></tr><tr><td>conv2d</td><td>(4,32,256)</td><td>3</td><td>3</td><td>256</td><td>LReLU</td></tr><tr><td>downsample 2x2</td><td>(2, 16,256)</td><td>1</td><td>■</td><td>1</td><td>1</td></tr><tr><td>concat(x,minibatch std.)</td><td>(2,16,257)</td><td></td><td></td><td>1</td><td></td></tr><tr><td>conv2d</td><td>(2,16,256)</td><td>3</td><td>3</td><td>256</td><td>LReLU</td></tr><tr><td>conv2d</td><td>(2,16,256)</td><td>3</td><td>3</td><td>256</td><td>LReLU</td></tr><tr><td>pitch classifier</td><td>(1,1,61)</td><td></td><td></td><td>61</td><td>Softmax</td></tr><tr><td>discriminator output</td><td>(1, 1, 1)</td><td></td><td></td><td>1</td><td>1</td></tr></table>
md/train/HHiiQKWsOcV/HHiiQKWsOcV.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/HJl6tC4KwB/HJl6tC4KwB.md ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MANIGAN: TEXT-GUIDED IMAGE MANIPULATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ We propose a novel generative adversarial network for visual attributes manipulation (ManiGAN), which is able to semantically modify the visual attributes of given images using natural language descriptions. The key to our method is to design a novel co-attention module to combine text and image information rather than simply concatenating two features along the channel direction. Also, a detail correction module is proposed to rectify mismatched attributes of the synthetic image, and to reconstruct text-unrelated contents. Finally, we propose a new metric for evaluating manipulation results, in terms of both the generation of text-related attributes and the reconstruction of text-unrelated contents. Extensive experiments on benchmark datasets demonstrate the advantages of our proposed method, regarding the effectiveness of image manipulation and the capability of generating high-quality results.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Image manipulation refers to the task of changing various aspects of given images from low-level colour or texture (Zhang et al., 2016; Gatys et al., 2016) to high-level semantics (Zhu et al., 2016), and has numerous potential applications in video games, image editing, and computer-aided design. Recently, with the development of deep learning and generative models, automatic image manipulation becomes possible, including image inpainting (Iizuka et al., 2016; Pathak et al., 2016), image colourisation (Zhang et al., 2016), style transfer (Gatys et al., 2016; Johnson et al., 2016), and domain or attribute translation (Lample et al., 2017; Isola et al., 2017).
12
+
13
+ However, all the above works mainly focus on specific tasks, and only few studies (Dong et al., 2017; Nam et al., 2018) concentrate on more general and user-friendly image manipulation by using natural language descriptions. Also, as shown in Fig.1, current state-of-the-art methods can only generate low-quality images and fail to effectively manipulate given images on more complicated datasets, such as COCO (Lin et al., 2014). The less effective performance is mainly because (1) simply concatenating text and image cross-domain features along the channel direction, the model may fail to precisely correlate words and corresponding visual attributes, and thus cannot modified specific attributes required in the text, and (2) conditioned only on a global sentence vector, current state-of-the-art methods lack important fine-grained information at the word-level, which prevents an effective manipulation using natural language descriptions.
14
+
15
+ In this paper, we aim to manipulate given images using natural language descriptions. In particular, we focus on modifying visual attributes (e.g., category, texture, colour, and background) of input images by providing texts that describe desired attributes. To achieve this, we propose a novel generative adversarial network for visual attributes manipulation (ManiGAN), which allows to effectively manipulate given images using natural language descriptions and to produce high-quality results.
16
+
17
+ The contribution of our proposed method is fourfold: (1) instead of simply concatenating hidden features generated from a natural language description and image features encoded from the input image along the channel direction, we propose a novel co-attention module where both features can collaborate to reconstruct the input image and also keep the synthetic result semantically aligned with the given text description, (2) a detail correction module (DCM) is introduced to rectify mismatched attributes, and to reconstruct text-unrelated contents existing in the input image, (3) a new metric is proposed, which can appropriately reflect the generation of text-related visual attributes and the reconstruction of text-unrelated contents involved in the image manipulation, and (4) extensive experiments on the CUB (Wah et al., 2011) and COCO (Lin et al., 2014) datasets are performed to demonstrate the superiority of our model, which outperforms existing state-of-the-art methods both qualitatively and quantitatively.
18
+
19
+ ![](images/2d08bd0eeec31ed608662f651cb0246361384a8372d1bb8cc10a8dad45e3d10f.jpg)
20
+ red crown and red
21
+ Figure 1: Examples of image manipulation using natural language descriptions. Current state-of-theart methods only generate low-quality images, and fail to do manipulation on COCO. In contrast, our method allows the input images to be manipulated accurately corresponding to the given text descriptions while preserving text-unrelated contents.
22
+
23
+ # 2 RELATED WORK
24
+
25
+ There are few studies focusing on image manipulation using natural language descriptions. Dong et al. (2017) proposed a GAN-based encoder-decoder architecture to disentangle the semantics of both input images and text descriptions. Nam et al. (2018) implemented a similar architecture, but introduced a text-adaptive discriminator that can provide specific word-level training feedback to the generator. However, both methods are limited in performance due to a less effective text-image concatenation method and a coarse sentence condition.
26
+
27
+ Our work is also related to conditional image manipulation. Brock et al. (2016) introduced a VAEGAN hybridisation model to modify natural images by exploring the latent features. Isola et al. (2017) and Zhu et al. (2017) introduced paired and unpaired image-to-image translation methods based on conditional adversarial networks, respectively. However, all these methods focus mainly on image-to-image same-domain translation instead of image manipulation using cross-domain text descriptions.
28
+
29
+ Recently, text-to-image generation has drawn much attention due to the success of GANs in generating photo-realistic images. Reed et al. (2016) first proposed to use conditional GANs to generate plausible images from given text descriptions. Zhang et al. (2017) stacked multiple GANs to generate high-resolution images from coarse- to fine-scale. Xu et al. (2018) implemented a spatial attention mechanism to explore the fine-grained information at the word-level. However, all aforementioned methods mainly focus on generating new photo-realistic images from texts, and not on manipulating specific visual attributes of given images using natural language descriptions.
30
+
31
+ # 3 GENERATIVE ADVERSARIAL NETWORKS FOR IMAGE MANIPULATION
32
+
33
+ Let $I$ denote an input image required to be modified, and $S ^ { \prime }$ denote a text description given by a user. We aim to semantically manipulate the input image $I$ using the given text $S ^ { \prime }$ , and also keep the visual attributes of the modified image $I ^ { \prime }$ semantically aligned with $S ^ { \prime }$ while preserving textunrelated contents existing in $I$ . To achieve this, we first adopt the ControlGAN (Li et al., 2019), as our basic framework, as it can effectively control text-to-image generation, and manipulate visual attributes of synthetic images. Then, we propose two novel components: (1) co-attention module, and (2) detail correction module to achieve effective image manipulation. We elaborate our model as follow, and the full architecture diagram is shown in Appendix A.
34
+
35
+ ![](images/2ad8aeb71f6ca424d4d941ccfe6e9fbc8dad71615b28e44a41789d5905efebec.jpg)
36
+ Figure 2: The architecture of the co-attention module and the generator used in the detail correction module. In (b), CoA denotes the co-attention module.
37
+
38
+ # 3.1 CO-ATTENTION MODULE
39
+
40
+ As shown in Fig. 2 (a), our co-attention module takes two inputs: (1) the hidden features $h \in$ $\mathbb { R } ^ { C \times H \times D }$ , where $C$ is the number of channels, $H$ and $D$ are the height and width of the feature map, respectively, and (2) the regional image features $v \in \mathbb { R } ^ { 2 5 6 \times 1 7 \times 1 7 }$ of the input image $I$ encoded by the GoogleNet (Szegedy et al., 2015). The activation value $h ^ { \prime } \in \mathbb { R } ^ { C \times H \times D }$ is given by $h ^ { \prime } =$ $h \odot W ( v ) + b ( v )$ , where $W ( v )$ and $b ( v )$ are the learned weights and biases dependent on the regional features $v$ , and $\odot$ denotes Hadamard element-wise product. We use $W$ and $b$ to represent the functions that convert the regional features $v$ to scaling and bias values. Then, the activation value $h ^ { \prime }$ serves as the input for the next stage. We also apply the co-attention module before implementing an image generation network to produce synthetic images; please see Appendix A for more details.
41
+
42
+ This linear combination form has been widely used in normalisation techniques (Park et al., 2019; Dumoulin et al., 2016; Huang & Belongie, 2017; De Vries et al., 2017), but, different from them, (1) our co-attention module is only applied at specific positions instead of all normalisation layers, which requires less computational resources, and (2) our co-attention module is designed to incorporate text and image cross-domain information, where $W$ helps the model to focus on text-related visual attributes, while $b$ provides input image information to help to reconstruct text-unrelated contents. Also, we experimentally find that implementing our co-attention module at all normalisation layers fails to produce reasonable images, which indicates that the normalisation techniques may not be suitable for the tasks requiring different domain information. Following Park et al. (2019), the functions $W$ and $b$ are implemented by a simple two-layer convolutional network, see Fig. 2 (a).
43
+
44
+ What has been learned by the co-attention module? To better understand what has been learned by our co-attention module, we conduct an ablation study shown in Fig. 3 to evaluate the effectiveness of $W$ and $b$ . As we can see, without $W$ , some visual attributes cannot be perfectly generated (e.g., white belly in row 1 and the red head in row 2), and without $b$ , the text-unrelated contents (e.g., background) are hard to preserve, which verify our assumption that $W$ behaves as an attention function to help the model focus on text-related visual attributes, and $b$ helps to complete missing text-unrelated details existing in the input image. Also, the visualisation of the channel feature maps of $W ( v )$ shown in the last three columns of Fig. 3 validates the attention mechanism of $W$ .
45
+
46
+ # 3.2 DETAIL CORRECTION MODULE
47
+
48
+ The main purpose of our model is to incorporate input images and then generate modified images aligned with given text descriptions. Then, it may inevitably produce some new visual attributes or mismatched contents that are not required in the given texts. To fix this issue, we propose a detail correction module (DCM) to rectify inappropriate attributes, and to reconstruct text-unrelated contents existing in the input images.
49
+
50
+ ![](images/8216f30316ce37d4181a358b5792e5d34b8fd863147fac5c2c0748582b3982ac.jpg)
51
+ The bird has a black bill, a red crown, and a white belly. (top) This bird has wings that are black, and has a red belly and a red head. (bottom)
52
+ Figure 3: Ablation studies of the learned $W$ and $b$ . The texts on the top are the given descriptions containing desired visual attributes, and the last three columns are the channel feature maps of $W ( v )$ .
53
+
54
+ The DCM consists of a generator and a discriminator, and is trained alternatively by minimising both objective functions. The generator, shown in Fig. 2 (b), takes three inputs: (1) the last hidden features $h _ { \mathrm { l a s t } } \in \mathbb { R } ^ { C ^ { \prime } \times H ^ { \prime } \times D ^ { \prime } }$ from the main module (we call our model without the DCM as main module), (2) the word features, and (3) visual features $v ^ { \prime } \in \mathbb { R } ^ { 1 2 8 \times 1 2 8 \times 1 2 8 }$ that are extracted from the input image $I$ by the VGG-16 (Simonyan & Zisserman, 2014) pretrained on ImageNet (Russakovsky et al., 2015). We have also applied GoogleNet (Szegedy et al., 2015) and ResNet (He et al., 2016) for feature extraction, but both do not perform well. Please refer to Appendix $\mathbf { D }$ for a detailed description of the detail correction module.
55
+
56
+ # 3.3 OBJECTIVE FUNCTIONS
57
+
58
+ We train the main module and detail correction module separately, and the generator and discriminator in both modules are trained alternatively by minimising both the generator loss $\mathcal { L } _ { G }$ and discriminator loss $\mathcal { L } _ { D }$ .
59
+
60
+ Generator objective. The loss function for the generator follows those used in ControlGAN (Li et al., 2019), but we introduce a regularisation term $\begin{array} { r } { \mathcal { L } _ { \mathrm { r e g } } = 1 - \frac { 1 } { C _ { I } H _ { I } W _ { I } } | | I ^ { \prime } - I | | } \end{array}$ 1C H W ||I 0 − I || to prevent the network achieving identity mapping, which can penalise large perturbations when the generated image becomes the same as the input image.
61
+
62
+ $$
63
+ \mathcal { L } _ { G } = - \frac { 1 } { 2 } E _ { I ^ { \prime } \sim P G } \left[ \log ( D ( I ^ { \prime } ) ) \right] - \frac { 1 } { 2 } E _ { I ^ { \prime } \sim P G } \left[ \log ( D ( I ^ { \prime } , S ) ) \right] + \mathcal { L } _ { \mathrm { C o n t r o l G A N } } + \lambda _ { 1 } \mathcal { L } _ { \mathrm { r e g } } ,
64
+ $$
65
+
66
+ $$
67
+ \begin{array} { r } { \mathcal { L } _ { \mathrm { C o n t r o l G A N } } = \lambda _ { 2 } \mathcal { L } _ { \mathrm { D A M S M } } + \lambda _ { 3 } ( 1 - \mathcal { L } _ { \mathrm { c o r r e } } ( I ^ { \prime } , S ) ) + \lambda _ { 4 } \mathcal { L } _ { \mathrm { r e c } } ( I ^ { \prime } , I ) , } \end{array}
68
+ $$
69
+
70
+ where the unconditional adversarial loss makes the synthetic image $I ^ { \prime }$ indistinguishable from the real image $I$ , the conditional adversarial loss aligns the generated image $I ^ { \prime }$ with the given text description $S$ , $\mathcal { L } _ { \mathrm { D A M S M } }$ ( $\mathrm { { X u } }$ et al., 2018) measures the text-image similarity at the word-level to provide finegrained feedback for image generation, $\mathcal { L } _ { \mathrm { c o r r e } }$ (Li et al., 2019) determines whether words-related visual attributes exist in the image, and ${ \mathcal { L } } _ { \mathrm { r e c } }$ (Li et al., 2019) reduces randomness involved in the generation process. $\lambda _ { 1 } , \lambda _ { 2 } , \lambda _ { 3 }$ , and $\lambda _ { 4 }$ are hyperparameters controlling the importance of additional losses. Note that we do not use ${ \mathcal { L } } _ { \mathrm { r e c } }$ when we train the detail correction module.
71
+
72
+ Discriminator objective. The loss function for the discriminator follows those used in ControlGAN (Li et al., 2019), and the function used to train the discriminator in the detail correction module is the same as the one used in the last stage of the main module.
73
+
74
+ $$
75
+ \mathcal { L } _ { D } = \_ \frac { 1 } { 2 } E _ { I \sim P _ { \mathrm { d a t a } } } \left[ \log ( D ( I ) ) \right] - \frac { 1 } { 2 } E _ { I ^ { \prime } \sim P G } \left[ \log ( 1 - D ( I ^ { \prime } ) ) \right]
76
+ $$
77
+
78
+ $$
79
+ \begin{array} { r l } & { \underbrace { - \frac { 1 } { 2 } E _ { I \sim P _ { \mathrm { d a t a } } } \left[ \log ( D ( I , S ) ) \right] - \frac { 1 } { 2 } E _ { I ^ { \prime } \sim P G } \left[ \log ( 1 - D ( I ^ { \prime } , S ) ) \right] } _ { \mathrm { c o n d i t i o n a l ~ a d v e r s a r i a l ~ l o s s } } } \\ & { + \lambda _ { 3 } ( ( 1 - \mathcal { L } _ { \mathrm { c o r r e } } ( I , S ) ) + \mathcal { L } _ { \mathrm { c o r r e } } ( I , S ^ { \prime } ) ) , } \end{array}
80
+ $$
81
+
82
+ where $S ^ { \prime }$ is a given text description randomly sampled from the dataset, the unconditional adversarial loss determines whether the given image is real, and the conditional adversarial loss reflects the semantic similarity between images and texts.
83
+
84
+ Analysis. To prevent the model picking the input image as the solution, i.e., the model becomes an identity mapping network, we first introduce a regularisation term $\mathcal { L } _ { \mathrm { r e g } }$ to penalise large perturbations when the generated image becomes the same as the input image, and then we stop the training early when the model reaches a stage achieving the best trade-off between the generation of new visual attributes aligned with given text descriptions and the reconstruction of text-unrelated contents existing in the input images. As for when to stop training, it is based on our proposed measurement metric, called manipulative precision (see Fig. 4), which is discussed in Sec. 4.
85
+
86
+ # 4 EXPERIMENTS
87
+
88
+ To evaluate our model, extensive quantitative and qualitative experiments are carried out. Two stateof-the-art approaches on image manipulation using natural language descriptions, SISGAN (Dong et al., 2017) and TAGAN (Nam et al., 2018), are compared on the CUB birds (Wah et al., 2011) and more complicated COCO (Lin et al., 2014) datasets. Results for these two baselines are reproduced based on the code released by the authors. Please refer to Appendix A, B, and C for a detailed description of our network structures, the datasets, and training configurations.
89
+
90
+ Quantitative results. As mentioned above, our model can generate high-quality images compared with state-of-the-art methods. To demonstrate this, we adopt the inceptions score (IS) (Salimans et al., 2016) as the quantitative evaluation measure. In our experiments, we evaluate the IS on a large number of manipulated samples generated from mismatched pairs, i.e., randomly chosen input images manipulated by randomly selected text descriptions.
91
+
92
+ However, as the IS cannot reflect the quality of the content preservation, the $L _ { 1 }$ pixel difference (diff) is calculated between the input images and corresponding modified images. Moreover, using the pixel difference alone may falsely report a good reconstruction due to over-training that the model becomes an identity mapping network. To address this issue, we propose a new measurement metric, called manipulative precision (MP), incorporating both the text-image similarity (sim) (Li et al., 2019) and the pixel difference, where the text-image similarity is calculated by performing the cosine similarity on the text features and corresponding image features encoded from the modified images. This is based on the intuition that if the manipulated images are generated from an identity mapping network, then the text-image similarity should be low, as the synthetic images cannot perfectly keep a semantic consistence with given text descriptions. Thus, the measurement metric is defined as ${ \bf M P } = ( 1 - { \bf d i f f } ) \times \sin$ .
93
+
94
+ As shown in Table 1, our method has the highest MP values on both the CUB and COCO datasets compared with the state-of-the-art approaches, which demonstrates that our method can better generate text-related visual attributes, and also reconstruct text-unrelated contents existing in the input images. The model without main module (i.e., only having the DCM) gets the highest IS, the lowest $L _ { 1 }$ pixel difference, and low text-image similarity. This is because the model has become a identity mapping network and loses the capability of image manipulation.
95
+
96
+ Qualitative results. Figs. 5 and 6 show the visual comparison between our ManiGAN, SISGAN (Dong et al., 2017), and TAGAN (Nam et al., 2018) on the CUB and COCO datasets, respectively.
97
+
98
+ ![](images/2d0c0f7002aa2deaa69f3d6c475f922ff1278cb5523506644016b5ef392f810a.jpg)
99
+ Figure 4: Text-image similarity, $L _ { 1 }$ pixel difference, and manipulative precision values at different epochs on the CUB (top) and COCO (bottom) datasets. We suggest to stop training the DCM module when the model gets the highest MP values shown in the last column.
100
+
101
+ It can be seen that both state-of-the-art methods are only able to produce low-quality results and cannot effectively manipulate input images on the COCO dataset. However, our method is capable to perform an accurate manipulation and keep a highly semantic consistence between synthetic images and given text descriptions, while preserving text-unrelated contents. For example, shown in the last column of Fig. 6, SISGAN and TAGAN both fail to achieve an effective manipulation, while our model modifies the green grass to dry grass and also maps the cow into a sheep.
102
+
103
+ Note that as birds can have many detailed descriptions (e.g., colour for different parts), we use a long sentence to manipulate them, while the text descriptions for COCO are more abstract and focus mainly on categories, thus we use words to do manipulation for simplicity, which has the same effect as using long detailed text descriptions.
104
+
105
+ The effectiveness of the co-attention module. To verify the effectiveness of the co-attention module, we use the concatenation method to replace all co-attention modules, which concatenates hidden features $h$ and regional features $v$ along the channel direction, shown in Figs. 7 and 8 (d). As we can see that our full model can synthesise an object having exactly the same shape, pose, and position as the one existing in the input image, and also generate new visual attributes aligned with the given text description on the synthetic image. In contrast, as shown in the last two columns of Figs. 7 and 8 (d), with concatenation method, the model cannot reconstruct birds on the CUB bird dataset, and fails to do manipulation on the COCO dataset.
106
+
107
+ SISGAN
108
+
109
+ TAGAN
110
+
111
+ Ours
112
+
113
+ ![](images/4acdb6dcdce007a2141c3ddf48c360b37aa18a35ed5db33571e6dc5319cd3616.jpg)
114
+ Figure 5: Qualitative comparison of three methods on the CUB birds dataset.
115
+
116
+ ![](images/01e4f05ffb35fff443b6f641f519ac8c6362fafabc696f0431cd17ece1584947.jpg)
117
+ Figure 6: Qualitative comparison of three methods on the COCO dataset.
118
+
119
+ Also, to further validate the effectiveness of the co-attention module, we conduct an ablation study shown in Fig. 8 (c). It can be seen that our model without co-attention module that we just concatenate text and image features before feeding into the main module, which is used in Dong et al. (2017) and Nam et al. (2018), fails to produce reasonable images on both datasets. In contrast, our full model can better generate text-required attributes and also reconstruct text-unrelated contents shown in the last column. Table 1 also verifies the effectiveness of our co-attention module, as the values of IS and MP increase significantly when we implement the co-attention module.
120
+
121
+ The effectiveness of the detail correction module and main module. As shown in Fig. 8 (f), our model without detail correction module may miss some visual attributes (e.g., the bird missing the tail at row 2, the zebra missing the mouth at row 3), or generate new contents (e.g., new background at row 1, different appearance of bus at row 4), which indicates that the detail correction module can correct inappropriate attributes and reconstruct the text-unrelated contents. Fig. 8 (e) shows that without the main module, our model fails to do image manipulation on both datasets, which just achieves an identity mapping. This is mainly because the model cannot precisely correlate words with corresponding visual attributes, which mostly has been done in the main module.
122
+
123
+ ![](images/247f36e3059e079f5ad90d58b360bb5f9b44dc5da918fb851c71d40d35a9c975.jpg)
124
+ Figure 7: Analysis of the co-attention module. “Matched” represents the texts matching original images. “Given” represents the texts provided by users. “Concat.” denotes that instead of using co-attention, hidden features are concatenated with image features along the channel direction.
125
+
126
+ ![](images/0945965899c8a0608f45fd1377bf76ce60cd0bea84c46c8ec5c3263430c89cc2.jpg)
127
+ Figure 8: Ablation studies. a: given text describing the desired visual attributes; b: input image; c: removing the co-attention module and only concatenating image features and text features before feeding into the main module; d: using concatenation method to replace all co-attention modules; e: removing the main module and just training the DCM only; f: removing the DCM and just training the main module only; g: our full model.
128
+
129
+ # 5 CONCLUSION
130
+
131
+ We have proposed a novel generative adversarial network for visual attributes manipulation, called ManiGAN, which can semantically manipulate the input images using natural language descriptions. Two novel components are proposed in our model: (1) the co-attention module enables cooperation between hidden features and image features where both features can collaborate to reconstruct the input image and also keep the synthetic result semantically aligned with the given text description, and (2) the detail correction module can rectify mismatched visual attributes of the synthetic result, and also reconstruct text-unrelated contents existing in the input image. Extensive experimental results demonstrate the superiority of our proposed method, in terms of both the effectiveness of image manipulation and the capability of generating high-quality results.
132
+
133
+ # REFERENCES
134
+
135
+ Andrew Brock, Theodore Lim, James M. Ritchie, and Nick Weston. Neural photo editing with introspective adversarial networks. arXiv preprint arXiv:1609.07093, 2016.
136
+
137
+ Harm De Vries, Florian Strub, Jer´ emie Mary, Hugo Larochelle, Olivier Pietquin, and Aaron C. ´ Courville. Modulating early visual processing by language. In Advances in Neural Information Processing Systems, pp. 6594–6604, 2017.
138
+
139
+ Hao Dong, Simiao Yu, Chao Wu, and Yike Guo. Semantic image synthesis via adversarial learning. In Proceedings of the IEEE International Conference on Computer Vision, pp. 5706–5714, 2017.
140
+
141
+ Vincent Dumoulin, Jonathon Shlens, and Manjunath Kudlur. A learned representation for artistic style. arXiv preprint arXiv:1610.07629, 2016.
142
+
143
+ Leon A. Gatys, Alexander S. Ecker, and Matthias Bethge. Image style transfer using convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2414–2423, 2016.
144
+
145
+ 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.
146
+
147
+ Xun Huang and Serge Belongie. Arbitrary style transfer in real-time with adaptive instance normalization. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1501– 1510, 2017.
148
+
149
+ Satoshi Iizuka, Edgar Simo-Serra, and Hiroshi Ishikawa. Let there be color!: Joint end-to-end learning of global and local image priors for automatic image colorization with simultaneous classification. ACM Transactions on Graphics (TOG), 35(4):110, 2016.
150
+
151
+ Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A. Efros. Image-to-image translation with conditional adversarial networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1125–1134, 2017.
152
+
153
+ Justin Johnson, Alexandre Alahi, and Li Fei-Fei. Perceptual losses for real-time style transfer and super-resolution. In Proceedings of the European Conference on Computer Vision, pp. 694–711. Springer, 2016.
154
+
155
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
156
+
157
+ Guillaume Lample, Neil Zeghidour, Nicolas Usunier, Antoine Bordes, Ludovic Denoyer, et al. Fader networks: Manipulating images by sliding attributes. In Advances in Neural Information Processing Systems, pp. 5967–5976, 2017.
158
+
159
+ Bowen Li, Xiaojuan Qi, Thomas Lukasiewicz, and Philip H. S. Torr. Controllable text-to-image generation. arXiv preprint arXiv:1909.07083, 2019.
160
+
161
+ 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, pp. 740–755. Springer, 2014.
162
+
163
+ Seonghyeon Nam, Yunji Kim, and Seon Joo Kim. Text-adaptive generative adversarial networks: manipulating images with natural language. In Advances in Neural Information Processing Systems, pp. 42–51, 2018.
164
+
165
+ Taesung Park, Ming-Yu Liu, Ting-Chun Wang, and Jun-Yan Zhu. Semantic image synthesis with spatially-adaptive normalization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2337–2346, 2019.
166
+
167
+ Deepak Pathak, Philipp Krahenbuhl, Jeff Donahue, Trevor Darrell, and Alexei A. Efros. Context encoders: Feature learning by inpainting. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2536–2544, 2016.
168
+
169
+ Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, and Honglak Lee. Generative adversarial text to image synthesis. arXiv preprint arXiv:1605.05396, 2016.
170
+
171
+ 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.
172
+
173
+ 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.
174
+
175
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
176
+
177
+ Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1–9, 2015.
178
+
179
+ Dmitry Ulyanov, Andrea Vedaldi, and Victor Lempitsky. Instance normalization: The missing ingredient for fast stylization. arXiv preprint arXiv:1607.08022, 2016.
180
+
181
+ Catherine Wah, Steve Branson, Peter Welinder, Pietro Perona, and Serge Belongie. The Caltech-UCSD Birds-200-2011 dataset. 2011.
182
+
183
+ Tao Xu, Pengchuan Zhang, Qiuyuan Huang, Han Zhang, Zhe Gan, Xiaolei Huang, and Xiaodong He. AttnGAN: Fine-grained text to image generation with attentional generative adversarial networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1316–1324, 2018.
184
+
185
+ Han Zhang, Tao Xu, Hongsheng Li, Shaoting Zhang, Xiaogang Wang, Xiaolei Huang, and Dimitris N Metaxas. StackGAN: Text to photo-realistic image synthesis with stacked generative adversarial networks. In Proceedings of the IEEE International Conference on Computer Vision, pp. 5907–5915, 2017.
186
+
187
+ Richard Zhang, Phillip Isola, and Alexei A. Efros. Colorful image colorization. In Proceedings of the European Conference on Computer Vision, pp. 649–666. Springer, 2016.
188
+
189
+ Jun-Yan Zhu, Philipp Krahenb ¨ uhl, Eli Shechtman, and Alexei A. Efros. Generative visual manipu- ¨ lation on the natural image manifold. In Proceedings of the European Conference on Computer Vision, pp. 597–613. Springer, 2016.
190
+
191
+ Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A. Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2223–2232, 2017.
192
+
193
+ ![](images/8e882d6f8facef74a5432c0aa4514542506885c3e1ac693e8f52ff0f58fa8c68.jpg)
194
+ Figure 9: The architecture of the ManiGAN. The red dashed box indicates detail correction module, the CoA denotes the co-attention module.
195
+
196
+ # A ARCHITECTURE DETAILS
197
+
198
+ We adopt the ControlGAN (Li et al., 2019) as the basic framework and replace batch normalisation with instance normalisation (Ulyanov et al., 2016) everywhere in the generator network except in the first stage. Basically, the co-attention module can be inserted anywhere in the generator, but we experimentally find that it is best to incorporate the module before upsampling blocks and image generation networks; see Fig. 9.
199
+
200
+ # B DATASETS
201
+
202
+ Our method is evaluated on the CUB birds (Wah et al., 2011) and the MS COCO (Lin et al., 2014) datasets. The CUB dataset contains 8,855 training images and 2,933 test images, and each image has 10 corresponding text descriptions. As for the COCO dataset, it contains 82,783 training images and 40,504 validation images, and each image has 5 corresponding text descriptions. We preprocess this two datasets based on the methods introduced in Zhang et al. (2017).
203
+
204
+ # C TRAINING DETAILS
205
+
206
+ In our setting, we train the detail correction module (DCM) separately from the main module. Once the main module has converged, we train the DCM subsequently and set the main module as the eval mode. There are three stages in the main module, and each stage contains a generator and a discriminator. We train three stages at the same time, and three different-scale images $6 4 \times 6 4$ , $1 2 8 \times$ 128, $2 5 6 \times 2 5 6$ are generated progressively.
207
+
208
+ The main module is trained for 600 epochs on the CUB dataset and 120 epochs on the COCO dataset using the Adam optimiser (Kingma & Ba, 2014) with the learning rate 0.0002, and $\beta _ { 1 } = 0 . 5$ , $\beta _ { 2 } = 0 . 9 9 9$ . We do not use any learning rate decay, but for visualising generator output at any given point during the training, we use an exponential running average for the weights of the generator with decay 0.999.
209
+
210
+ As for the DCM, there is a trade-off between generation of text-related attributes and the reconstruction of text-unrelated contents. Based on the manipulative precision (MP) values (see Fig. 4), we find that training 100 epochs for the CUB, and 12 epochs for the COCO to achieve an appropriate balance between generation and reconstruction. The other training setting are the same as in the main module. The hyperparameters $\lambda _ { 1 }$ , $\lambda _ { 2 }$ , $\lambda _ { 3 }$ , and $\lambda _ { 4 }$ are set to 1, 5, 0.5, and 1 for the CUB dataset, and 15, 5, 0.5, and 1 for COCO, respectively.
211
+
212
+ # D ARCHITECTURE OF THE DETAIL CORRECTION MODULE
213
+
214
+ First, the visual features $v ^ { \prime }$ are converted into the same size as the hidden features $h _ { \mathrm { l a s t } }$ via a convolutional layer $F$ , denoted $\tilde { v } ^ { \prime } = F v ^ { \prime }$ , where $\tilde { v } ^ { \prime } \in \mathbb { R } ^ { 1 2 8 \times H ^ { \prime } \times D ^ { \prime } }$ . Then, we adopt the spatial attention and channel-wise attention introduced in (Li et al., 2019) to generate spatial attentive word-context features $s \in \mathbb { R } ^ { C ^ { \prime } \times H ^ { \prime } \times D ^ { \prime } }$ and channel-wise attentive word-context features $c \in \mathbb { R } ^ { C ^ { \prime } \times H ^ { \prime } \times D ^ { \prime } }$ , and concatenate these two features with the hidden features $h _ { \mathrm { l a s t } }$ along the channel direction to generate new hidden features $a \in \mathbb { R } ^ { ( 3 * C ^ { \prime } ) \times H ^ { \prime } \times D ^ { \prime } }$ . Next, to incorporate the visual features $\tilde { v } ^ { \prime }$ , we adopt the co-attention module here, donated $\tilde { a } = a \odot W ^ { \prime } ( \tilde { v } ^ { \prime } ) + b ^ { \prime } \bar { ( } \tilde { v } ^ { \prime } )$ , where $W ^ { \prime }$ and $b ^ { \prime }$ are learned weights and bias dependent on visual features $\tilde { v } ^ { \prime }$ . Then, the transformed features $\tilde { a }$ are fed into a series of residual blocks followed by a convolutional layer to generate hidden features $e$ . Before feeding $e$ into a network to generate the output image, we apply the co-attention module on the $e$ again to further strengthen the visual information; see Fig. 2 (b).
215
+
216
+ # E TREND OF MANIPULATION RESULTS
217
+
218
+ We also track the trend of manipulation results over epoch increases, as shown in Fig. 10. The image is smoothly modified to achieve the best balance between the generation of new visual attributes (e.g., dirt background) and the reconstruction of text-unrelated contents (e.g., the appearance of zebras). However, when the epoch goes larger, the generated visual attributes (e.g., dirt background) aligned with the given text description are erased, and the synthetic image becomes more and more similar to the input image. This verifies the existence of the trade-off between the generation of new visual attributes required in the given text description and the reconstruction of contents existing in the input image.
219
+
220
+ ![](images/8ac666a95e8ed3029080a562ba55522ef80ec990160916baff3fce93af29cfbb.jpg)
221
+ Figure 10: Trend of the manipulation results over epoch increases on the COCO dataset.
222
+
223
+ # F ADDITIONAL RESULTS
224
+
225
+ We show additional comparison results between our ManiGAN, SISGAN (Dong et al., 2017), and TAGAN (Nam et al., 2018) on the CUB (Wah et al., 2011) and COCO (Lin et al., 2014) datasets.
226
+
227
+ ![](images/632ac45c8d469c9cc391a1f9c1bf84b46a42c069ee4cdaa39adf4ced84972e6a.jpg)
228
+ Figure 11: Additional results between ManiGAN, SISGAN, and TAGAN on the CUB bird dataset.
229
+
230
+ A small blue bird with an orange crown, with a grey belly.
231
+
232
+ This bird has a red head, black eye rings, and a yellow belly.
233
+
234
+ This bird is mostly red with a black beak, and a black tail.
235
+
236
+ This tiny bird is blue and has a red bill and a red belly.
237
+
238
+ This bird has a white head, a yellow bill, and a yellow belly.
239
+
240
+ ![](images/c0a0b62a0bb1d107448f2d00d95eaa5f9482f69ed864a5e26dfe59f6085cedbd.jpg)
241
+ Figure 12: Additional results between ManiGAN, SISGAN, and TAGAN on the CUB bird dataset.
242
+
243
+ Sunset.
244
+
245
+ Blue boat, green grass.
246
+
247
+ White bus.
248
+
249
+ Man, dry grass.
250
+
251
+ ![](images/b92026996c6667826c84b0bb010aa617e1e8e5b7926673e7355233896e04c3ea.jpg)
252
+ Figure 13: Additional results between ManiGAN, SISGAN, and TAGAN on the COCO dataset.
253
+
254
+ Zebra, grass.
255
+
256
+ Orange bus.
257
+
258
+ ![](images/f88e7e668b7bd20401abe0a1c626b842362a5272ecdbde82165b02fe8ae1b0f0.jpg)
259
+
260
+ Figure 14: Additional results between ManiGAN, SISGAN, and TAGAN on the COCO dataset.
md/train/HJlmHoR5tQ/HJlmHoR5tQ.md ADDED
@@ -0,0 +1,400 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ADVERSARIAL IMITATION VIA VARIATIONAL INVERSE REINFORCEMENT LEARNING
2
+
3
+ Ahmed H. Qureshi
4
+ Department of Electrical and Computer Engineering
5
+ University of California San Diego,
6
+ La Jolla, CA 92093, USA
7
+ a1qureshi@ucsd.edu
8
+
9
+ Byron Boots College of Computing Georgia Institute of Technology Atlanta, GA 30332, USA bboots@cc.gatech.edu
10
+
11
+ Michael C. Yip
12
+ Department of Electrical and Computer Engineering
13
+ University of California San Diego,
14
+ La Jolla, CA 92093, USA
15
+ yip@ucsd.edu
16
+
17
+ # ABSTRACT
18
+
19
+ We consider a problem of learning the reward and policy from expert examples under unknown dynamics. Our proposed method builds on the framework of generative adversarial networks and introduces the empowerment-regularized maximum-entropy inverse reinforcement learning to learn near-optimal rewards and policies. Empowerment-based regularization prevents the policy from overfitting to expert demonstrations, which advantageously leads to more generalized behaviors that result in learning near-optimal rewards. Our method simultaneously learns empowerment through variational information maximization along with the reward and policy under the adversarial learning formulation. We evaluate our approach on various high-dimensional complex control tasks. We also test our learned rewards in challenging transfer learning problems where training and testing environments are made to be different from each other in terms of dynamics or structure. The results show that our proposed method not only learns nearoptimal rewards and policies that are matching expert behavior but also performs significantly better than state-of-the-art inverse reinforcement learning algorithms.
20
+
21
+ # 1 INTRODUCTION
22
+
23
+ Reinforcement learning (RL) has emerged as a promising tool for solving complex decision-making and control tasks from predefined high-level reward functions (Sutton et al., 1998). However, defining an optimizable reward function that inculcates the desired behavior can be challenging for many robotic applications, which include learning social-interaction skills (Qureshi et al., 2018; 2017), dexterous manipulation (Finn et al., 2016b), and autonomous driving (Kuderer et al., 2015).
24
+
25
+ Inverse reinforcement learning (IRL) $\mathrm { N g }$ et al., 2000) addresses the problem of learning reward functions from expert demonstrations, and it is often considered as a branch of imitation learning (Argall et al., 2009). The prior work in IRL includes maximum-margin (Abbeel & Ng, 2004; Ratliff et al., 2006) and maximum-entropy (Ziebart et al., 2008) formulations. Currently, maximum entropy (MaxEnt) IRL is a widely used approach towards IRL, and has been extended to use non-linear function approximators such as neural networks in scenarios with unknown dynamics by leveraging sampling-based techniques (Boularias et al., 2011; Finn et al., 2016b; Kalakrishnan et al., 2013). However, designing the IRL algorithm is usually complicated as it requires, to some extent, hand engineering such as deciding domain-specific regularizers (Finn et al., 2016b).
26
+
27
+ Rather than learning reward functions and solving the IRL problem, imitation learning (IL) learns a policy directly from expert demonstrations. Prior work addressed the IL problem through behavior cloning (BC), which learns a policy from expert trajectories using supervised learning (Pomerleau, 1991). Although BC methods are simple solutions to IL, these methods require a large amount of data because of compounding errors induced by covariate shift (Ross et al., 2011). To overcome BC limitations, a generative adversarial imitation learning (GAIL) algorithm (Ho & Ermon, 2016) was proposed. GAIL uses the formulation of Generative Adversarial Networks (GANs) (Goodfellow et al., 2014), i.e., a generator-discriminator framework, where a generator is trained to generate expert-like trajectories while a discriminator is trained to distinguish between generated and expert trajectories. Although GAIL is highly effective and efficient framework, it does not recover transferable/portable reward functions along with the policies, thus narrowing its use cases to similar problem instances in similar environments. Reward function learning is ultimately preferable, if possible, over direct imitation learning as rewards are portable functions that represent the most basic and complete representation of agent intention, and can be re-optimized in new environments and new agents.
28
+
29
+ Reward learning is challenging as there can be many optimal policies explaining a set of demonstrations and many reward functions inducing an optimal policy $\mathrm { N g }$ et al., 2000; Ziebart et al., 2008). Recently, an adversarial inverse reinforcement learning (AIRL) framework (Fu et al., 2017), an extension of GAIL, was proposed that offers a solution to the former issue by exploiting the maximum entropy IRL method (Ziebart et al., 2008) whereas the latter issue is addressed through learning disentangled reward functions by modeling the reward as a function of state only instead of both state and action. However, AIRL fails to recover the ground truth reward when the ground truth reward is a function of both state and action. For example, the reward function in any locomotion or ambulation tasks contains a penalty term that discourages actions with large magnitudes. This need for action regularization is well known in optimal control literature and limits the use cases of a state-only reward function in most practical real-life applications. A more generalizable and useful approach would be to formulate reward as a function of both states and actions, which induces action-driven reward shaping that has been shown to play a vital role in quickly recovering the optimal policies $\mathrm { N g }$ et al., 1999).
30
+
31
+ In this paper, we propose the empowerment-regularized adversarial inverse reinforcement learning (EAIRL) algorithm1. Empowerment (Salge et al., 2014) is a mutual information-based theoretic measure, like state- or action-value functions, that assigns a value to a given state to quantify the extent to which an agent can influence its environment. Our method uses variational information maximization (Mohamed & Rezende, 2015) to learn empowerment in parallel to learning the reward and policy from expert data. Empowerment acts as a regularizer to policy updates to prevent overfitting the expert demonstrations, which in practice leads to learning robust rewards. Our experimentation shows that the proposed method recovers not only near-optimal policies but also recovers robust, transferable, disentangled, state-action based reward functions that are near-optimal. The results on reward learning also show that EAIRL outperforms several state-of-the-art IRL methods by recovering reward functions that leads to optimal, expert-matching behaviors. On policy learning, results demonstrate that policies learned through EAIRL perform comparably to GAIL and AIRL with non-disentangled (state-action) reward function but significantly outperform policies learned through AIRL with disentangled reward (state-only) and GAN interpretation of Guided Cost Learning (GAN-GCL) (Finn et al., 2016a).
32
+
33
+ # 2 BACKGROUND
34
+
35
+ We consider a Markov decision process (MDP) represented as a tuple $( S , \mathcal { A } , \mathcal { P } , \mathcal { R } , \rho _ { 0 } , \gamma )$ where $s$ denotes the state-space, $\mathcal { A }$ denotes the action-space, $\mathcal { P }$ represents the transition probability distribution, i.e., $\mathcal { P } : \mathcal { S } \times \mathcal { A } \times \mathcal { S } \to [ 0 , 1 ] , \mathcal { R } ( s , a )$ corresponds to the reward function, $\rho _ { 0 }$ is the initial state distribution $\rho _ { 0 } : { \mathcal { S } } \mathbb { R }$ , and $\gamma \in ( 0 , 1 )$ is the discount factor. Let $\boldsymbol { q } ( \boldsymbol { a } | \boldsymbol { s } , \boldsymbol { s } ^ { \prime } )$ be an inverse model that maps current state $s \in S$ and next state $s ^ { \prime } \in \mathcal { S }$ to a distribution over actions $\mathcal { A }$ , i.e., $q : \mathcal { S } \times \mathcal { S } \times \mathcal { A } [ 0 , 1 ]$ . Let $\pi$ be a stochastic policy that takes a state and outputs a distribution over actions such that $\pi : S \times A \to [ 0 , 1 ]$ . Let $\tau$ and $\tau _ { E }$ denote a set of trajectories, a sequence of state-action pairs $( s _ { 0 } , a _ { 0 } , \cdot \cdot \cdot s _ { T } , a _ { T } )$ , generated by a policy $\pi$ and an expert policy $\pi _ { E }$ , respectively, where $T$ denotes the terminal time. Finally, let $\Phi ( s )$ be a potential function that quantifies a utility of a given state $s \in S$ , i.e., $\Phi : S \mathbb { R }$ . In our proposed work, we use an empowerment-based potential function $\Phi ( \cdot )$ to regularize policy update under MaxEnt-IRL framework. Therefore, the following sections provide a brief background on MaxEnt-IRL, adversarial reward and policy learning, and variational information-maximization approach to learn the empowerment.
36
+
37
+ # 2.1 MAXENT-IRL
38
+
39
+ MaxEnt-IRL (Ziebart et al., 2008) models expert demonstrations as Boltzmann distribution using parametrized reward $r _ { \xi } ( \tau )$ as an energy function, i.e.,
40
+
41
+ $$
42
+ p _ { \xi } ( \tau ) = \frac { 1 } { Z } \mathrm { e x p } ( r _ { \xi } ( \tau ) )
43
+ $$
44
+
45
+ here, and $\begin{array} { r } { r _ { \xi } ( \tau ) = \sum _ { t = 0 } ^ { T } r _ { \xi } \big ( s _ { t } , a _ { t } \big ) } \end{array}$ is a commutative reward over given trajectory . In this framework, the demonstration trajectori $\tau$ , parameterized bys are assumed to be $\xi$ $Z$
46
+ sampled from an optimal policy $\pi ^ { * }$ , therefore, they get the highest likelihood whereas the suboptimal trajectories are less rewarding and hence, are generated with exponentially decaying probability. The main computational challenge in MaxEnt-IRL is to determine $Z$ . The initial work in MaxEnt-IRL computed $Z$ using dynamic programming (Ziebart et al., 2008) whereas modern approaches (Finn et al., 2016b;a; Fu et al., 2017) present importance sampling technique to approximate $Z$ under unknown dynamics.
47
+
48
+ # 2.2 ADVERSARIAL INVERSE REINFORCEMENT LEARNING
49
+
50
+ This section briefly describes Adversarial Inverse Reinforcement Learning (AIRL) (Fu et al., 2017) algorithm which forms a baseline of our proposed method. AIRL is the current state-of-the-art IRL method that builds on GAIL (Ho & Ermon, 2016), maximum entropy IRL framework (Ziebart et al., 2008) and GAN-GCL, a GAN interpretation of Guided Cost Learning (Finn et al., 2016b;a).
51
+
52
+ GAIL is a model-free adversarial learning framework, inspired from GANs (Goodfellow et al., 2014), where the policy $\pi$ learns to imitate the expert policy behavior $\pi _ { E }$ by minimizing the JensenShannon divergence between the state-action distributions generated by $\pi$ and the expert state-action distribution by $\pi _ { E }$ through following objective
53
+
54
+ $$
55
+ \operatorname* { m i n } _ { \pi } \operatorname* { m a x } _ { D \in ( 0 , 1 ) ^ { S \times A } } \mathbb { E } _ { \pi } [ \log D ( s , a ) ] + \mathbb { E } _ { \pi _ { E } } [ \log ( 1 - D ( s , a ) ) ] - \lambda H ( \pi )
56
+ $$
57
+
58
+ where $D$ is the discriminator that performs the binary classification to distinguish between samples generated by $\pi$ and $\pi _ { E }$ , $\lambda$ is a hyper-parameter, and $H ( \pi )$ is an entropy regularization term $\mathbb { E } _ { \pi } [ \log \pi ]$ . Note that GAIL does not recover reward; however, Finn et al. (2016a) shows that the discriminator can be modeled as a reward function. Thus AIRL ( $\mathrm { F u }$ et al., 2017) presents a formal implementation of (Finn et al., 2016a) and extends GAIL to recover reward along with the policy by imposing a following structure on the discriminator:
59
+
60
+ $$
61
+ D _ { \xi , \varphi } ( s , a , s ^ { \prime } ) = \frac { \exp [ f _ { \xi , \varphi } ( s , a , s ^ { \prime } ) ] } { \exp [ f _ { \xi , \varphi } ( s , a , s ^ { \prime } ) ] + \pi ( a | s ) }
62
+ $$
63
+
64
+ where $f _ { \xi , \varphi } ( s , a , s ^ { \prime } ) = r _ { \xi } ( s ) + \gamma h _ { \varphi } ( s ^ { \prime } ) - h _ { \varphi } ( s )$ comprises a disentangled reward term $r _ { \xi } ( s )$ with training parameters $\xi$ , and a shaping term $F \dot { = } \gamma h _ { \varphi } ( s ^ { \prime } ) - h _ { \varphi } ( s )$ with training parameters $\varphi$ . The entire $D _ { \xi , \varphi } ( s , a , s ^ { \prime } )$ is trained as a binary classifier to distinguish between expert demonstrations $\tau _ { E }$ and policy generated demonstrations $\tau$ . The policy is trained to maximize the discriminative reward $\hat { r } ( s , a , s ^ { \prime } ) \stackrel { - } { = } \log ( D ( s , a , s ^ { \prime } ) - \log ( 1 - D ( s , a , s ^ { \prime } ) ) )$ . Note that the function $F = \gamma h _ { \varphi } ( s ^ { \prime } ) - h _ { \varphi } ( s )$ consists of free-parameters as no structure is imposed on $h _ { \varphi } ( \cdot )$ , and as mentioned in ( $\mathrm { F u }$ et al., 2017), the reward function $r _ { \xi } ( \cdot )$ and function $F$ are tied upto a constant $( \gamma - 1 ) c$ , where $c \in \mathbb { R }$ ; thus the impact of $F$ , the shaping term, on the recovered reward $r$ is quite limited and therefore, the benefits of reward shaping are not fully realized.
65
+
66
+ # 2.3 EMPOWERMENT AS MAXIMAL MUTUAL INFORMATION
67
+
68
+ Mutual information (MI), an information-theoretic measure, quantifies the dependency between two random variables. In intrinsically-motivated reinforcement learning, a maximal of mutual information between a sequence of $K$ actions $\textbf { \em a }$ and the final state $s ^ { \prime }$ reached after the execution of $\textbf { \em a }$ ,
69
+
70
+ conditioned on current state $\pmb { s }$ is often used as a measure of internal reward (Mohamed & Rezende, 2015), known as Empowerment $\Phi ( s )$ , i.e.,
71
+
72
+ $$
73
+ \Phi ( s ) = \operatorname* { m a x } I ( \pmb { a } , \pmb { s } ^ { \prime } | s ) = \operatorname* { m a x } \mathbb { E } _ { p ( \pmb { s } ^ { \prime } | \pmb { a } , s ) w ( \pmb { a } | s ) } \bigg [ \log \bigg ( \frac { p ( \pmb { a } , \pmb { s } ^ { \prime } | s ) } { w ( \pmb { a } | s ) p ( \pmb { s } ^ { \prime } | s ) } \bigg ) \bigg ]
74
+ $$
75
+
76
+ where $p ( \pmb { s } ^ { \prime } | \pmb { a } , \pmb { s } )$ is a $K$ -step transition probability, $\underset { - } { w } ( \pmb { a } | \pmb { s } )$ is a distribution over $\textbf { \em a }$ , and $p ( \pmb { a } , \pmb { s } ^ { \prime } | \pmb { s } )$ is a joint-distribution of $K$ actions $^ { a }$ and final state $s ^ { \prime 2 }$ . Intuitively, the empowerment $\Phi ( s )$ of a state $s$ quantifies an extent to which an agent can influence its future. Thus, maximizing empowerment induces an intrinsic motivation in the agent that enforces it to seek the states that have the highest number of future reachable states.
77
+
78
+ Empowerment, like value functions, is a potential function that has been previously used in reinforcement learning but its applications were limited to small-scale cases due to computational intractability of MI maximization in higher-dimensional problems. Recently, however, a scalable method (Mohamed & Rezende, 2015) was proposed that learns the empowerment through the moreefficient maximization of variational lower bound, which has been shown to be equivalent to maximizing MI (Agakov, 2004). The lower bound was derived (for complete derivation see Appendix A.1) by representing MI in term of the difference in conditional entropies $H ( \cdot )$ and utilizing the non-negativity property of KL-divergence, i.e.,
79
+
80
+ $$
81
+ I ^ { w } ( s ) = H ( a | s ) - H ( a | s ^ { \prime } , s ) \geq H ( a ) + \mathbb { E } _ { p ( s ^ { \prime } | a , s ) w _ { \theta } ( a | s ) } [ \log q _ { \phi } ( a | s ^ { \prime } , s ) ] = I ^ { w , q } ( s )
82
+ $$
83
+
84
+ where $H ( a | s ) = - \mathbb { E } _ { w ( a | s ) } [ \log w ( a | s ) ]$ , $H ( a | s ^ { \prime } , s ) = - \mathbb { E } _ { p ( s ^ { \prime } | a , s ) w ( a | s ) } [ \log p ( a | s ^ { \prime } , s ) ]$ , $q _ { \phi } ( \cdot )$ is a variational distribution with parameters $\phi$ and $w _ { \theta } ( \cdot )$ is a distribution over actions with parameters $\theta$ . Finally, the lower bound in Eqn. 5 is maximized under the constraint $H ( a | s ) < { \bar { \eta } }$ (prevents divergence, see (Mohamed & Rezende, 2015)) to compute empowerment as follow:
85
+
86
+ $$
87
+ \Phi ( s ) = \operatorname* { m a x } _ { w , q } \mathbb { E } _ { p ( s ^ { \prime } \mid a , s ) w ( a \mid s ) } [ - \frac { 1 } { \beta } \mathrm { l o g } w _ { \theta } ( a \mid s ) + \log q _ { \phi } ( a \mid s ^ { \prime } , s ) ]
88
+ $$
89
+
90
+ where $\beta$ is $\eta$ dependent temperature term.
91
+
92
+ Mohamed & Rezende (2015) also applied the principles of Expectation-Maximization (EM) (Agakov, 2004) to learn empowerment, i.e., alternatively maximizing Eqn. 6 with respect to $\boldsymbol { w } _ { \boldsymbol { \theta } } ( a | s )$ and ${ q _ { \phi } } ( a | s ^ { \prime } , s )$ . Given a set of training trajectories $\tau$ , the maximization of Eqn. 6 w.r.t $q _ { \phi } ( \cdot )$ is shown to be a supervised maximum log-likelihood problem whereas the maximization w.r.t $w _ { \theta } ( \cdot )$ is determined through the functional derivative ${ \partial I } / { \partial w } = 0$ under the constraint $\begin{array} { r } { \sum _ { a } w ( a | s ) = 1 } \end{array}$ . The optimal $w ^ { * }$ that maximizes Eqn. 6 turns out to be $\frac { 1 } { Z ( s ) } \exp ( \beta \mathbb { E } _ { p ( s ^ { \prime } \mid s , a ) } [ \log q _ { \phi } ( a | s , s ^ { \prime } ) ] )$ , where $Z ( s )$ is a normalization term. Substituting $w ^ { * }$ in Eqn. 6 showed that the empowerment $\Phi ( s ) = \frac { 1 } { \beta } \mathrm { l o g } Z ( s )$ (for full derivation, see Appendix A.2).
93
+
94
+ Note that $w ^ { * } ( a | s )$ is implicitly unnormalized as there is no direct mechanism for sampling actions or computing $Z ( s )$ . Mohamed $\&$ Rezende (2015) introduced an approximation $w ^ { * } ( a | s ) \approx$ $\log \pi ( a | s ) + \Phi ( s )$ where $\pi ( a | s )$ is a normalized distribution which leaves the scalar function $\Phi ( s )$ to account for the normalization term $\log Z ( s )$ . Finally, the parameters of policy $\pi$ and scalar function $\Phi$ are optimized by minimizing the discrepancy, $l _ { I } ( s , a , s ^ { \prime } )$ , between the two approximations $( \log \pi ( a | s ) \overset { \cdot } { + } \Phi ( s ) )$ and $\beta \log q _ { \phi } ( a | s ^ { \prime } , s ) )$ through either absolute $( p = 1 )$ ) or squared error $( p = 2 )$ ), i.e.,
95
+
96
+ $$
97
+ l _ { I } ( s , a , s ^ { \prime } ) = \left| \beta \log q _ { \phi } ( a | s ^ { \prime } , s ) - ( \log \pi _ { \theta } ( a | s ) + \Phi _ { \varphi } ( s ) ) \right| ^ { p }
98
+ $$
99
+
100
+ # 3 EMPOWERED ADVERSARIAL INVERSE REINFORCEMENT LEARNING
101
+
102
+ We present an inverse reinforcement learning algorithm that learns a robust, transferable reward function and policy from expert demonstrations. Our proposed method comprises (i) an inverse model ${ q _ { \phi } ( a | s ^ { \prime } , s ) }$ that takes the current state $s$ and the next state $s ^ { \prime }$ to output a distribution over actions $\mathcal { A }$ that resulted in $s$ to $s ^ { \prime }$ transition, (ii) a reward $r _ { \xi } ( s , a )$ , with parameters $\xi$ , that is a function of both state and action, (iii) an empowerment-based potential function $\Phi _ { \varphi } ( \cdot )$ with parameters $\varphi$ that determines the reward-shaping function $F = \gamma \Phi _ { \varphi } \bar { ( } s ^ { \prime } ) - \Phi _ { \varphi } ( s )$ and also regularizes the policy update, and (iv) a policy model $\pi _ { \boldsymbol { \theta } } ( a | \boldsymbol { s } )$ that outputs a distribution over actions given the current state $s$ . All these models are trained simultaneously based on the objective functions described in the following sections to recover optimal policies and generalizable reward functions concurrently.
103
+
104
+ # 3.1 INVERSE MODEL $q _ { \phi } ( a | s , s ^ { \prime } )$ OPTIMIZATION
105
+
106
+ As mentioned in Section 2.3, learning the inverse model $q _ { \phi } ( a | s , s ^ { \prime } )$ is a maximum log-likelihood supervised learning problem. Therefore, given a set of trajectories $\tau \sim \pi$ , where a single trajectory is a sequence states and actions, i.e., $\tau _ { i } = \{ s _ { 0 } , a _ { 0 } , \cdot \cdot \cdot , s _ { T } , a _ { T } \} _ { i }$ , the inverse model $\bar { \boldsymbol { q } _ { \phi } } ( a | \bar { s ^ { \prime } } , s )$ is trained to minimize the mean-square error between its predicted action $\boldsymbol { q } ( \boldsymbol { a } | \boldsymbol { s } ^ { \prime } , s )$ and the action $a$ taken according to the generated trajectory $\tau$ , i.e.,
107
+
108
+ $$
109
+ l _ { q } ( s , a , s ^ { \prime } ) = ( q _ { \phi } ( \cdot | s , s ^ { \prime } ) - a ) ^ { 2 }
110
+ $$
111
+
112
+ # 3.2 EMPOWERMENT $\Phi _ { \varphi } ( s )$ OPTIMIZATION
113
+
114
+ Empowerment will be expressed in terms of normalization function $Z ( s )$ of optimal $w ^ { * } ( a | s )$ , i.e., $\Phi _ { \varphi } ( s ) = \frac { 1 } { \beta } \mathrm { l o g } Z ( s )$ . Therefore, the estimation of empowerment $\Phi _ { \varphi } ( s )$ is approximated by minimizing the loss function $l _ { I } ( s , a , s ^ { \prime } )$ , presented in Eqn. 7, w.r.t parameters $\varphi$ , and the inputs $( s , a , s ^ { \prime } )$ are sampled from the policy-generated trajectories $\tau$ .
115
+
116
+ # 3.3 REWARD FUNCTION $r _ { \xi } ( s , a )$
117
+
118
+ To train the reward function, we first compute the discriminator as follow:
119
+
120
+ $$
121
+ D _ { \xi , \varphi } ( s , a , s ^ { \prime } ) = \frac { \exp [ r _ { \xi } ( s , a ) + \gamma \Phi _ { \varphi ^ { \prime } } ( s ^ { \prime } ) - \Phi _ { \varphi } ( s ) ] } { \exp [ r _ { \xi } ( s , a ) + \gamma \Phi _ { \varphi ^ { \prime } } ( s ^ { \prime } ) - \Phi _ { \varphi } ( s ) ] + \pi _ { \theta } ( a | s ) }
122
+ $$
123
+
124
+ where $r _ { \xi } ( s , a )$ is the reward function to be learned with parameters $\xi$ . We also maintain the target $\varphi ^ { \prime }$ and learning $\varphi$ parameters of the empowerment-based potential function. The target parameters $\varphi ^ { \prime }$ are a replica of $\varphi$ except that the target parameters $\varphi ^ { \prime }$ are updated to learning parameters $\varphi$ after every $n$ training epochs. Note that keeping a stationary target $\Phi _ { \varphi ^ { \prime } }$ stabilizes the learning as also mentioned in (Mnih et al., 2015). Finally, the discriminator/reward function parameters $\xi$ are trained via binary logistic regression to discriminate between expert $\tau _ { E }$ and generated $\tau$ trajectories, i.e.,
125
+
126
+ $$
127
+ \mathbb { E } _ { \tau } [ \log D _ { \xi , \varphi } ( s , a , s ^ { \prime } ) ] + \mathbb { E } _ { \tau _ { E } } [ ( 1 - \log D _ { \xi , \varphi } ( s , a , s ^ { \prime } ) ) ]
128
+ $$
129
+
130
+ # 3.4 POLICY OPTIMIZATION POLICY $\pi _ { \boldsymbol { \theta } } ( a | \boldsymbol { s } )$
131
+
132
+ We train our policy $\pi _ { \boldsymbol { \theta } } ( a | \boldsymbol { s } )$ to maximize the discriminative reward $\hat { r } ( s , a , s ^ { \prime } ) = \log ( D ( s , a , s ^ { \prime } ) -$ $\log ( 1 - D ( s , a , s ^ { \prime } ) ) )$ and to minimize the loss function $\begin{array} { r c l } { { l _ { I } ( s , a , s ^ { \prime } ) } } & { { = } } & { { \left| \beta \log q _ { \phi } ( a | s , s ^ { \prime } ) \right. - } } \end{array}$ $( \log \pi _ { \theta } ( a | s ) + \Phi _ { \varphi } ( s ) ) { \big | } ^ { p }$ which accounts for empowerment regularization. Hence, the overall policy training objective is:
133
+
134
+ $$
135
+ \mathbb { E } _ { \tau } [ \log \pi _ { \theta } ( a \vert s ) \hat { r } ( s , a , s ^ { \prime } ) ] + \lambda _ { I } \mathbb { E } _ { \tau } \left[ l _ { I } ( s , a , s ^ { \prime } ) \right]
136
+ $$
137
+
138
+ where policy parameters $\theta$ are updated using any policy optimization method such as TRPO (Schulman et al., 2015) or an approximated step such as PPO (Schulman et al., 2017).
139
+
140
+ Algorithm 1 outlines the overall training procedure to train all function approximators simultaneously. Note that the expert samples $\tau _ { E }$ are seen by the discriminator only, whereas all other models are trained using the policy generated samples $\tau$ . Furthermore, the discriminating reward ${ \hat { r } } ( s , a , s ^ { \prime } )$ boils down to the following expression (Appendix B.1):
141
+
142
+ $$
143
+ \begin{array} { r } { \hat { r } ( s , a , s ^ { \prime } ) = f ( s , a , s ^ { \prime } ) - \log \pi ( a | s ) } \end{array}
144
+ $$
145
+
146
+ where $f ( s , a , s ^ { \prime } ) = r _ { \xi } ( s , a ) + \gamma \Phi _ { \varphi ^ { \prime } } ( s ^ { \prime } ) - \Phi _ { \varphi } ( s )$ . Thus, an alternative way to express our policy training objective is $\mathbb { E } _ { \tau } [ \log \pi _ { \theta } ( a | s ) r _ { \pi } ( s , a , s ^ { \prime } ) ]$ , where $r _ { \pi } ( s , a , s ^ { \prime } ) = { \hat { r } } ( { \bar { s , } } a , s ^ { \prime } ) { \bar { - } } \lambda _ { I } l _ { I } ( s , { \bar { a } } , s ^ { \prime } )$ ,
147
+
148
+ # Algorithm 1: Empowerment-based Adversarial Inverse Reinforcement Learning
149
+
150
+ Initialize parameters of policy $\pi _ { \theta }$ , and inverse model $q _ { \phi }$
151
+ Initialize parameters of target $\Phi _ { \varphi ^ { \prime } }$ and training $\Phi _ { \varphi }$ empowerment, and reward $r _ { \xi }$ functions
152
+ Obtain expert demonstrations $\tau _ { E }$ by running expert policy $\pi _ { E }$
153
+ for $i \gets 0$ to $N$ do
154
+
155
+ Collect trajectories $\tau$ by executing $\pi _ { \theta }$ Update $\phi _ { i }$ to $\phi _ { i + 1 }$ with the gradient $\mathbb { E } _ { \tau } [ \bigtriangledown _ { \phi _ { i } } l _ { q } ( s , a , s ^ { \prime } ) ]$ Update $\varphi _ { i }$ to $\varphi _ { i + 1 }$ with the gradient $\mathbb { E } _ { \tau } [ \bigtriangledown _ { \varphi _ { i } } l _ { I } ( s , a , s ^ { \prime } ) ]$ Update $\xi _ { i }$ to $\xi _ { i + 1 }$ with the gradient:
156
+
157
+ $$
158
+ \mathbb { E } _ { \tau } \big [ \bigtriangledown \xi _ { i } \log D _ { \xi _ { i } , \varphi _ { i + 1 } } ( s , a , s ^ { \prime } ) \big ] + \mathbb { E } _ { \tau _ { E } } \big [ \bigtriangledown \xi _ { i } ( 1 - \log D _ { \xi _ { i } , \varphi _ { i + 1 } } ( s , a , s ^ { \prime } ) ) \big ]
159
+ $$
160
+
161
+ Update $\theta _ { i }$ to $\theta _ { i + 1 }$ using natural gradient update rule (i.e., TRPO/PPO) with the gradient:
162
+
163
+ $$
164
+ \mathbb { E } _ { \tau } \big [ \bigtriangledown _ { \theta _ { i } } \log \pi _ { \theta _ { i } } ( a | s ) \hat { r } _ { \xi _ { i + 1 } } ( s , a , s ^ { \prime } ) \big ] + \lambda _ { I } \mathbb { E } _ { \tau } \big [ \bigtriangledown _ { \theta _ { i } } l _ { I } ( s , a , s ^ { \prime } ) \big ]
165
+ $$
166
+
167
+ After every $n$ epochs sync $\varphi ^ { \prime }$ with $\varphi$
168
+
169
+ ![](images/92f6a79ea5ec7952467a7522bdf92a2e962cd6738da2fe5ab93f8eaafeb75913.jpg)
170
+ Figure 1: Transfer learning problems. Fig. (a) represents a problem where agent dynamics are modified during testing, i.e., a reward learned on a quadruped-ant (left) is transferred to a crippledant (right). Fig (b) represents a problem where environment structure is modified during testing, i.e., a reward learned on a maze with left-passage is transferred to a maze with right-passage to the goal (green).
171
+
172
+ which would undoubtedly yield the same results as Eqn. 11, i.e., maximize the discriminative reward and minimize the loss $l _ { I }$ . The analysis of this alternative expression is given in Appendix $\mathbf { B }$ to highlight that our policy update rule is equivalent to MaxEnt-IRL policy objective (Finn et al., 2016a) except that it also maximizes the empowerment, i.e.,
173
+
174
+ $$
175
+ r _ { \pi } ( s , a , s ^ { \prime } ) = r _ { \xi } ( s , a , s ^ { \prime } ) + \gamma \Phi ( s ^ { \prime } ) + \lambda \hat { { \cal H } } ( \cdot )
176
+ $$
177
+
178
+ where, $\lambda$ and $\gamma$ are hyperparameters, and ${ \hat { H } } ( \cdot )$ is the entropy-regularization term depending on $\pi ( \cdot )$ and $q ( \cdot )$ . Hence, our policy is regularized by the empowerment which induces generalized behavior rather than locally overfitting to the limited expert demonstrations.
179
+
180
+ # 4 RESULTS
181
+
182
+ Our proposed method, EAIRL, learns both reward and policy from expert demonstrations. Thus, for comparison, we evaluate our method against both state-of-the-art policy and reward learning techniques on several control tasks in OpenAI Gym. In case of policy learning, we compare our method against GAIL, GAN-GCL, AIRL with state-only reward, denoted as $\operatorname { A I R L } ( s )$ , and an augmented version of AIRL we implemented for the purposes of comparison that has state-action reward, denoted as $\mathrm { A I R L } ( s , a )$ . In reward learning, we only compare our method against AIRL(s) and $\mathrm { A I R L } ( s , a )$ as GAIL does not recover rewards, and GAN-GCL is shown to exhibit inferior performance than AIRL $\mathrm { F u }$ et al., 2017). Furthermore, in the comparisons, we also include the expert performances which represents a policy learned by optimizing a ground-truth reward using TRPO (Schulman et al., 2015). The performance of different methods are evaluated in term of mean and standard deviation of total rewards accumulated (denoted as score) by an agent during the trial, and for each experiment, we run five randomly-seeded trials.
183
+
184
+ ![](images/a370b5a34a3bf347dd0aa2d8955e00fdb6d5bda7c9d1abdb6913e9433d7f176f.jpg)
185
+ Figure 2: The performance of policies obtained from maximizing the learned rewards in the transfer learning problems. It can be seen that our method performs significantly better than AIRL (Fu et al., 2017) and exhibits expert-like performance in all five randomly-seeded trials which imply that our method learns near-optimal, transferable reward functions.
186
+
187
+ Table 1: The evaluation of reward learning on transfer learning tasks. Mean scores (higher the better) with standard deviation are presented over 5 trials.
188
+
189
+ <table><tr><td rowspan=1 colspan=1>Algorithm</td><td rowspan=1 colspan=1>States-Only</td><td rowspan=1 colspan=1>Pointmass-Maze</td><td rowspan=1 colspan=1>Crippled-Ant</td></tr><tr><td rowspan=1 colspan=1>Expert</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>-4.98 ± 0.29</td><td rowspan=1 colspan=1>432.66 ± 14.38</td></tr><tr><td rowspan=1 colspan=1>AIRL</td><td rowspan=1 colspan=1>Yes</td><td rowspan=1 colspan=1>-8.07±0.50</td><td rowspan=1 colspan=1>175.51士27.31</td></tr><tr><td rowspan=1 colspan=1>AIRL</td><td rowspan=1 colspan=1>No</td><td rowspan=1 colspan=1>-19.28 ± 2.03</td><td rowspan=1 colspan=1>46.12±14.37</td></tr><tr><td rowspan=1 colspan=1>EAIRL(Ours)</td><td rowspan=1 colspan=1>No</td><td rowspan=1 colspan=1>-7.01 ±0.61</td><td rowspan=1 colspan=1>348.43±43.17</td></tr></table>
190
+
191
+ 4.1 REWARD LEARNING PERFORMANCE (TRANSFER LEARNING EXPERIMENTS)
192
+
193
+ To evaluate the learned rewards, we consider a transfer learning problem in which the testing environments are made to be different from the training environments. More precisely, the rewards learned via IRL in the training environments are used to re-optimize a new policy in the testing environment using standard RL. We consider two test cases shown in the Fig. 1.
194
+
195
+ In the first test case, as shown in Fig. 1(a), we modify the agent itself during testing. We trained a reward function to make a standard quadruped ant to run forward. During testing, we disabled the front two legs (indicated in red) of the ant (crippled-ant), and the learned reward is used to reoptimize the policy to make a crippled-ant move forward. Note that the crippled-ant cannot move sideways (Appendix C.1). Therefore, the agent has to change the gait to run forward. In the second test case, shown in Fig 1(b), we change the environment structure. The agent learns to navigate a 2D point-mass to the goal region in a simple maze. We re-position the maze central-wall during testing so that the agent has to take a different path, compared to the training environment, to reach the target (Appendix C.2).
196
+
197
+ Fig. 2 compares the policy performance scores over five different trials of EAIRL, $\operatorname { A I R L } ( s )$ and $\mathrm { A I R L } ( s , a )$ in the aforementioned transfer learning tasks. The expert score is shown as a horizontal line to indicate the standard set by an expert policy. Table 1 summarizes the means and standard deviations of the scores over five trials. It can be seen that our method recovers near-optimal reward functions as the policy scores almost reach the expert scores in all five trials even after transfering to unseen testing environments. Furthermore, our method performs significantly better than both $\operatorname { A I R L } ( s )$ and $\mathrm { A I R L } ( s , a )$ in matching an expert’s performance, thus showing no downside to the EAIRL approach.
198
+
199
+ ![](images/174904d88386c1d78f7126fe49b4e3b3b7fb467a0e68c62fa22a1a090e4680f4.jpg)
200
+ Figure 3: Benchmark control tasks for imitation learning
201
+
202
+ # 4.2 POLICY LEARNING PERFORMANCE (IMITATION LEARNING)
203
+
204
+ Next, we considered the performance of the learned policy specifically for an imitation learning problem in various control tasks.The tasks, shown in Fig. 3, include (i) making a 2D halfcheetah robot to run forward, (ii) making a 3D quadruped robot (ant) to move forward, (iii) making a 2D swimmer to swim, and (iv) keeping a friction less pendulum to stand vertically up. For each algorithm, we provided 20 expert demonstrations generated by a policy trained on a ground-truth reward using TRPO (Schulman et al., 2015). Table 2 presents the means and standard deviations of policy learning performance scores, over the five different trials. It can be seen that EAIRL, $\mathrm { A I R L } ( s , a )$ and GAIL demonstrate similar performance and successfully learn to imitate the expert policy, whereas $\operatorname { A I R L } ( s )$ and GAN-GCL fails to recover a policy.
205
+
206
+ Table 2: The evaluation of imitation learning on benchmark control tasks. Mean scores (higher the better) with standard deviation are presented over 5 trials for each method.
207
+
208
+ <table><tr><td rowspan=2 colspan=1>Methods</td><td rowspan=1 colspan=4>Environments</td></tr><tr><td rowspan=1 colspan=1>HalfCheetah</td><td rowspan=1 colspan=1>Ant</td><td rowspan=1 colspan=1>Swimmer</td><td rowspan=1 colspan=1>Pendulum</td></tr><tr><td rowspan=1 colspan=1>Expert</td><td rowspan=1 colspan=1>2139.83 ± 30.22</td><td rowspan=1 colspan=1>935.12± 10.94</td><td rowspan=1 colspan=1>76.21 ± 1.79</td><td rowspan=1 colspan=1>-100.11 ± 1.32</td></tr><tr><td rowspan=1 colspan=1>GAIL</td><td rowspan=1 colspan=1>1880.05 ± 15.72</td><td rowspan=1 colspan=1>738.72 ± 9.49</td><td rowspan=1 colspan=1>50.21 ± 0.26</td><td rowspan=1 colspan=1>-116.01 ± 5.45</td></tr><tr><td rowspan=1 colspan=1>GCL</td><td rowspan=1 colspan=1>-189.90± 44.42</td><td rowspan=1 colspan=1>16.74 ± 36.59</td><td rowspan=1 colspan=1>15.75 ± 7.32</td><td rowspan=1 colspan=1>-578.18 ± 72.84</td></tr><tr><td rowspan=1 colspan=1>AIRL(s,a)</td><td rowspan=1 colspan=1>1826.26 ± 19.64</td><td rowspan=1 colspan=1>645.90 ± 41.75</td><td rowspan=1 colspan=1>49.52 ± 0.48</td><td rowspan=1 colspan=1>-118.13 ± 11.33</td></tr><tr><td rowspan=1 colspan=1>AIRL(s)</td><td rowspan=1 colspan=1>121.10± 42.31</td><td rowspan=1 colspan=1>271.31 ± 9.35</td><td rowspan=1 colspan=1>33.21 ± 2.40</td><td rowspan=1 colspan=1>-134.82 ± 10.89</td></tr><tr><td rowspan=1 colspan=1>EAIRL</td><td rowspan=1 colspan=1>1870.10± 17.86</td><td rowspan=1 colspan=1>641.12 ± 25.92</td><td rowspan=1 colspan=1>49.55± 0.29</td><td rowspan=1 colspan=1>-116.26 ± 8.313</td></tr></table>
209
+
210
+ # 5 DISCUSSION
211
+
212
+ This section highlights the importance of empowerment-regularized MaxEnt-IRL and modeling rewards as a function of both state and action rather than restricting to state-only formulation on learning rewards and policies from expert demonstrations.
213
+
214
+ In the scalable MaxEnt-IRL framework (Finn et al., 2016a; Fu et al., 2017), the normalization term is approximated by importance sampling where the importance-sampler/policy is trained to minimize the KL-divergence from the distribution over expert trajectories. However, merely minimizing the divergence between expert demonstrations and policy-generated samples leads to localized policy behavior which hinders learning generalized reward functions. In our proposed work, we regularize the policy update with empowerment i.e., we update our policy to reduce the divergence from expert data distribution as well as to maximize the empowerment (Eqn.12). The proposed regularization prevents premature convergence to local behavior which leads to robust state-action based rewards learning. Furthermore, empowerment quantifies the extent to which an agent can control/influence its environment in the given state. Thus the agent takes an action $a$ on observing a state $s$ such that it has maximum control/influence over the environment upon ending up in the future state $s ^ { \prime }$ .
215
+
216
+ Our experimentation also shows the importance of modeling discriminator/reward functions as a function of both state and action in reward and policy learning under GANs framework. The reward learning results show that state-only rewards (AIRL(s)) does not recover the action dependent terms of the ground-truth reward function that penalizes high torques. Therefore, the agent shows aggressive behavior and sometimes flips over after few steps (see the accompanying video), which is also the reason that crippled-ant trained with AIRL’s disentangled reward function reaches only the half-way to expert scores as shown in Table 1. Therefore, the reward formulation as a function of both states and actions is crucial to learning action-dependent terms required in most real-world applications, including any autonomous driving, robot locomotion or manipulation task where large torque magnitudes are discouraged or are dangerous. The policy learning results further validate the importance of the state-action reward formulation. Table 2 shows that methods with state-action reward/discriminator formulation can successfully recover expert-like policies. Hence, our empirical results show that it is crucial to model reward/discriminator as a function of state-action as otherwise, adversarial imitation learning fails to learn ground-truth rewards and expert-like policies from expert data.
217
+
218
+ # 6 CONCLUSIONS AND FUTURE WORK
219
+
220
+ We present an approach to adversarial reward and policy learning from expert demonstrations by regularizing the maximum-entropy inverse reinforcement learning through empowerment. Our method learns the empowerment through variational information maximization in parallel to learning the reward and policy. We show that our policy is trained to imitate the expert behavior as well to maximize the empowerment of the agent over the environment. The proposed regularization prevents premature convergence to local behavior and leads to a generalized policy that in turn guides the reward-learning process to recover near-optimal reward. We show that our method successfully learns near-optimal rewards, policies, and performs significantly better than state-of-the-art IRL methods in both imitation learning and challenging transfer learning problems. The learned rewards are shown to be transferable to environments that are dynamically or structurally different from training environments.
221
+
222
+ In our future work, we plan to extend our method to learn rewards and policies from diverse human/expert demonstrations as the proposed method assumes that a single expert generates the training data. Another exciting direction would be to build an algorithm that learns from sub-optimal demonstrations that contains both optimal and non-optimal behaviors.
223
+
224
+ # REFERENCES
225
+
226
+ Pieter Abbeel and Andrew Y Ng. Apprenticeship learning via inverse reinforcement learning. In Proceedings of the twenty-first international conference on Machine learning, pp. 1. ACM, 2004.
227
+
228
+ David Barber Felix Agakov. The im algorithm: a variational approach to information maximization. Advances in Neural Information Processing Systems, 16:201, 2004.
229
+
230
+ Brenna D Argall, Sonia Chernova, Manuela Veloso, and Brett Browning. A survey of robot learning from demonstration. Robotics and autonomous systems, 57(5):469–483, 2009.
231
+
232
+ Abdeslam Boularias, Jens Kober, and Jan Peters. Relative entropy inverse reinforcement learning. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, pp. 182–189, 2011.
233
+
234
+ Chelsea Finn, Paul Christiano, Pieter Abbeel, and Sergey Levine. A connection between generative adversarial networks, inverse reinforcement learning, and energy-based models. arXiv preprint arXiv:1611.03852, 2016a.
235
+
236
+ Chelsea Finn, Sergey Levine, and Pieter Abbeel. Guided cost learning: Deep inverse optimal control via policy optimization. In International Conference on Machine Learning, pp. 49–58, 2016b.
237
+
238
+ Justin Fu, Katie Luo, and Sergey Levine. Learning robust rewards with adversarial inverse reinforcement learning. arXiv preprint arXiv:1710.11248, 2017.
239
+
240
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in neural information processing systems, pp. 2672–2680, 2014.
241
+
242
+ Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. In Advances in Neural Information Processing Systems, pp. 4565–4573, 2016.
243
+
244
+ Mrinal Kalakrishnan, Peter Pastor, Ludovic Righetti, and Stefan Schaal. Learning objective functions for manipulation. In Robotics and Automation (ICRA), 2013 IEEE International Conference on, pp. 1331–1336. IEEE, 2013.
245
+
246
+ Markus Kuderer, Shilpa Gulati, and Wolfram Burgard. Learning driving styles for autonomous vehicles from demonstration. In Robotics and Automation (ICRA), 2015 IEEE International Conference on, pp. 2641–2646. IEEE, 2015.
247
+
248
+ 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.
249
+
250
+ 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.
251
+
252
+ Andrew Y Ng, Daishi Harada, and Stuart Russell. Policy invariance under reward transformations: Theory and application to reward shaping. In ICML, volume 99, pp. 278–287, 1999.
253
+
254
+ Andrew Y Ng, Stuart J Russell, et al. Algorithms for inverse reinforcement learning. In Icml, pp. 663–670, 2000.
255
+
256
+ Dean A Pomerleau. Efficient training of artificial neural networks for autonomous navigation. Neural Computation, 3(1):88–97, 1991.
257
+
258
+ Ahmed. H Qureshi, Yutaka Nakamura, Yuichiro Yoshikawa, and Hiroshi Ishiguro. Show, attend and interact: Perceivable human-robot social interaction through neural attention $\mathbf { q }$ -network. In Robotics and Automation (ICRA), 2017 IEEE International Conference on, pp. 1639–1645. IEEE, 2017.
259
+
260
+ Ahmed. H Qureshi, Yutaka Nakamura, Yuichiro Yoshikawa, and Hiroshi Ishiguro. Intrinsically motivated reinforcement learning for human–robot interaction in the real-world. Neural Networks, 2018.
261
+
262
+ Nathan D Ratliff, J Andrew Bagnell, and Martin A Zinkevich. Maximum margin planning. In Proceedings of the 23rd international conference on Machine learning, pp. 729–736. ACM, 2006.
263
+
264
+ Stephane Ross, Geoffrey Gordon, and Drew Bagnell. A reduction of imitation learning and struc- ´ tured prediction to no-regret online learning. In Proceedings of the fourteenth international conference on artificial intelligence and statistics, pp. 627–635, 2011.
265
+
266
+ Christoph Salge, Cornelius Glackin, and Daniel Polani. Empowerment–an introduction. In Guided Self-Organization: Inception, pp. 67–114. Springer, 2014.
267
+
268
+ 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.
269
+
270
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
271
+
272
+ Richard S Sutton, Andrew G Barto, et al. Introduction to reinforcement learning, volume 135. MIT press Cambridge, 1998.
273
+
274
+ Brian D Ziebart, Andrew L Maas, J Andrew Bagnell, and Anind K Dey. Maximum entropy inverse reinforcement learning. In AAAI, volume 8, pp. 1433–1438. Chicago, IL, USA, 2008.
275
+
276
+ # APPENDICES
277
+
278
+ # A VARIATIONAL EMPOWERMENT
279
+
280
+ For completeness, we present a derivation of presenting mutual information (MI) as variational lower bound and maximization of lower bound to learn empowerment.
281
+
282
+ # A.1 VARIATIONAL INFORMATION LOWER BOUND
283
+
284
+ As mentioned in section 2.3, the variational lower bound representation of MI is computed by defining MI as a difference in conditional entropies, and the derivation is formalized as follow.
285
+
286
+ $$
287
+ \begin{array} { r l } & { I ^ { w , q } ( s ) = H ( a | s ) - H ( a | s ^ { \prime } , s ) } \\ & { \qquad = H ( a | s ) + \mathbb { E } _ { p ( s ^ { \prime } \mid a , s ) w ( a \mid s ) } [ \log p ( a | s ^ { \prime } , s ) ] } \\ & { \qquad = H ( a | s ) + \mathbb { E } _ { p ( s ^ { \prime } \mid a , s ) w ( a \mid s ) } [ \log \frac { p ( a | s ^ { \prime } , s ) q ( a | s ^ { \prime } , s ) } { q ( a | s ^ { \prime } , s ) } ] } \\ & { \qquad = H ( a | s ) + \mathbb { E } _ { p ( s ^ { \prime } \mid a , s ) w ( a \mid s ) } [ \log q ( a | s ^ { \prime } , s ) ] + \mathbb { E } _ { p ( s ^ { \prime } \mid a , s ) w ( a \mid s ) } [ \log \frac { p ( a | s ^ { \prime } , s ) } { q ( a | s ^ { \prime } , s ) } ] } \\ & { \qquad = H ( a | s ) + \mathbb { E } _ { p ( s ^ { \prime } \mid a , s ) w ( a \mid s ) } [ \log q ( a | s ^ { \prime } , s ) ] + \mathbb { E } \mathrm { L } [ p ( a | s ^ { \prime } , s ) | q ( a | s ^ { \prime } , s ) ] } \\ & { \qquad = H ( a | s ) + \mathbb { E } _ { p ( s ^ { \prime } \mid a , s ) w ( a \mid s ) } [ \log q ( a | s ^ { \prime } , s ) ] } \\ & { \qquad \geq H ( a | s ) + \mathbb { E } _ { p ( s ^ { \prime } \mid a , s ) w ( a \mid s ) } [ \log q ( a | s ^ { \prime } , s ) ] } \\ & { \qquad \geq - \mathbb { E } _ { w ( a \mid s ) } \log w ( a | s ) + \mathbb { E } _ { p ( s ^ { \prime } \mid a , s ) w ( a \mid s ) } [ \log q ( a | s ^ { \prime } , s ) ] } \end{array}
288
+ $$
289
+
290
+ # A.2 VARIATIONAL INFORMATION MAXIMIZATION
291
+
292
+ The empowerment is a maximal of MI and it can be formalized as follow by exploiting the variational lower bound formulation (for details see (Mohamed & Rezende, 2015)).
293
+
294
+ $$
295
+ \Phi ( s ) = \operatorname* { m a x } _ { w , q } \mathbb { E } _ { p ( s ^ { \prime } \mid a , s ) w ( a \mid s ) } [ - \frac { 1 } { \beta } \log w ( a \mid s ) + \log q ( a \mid s ^ { \prime } , s ) ]
296
+ $$
297
+
298
+ As mentioned in section 2.3, given a training trajectories, the maximization of Eqn. 13 w.r.t inverse model $\boldsymbol { q } ( \boldsymbol { a } | \boldsymbol { s } ^ { \prime } , s )$ is a supervised maximum log-likelihood problem. The maximization of Eqn. 13 w.r.t $w ( a | s )$ is derived through a functional derivative $\partial I ^ { \bar { w } , q } / \partial w = 0$ under the constraint $\begin{array} { r } { \sum _ { a } w ( a | s ) = 1 } \end{array}$ . For simplicity, we consider discrete state and action spaces, and the derivation is as follow:
299
+
300
+ $$
301
+ \begin{array} { l } { { \displaystyle { \hat { I } } ^ { w } ( s ) = \mathbb { E } _ { p ( s ^ { \prime } \mid a , s ) w ( a \mid s ) } [ - \frac { 1 } { \beta } \log w ( a \mid s ) + \log q ( a \mid s ^ { \prime } , s ) ] + \lambda ( \sum _ { a } w ( a \mid s ) - 1 ) } } \\ { { \displaystyle ~ = \sum _ { a } \sum _ { s ^ { \prime } } p ( s ^ { \prime } \mid a , s ) w ( a \mid s ) \{ - \frac { 1 } { \beta } \log w ( a \mid s ) + \log q ( a \mid s ^ { \prime } , s ) \} + \lambda \big ( \sum _ { a } w ( a \mid s ) - 1 \big ) } } \end{array}
302
+ $$
303
+
304
+ $$
305
+ \begin{array} { r l } & { \displaystyle \frac { \partial \hat { I } ^ { w } ( s ) } { \partial w } = \sum _ { a } \{ ( \lambda - \beta ) - \log w ( a | s ) + \beta \mathbb { E } _ { p ( s ^ { \prime } \mid a , s ) } [ \log q ( a | s ^ { \prime } , s ) ] \} = 0 } \\ & { \displaystyle w ( a | s ) = e ^ { \lambda - \beta } e ^ { \beta \mathbb { E } _ { p ( s ^ { \prime } \mid a , s ) } [ \log q ( a | s ^ { \prime } , s ) ] } } \end{array}
306
+ $$
307
+
308
+ By using the constraint $\begin{array} { r } { \sum _ { a } w ( a | s ) = 1 } \end{array}$ , it can be shown that the optimal solution $w ^ { * } ( a | s ) \ =$ ${ \frac { 1 } { Z ( s ) } } \exp ( u ( s , a ) )$ , where $u ( s , a ) = \beta \mathbb { E } _ { p ( s ^ { \prime } \mid a , s ) } [ \log q ( a | s ^ { \prime } , s ) ]$ and $\begin{array} { r } { Z ( s ) = \sum _ { a } u ( s , a ) } \end{array}$ . This solution maximizes the lower bound since ∂2Iw(s)/∂w2 = − Pa $\partial ^ { 2 } I ^ { w } ( s ) / \partial w ^ { 2 } = - \sum _ { a } \frac { 1 } { w ( a | s ) } < 0 .$
309
+
310
+ # B EMPOWERMENT-REGULARIZED MAXENT-IRL FORMULATION.
311
+
312
+ In this section we derive the Empowerment-regularized formulation of maximum entropy IRL. Let $\tau$ be a trajectory sampled from expert demonstrations $D$ and $\begin{array} { r l } { p _ { \xi } ( \tau ) } & { { } \propto } \end{array}$ $p ( s _ { 0 } ) \Pi _ { t = 0 } ^ { T - 1 } p ( s _ { t + 1 } | s _ { t } , a _ { t } ) \exp ^ { r _ { \xi } ( s _ { t } , a _ { t } ) }$ be a distribution over $\tau$ . As mentioned in Section 2, the IRL objective is to maximize the likelihood:
313
+
314
+ $$
315
+ \operatorname* { m a x } _ { \xi } J ( \xi ) = \operatorname* { m a x } _ { \xi } \mathbb { E } _ { D } [ \log p _ { \xi } ( \tau ) ]
316
+ $$
317
+
318
+ Furthermore, as derived in (Fu et al., 2017), the gradient of above equation w.r.t $\xi$ can be written as:
319
+
320
+ $$
321
+ \begin{array} { r l r } & { } & { \underset { \xi } { \operatorname* { m a x } } J ( \xi ) = \mathbb { E } _ { D } [ \underset { t = 0 } { \overset { T } { \sum } } \frac { \partial } { \partial \xi } r _ { \xi } ( s _ { t } , a _ { t } ) ] - \mathbb { E } _ { p _ { \xi } } [ \underset { t = 0 } { \overset { T } { \sum } } \frac { \partial } { \partial \xi } r _ { \xi } ( s _ { t } , a _ { t } ) ] } \\ & { } & { = \underset { t = 0 } { \overset { T } { \sum } } \mathbb { E } _ { D } [ \frac { \partial } { \partial \xi } r _ { \xi } ( s _ { t } , a _ { t } ) ] - \mathbb { E } _ { p _ { \xi , t } } [ \frac { \partial } { \partial \xi } r _ { \xi } ( s _ { t } , a _ { t } ) ] } \end{array}
322
+ $$
323
+
324
+ where $r _ { \xi } ( \cdot )$ is a parametrized reward to be learned, and $\begin{array} { r } { p _ { \xi , t } = \int _ { s _ { t ^ { \prime } } \neq t , a _ { t ^ { \prime } } \neq t } p _ { \xi } ( \tau ) } \end{array}$ denotes marginalization of state-action at time $t$ . Since, it is unfeasible to draw samples from $p _ { \xi }$ , Finn et al. (2016a) proposed to train an importance sampling distribution $\mu ( \tau )$ whose varience is reduced by defining $\mu ( \tau )$ as a mixture of polices, i.e., $\mu ( a | s ) = { \frac { 1 } { 2 } } ( \pi ( a | s ) + \hat { p } ( a | s ) )$ , where $\hat { p }$ is a rough density estimate over demonstrations. Thus the above gradient becomes:
325
+
326
+ $$
327
+ \frac { \partial } { \partial \xi } J ( \xi ) = \sum _ { t = 0 } ^ { T } \mathbb { E } _ { D } [ \frac { \partial } { \partial \xi } r _ { \xi } ( s _ { t } , a _ { t } ) ] - \mathbb { E } _ { \mu _ { t } } [ \frac { p _ { \xi , t } ( s _ { t } , a _ { t } ) } { \mu _ { t } ( s _ { t } , a _ { t } ) } \frac { \partial } { \partial \xi } r _ { \xi } ( s _ { t } , a _ { t } ) ]
328
+ $$
329
+
330
+ We train our importance-sampler/policy $\pi$ to maximize the empowerment $\Phi ( \cdot )$ for generalization and to reduce divergence from true distribution by minimizing $D _ { \mathrm { K L } } ( \pi ( \tau ) \lVert p _ { \xi } ( \tau ) )$ . Since, $\pi ( \tau ) =$ $p ( s _ { 0 } ) \Pi _ { t = 0 } ^ { T - 1 } p ( s _ { t + 1 } | s _ { t } , a _ { t } ) \pi ( s _ { t } , a _ { t } )$ , the matching terms of $\pi ( \tau )$ and $p _ { \xi } ( \tau )$ cancel out, resulting into entropy-regularized policy update. Furthermore, as we also include the empowerment $\Phi ( \cdot )$ in the policy update to be maximized, hence the overall objective becomes:
331
+
332
+ $$
333
+ \operatorname* { m a x } _ { \pi } \mathbb { E } _ { \pi } [ \sum _ { t = 0 } ^ { T - 1 } r _ { \xi } ( s _ { t } , a _ { t } ) + \Phi ( s _ { t + 1 } ) - \log \pi ( a _ { t } | s _ { t } ) ]
334
+ $$
335
+
336
+ Our discriminator is trained to minimize cross entropy loss as mention in Eqn. 10, and for the proposed structure of our discriminator Eqn. 9, it can be shown that the discriminator’s gradient w.r.t its parameters turns out to be equal to Equation 14 (for more details, see $\mathrm { F u }$ et al., 2017)). On the other hand, our policy training objective is
337
+
338
+ $$
339
+ r _ { \pi } ( s , a , s ^ { \prime } ) = \log ( D ( s , a , s ^ { \prime } ) ) - \log ( 1 - D ( s , a , s ^ { \prime } ) ) - l _ { I } ( s , a , s ^ { \prime } )
340
+ $$
341
+
342
+ In the next section, we show that the above policy training objective is equivalent to Equation 15.
343
+
344
+ # B.1 POLICY OBJECTIVE
345
+
346
+ We train our policy to maximize the discriminative reward $\begin{array} { r } { \hat { r } ( s , a , s ^ { \prime } ) = \log ( D ( s , a , s ^ { \prime } ) - \log ( 1 - } \end{array}$ $D ( s , a , s ^ { \prime } ) ) ,$ ) and minimize the information-theoretic loss function $l _ { I } ( s , a , s ^ { \prime } )$ . The discriminative reward ${ \hat { r } } ( s , a , s ^ { \prime } )$ simplifies to:
347
+
348
+ $$
349
+ \begin{array} { r l } & { \hat { r } ( s , a , s ^ { \prime } ) = \log ( D ( s , a , s ^ { \prime } ) ) - \log ( 1 - D ( s , a , s ^ { \prime } ) ) } \\ & { \quad \quad \quad = \log \frac { e ^ { f ( s , a , s ^ { \prime } ) } } { e ^ { f ( s , a , s ^ { \prime } ) } + \pi ( a | s ) } - \log \frac { \pi ( a | s ) } { e ^ { f ( s , a , s ^ { \prime } ) } + \pi ( a | s ) } } \\ & { \quad \quad = f ( s , a , s ^ { \prime } ) - \log \pi ( a | s ) } \end{array}
350
+ $$
351
+
352
+ where $f ( s , a , s ^ { \prime } ) = r ( s , a ) + \gamma \Phi ( s ^ { \prime } ) - \Phi ( s )$ . The entropy-regularization is usually scaled by the hyperparameter, let say $\lambda _ { h } \in \mathbb { R }$ , thus ${ \hat { r } } ( s , a , s ^ { \prime } ) = f ( s , a , s ^ { \prime } ) ^ { - } \lambda _ { h } \log \pi ( a | s )$ . Hence, assuming
353
+
354
+ single-sample $( s , a , s ^ { \prime } )$ , absolute-error for $l _ { I } ( s , a , s ^ { \prime } ) = | \log q _ { \phi } ( a | s , s ^ { \prime } ) - ( \log \pi ( a | s ) + \Phi ( s ) ) |$ , and $l _ { i } > 0$ , the policy is trained to maximize following:
355
+
356
+ $$
357
+ \begin{array} { r l } & { r _ { \pi } ( s , a , s ^ { \prime } ) = f ( s , a , s ^ { \prime } ) - \lambda _ { h } \log \pi ( a | s ) - l _ { I } ( s , a , s ^ { \prime } ) } \\ & { \qquad = r ( s , a ) + \gamma \Phi ( s ^ { \prime } ) - \Phi ( s ) - \lambda _ { h } \log \pi ( a | s ) - \log q ( a | s , s ^ { \prime } ) + \log \pi ( a | s ) + \Phi ( s ) } \\ & { \qquad = r ( s , a ) + \gamma \Phi ( s ^ { \prime } ) - \lambda _ { h } \log \pi ( a | s ) - \log q ( a | s , s ^ { \prime } ) + \log \pi ( a | s ) } \end{array}
358
+ $$
359
+
360
+ Note that, the potential function $\Phi ( s )$ cancels out and we scale the leftover terms of $l _ { I }$ with a hyperparameter $\lambda _ { I }$ . Hence, the above equation becomes:
361
+
362
+ $$
363
+ r _ { \pi } ( s , a , s ^ { \prime } ) = r ( s , a , s ^ { \prime } ) + \gamma \Phi ( s ^ { \prime } ) + ( \lambda _ { I } - \lambda _ { h } ) \log \pi ( a | s ) - \lambda _ { I } \log q ( a | s , s ^ { \prime } )
364
+ $$
365
+
366
+ We combine the log terms together as:
367
+
368
+ $$
369
+ r _ { \pi } ( s , a , s ^ { \prime } ) = r ( s , a ) + \lambda _ { I } \Phi ( s ^ { \prime } ) + \lambda \hat { H } ( \cdot )
370
+ $$
371
+
372
+ where $\lambda$ is a hyperparameter, and ${ \hat { H } } ( \cdot )$ is an entropy regularization term depending on $\boldsymbol { q } ( \boldsymbol { a } | \boldsymbol { s } , \boldsymbol { s } ^ { \prime } )$ and $\pi ( a | s )$ . Therefore, it can be seen that the Eqn. 17 is equivalent/approximation to Eqn. 15.
373
+
374
+ # C TRANSFER LEARNING PROBLEMS
375
+
376
+ # C.1 ANT ENVIRONMENT
377
+
378
+ The following figures show the difference between the path profiles of standard and crippled Ant. It can be seen that the standard Ant can move sideways whereas the crippled ant has to rotate in order to move forward.
379
+
380
+ ![](images/5c85467297bd6e612c4184a569da99dd26f3c54ade48a1e6c6789dd4db5a4096.jpg)
381
+ Figure 4: The top and bottom rows show the gait of standard and crippled ant, respectively.
382
+
383
+ # C.2 MAZE ENVIRONMENT
384
+
385
+ The following figures show the path profiles of a 2D point-mass agent to reach the target in training and testing environment. It can be seen that in the testing environment the agent has to take the opposite route compared to the training environment to reach the target.
386
+
387
+ # D IMPLEMENTATION DETAILS
388
+
389
+ # D.1 NETWORK ARCHITECTURES
390
+
391
+ We use two-layer ReLU network with 32 units in each layer for the potential function $h _ { \varphi } ( \cdot )$ and $\Phi _ { \varphi } ( \cdot )$ , reward function $r _ { \xi } ( \cdot )$ , discriminators of GAIL and GAN-GCL. Furthermore, policy $\operatorname { \bar { \pi } } _ { \boldsymbol { \theta } } ( \cdot )$ of
392
+
393
+ ![](images/b5b15eb1a739579cd29d90958ffe1ea8478e3344639f48662d073f9aed090626.jpg)
394
+ Figure 5: The top and bottom rows show the path followed by a 2D point-mass agent (yellow) to reach the target (green) in training and testing environment, respectively.
395
+
396
+ all presented models and the inverse model $q _ { \phi } ( \cdot )$ of EAIRL are presented by two-layer RELU network with 32 units in each layer, where the network’s output parametrizes the Gaussian distribution, i.e., we assume a Gaussian policy.
397
+
398
+ # D.2 HYPERPARAMETERS
399
+
400
+ For all experiments, we use the temperature term $\beta = 1$ . We evaluated both mean-squared and absolute error forms of $l _ { I } ( s , a , s ^ { \prime } )$ and found that both lead to similar performance in reward and policy learning. We set entropy regularization weight to 0.1 and 0.001 for reward and policy learning, respectively. The hyperparameter $\lambda _ { I }$ was set to 1.0 for reward learning and 0.001 for policy learning. The target parameters of the empowerment-based potential function $\Phi _ { \varphi ^ { \prime } } ( \cdot )$ were updated every 5 and 2 epochs during reward and policy learning respectively. Although reward learning hyperparameters are also applicable to policy learning, we decrease the magnitude of entropy and information regularizers during policy learning to speed up the policy convergence to optimal values. Furthermore, we set the batch size to 2000- and 20000-steps per TRPO update for the pendulum and remaining environments, respectively. For the methods (Fu et al., 2017; Ho & Ermon, 2016) presented for comparison, we use their suggested hyperparameters. We also use policy samples from previous 20 iterations as negative data to train the discriminator of all IRL methods presented in this paper to prevent the parametrized reward functions from overfitting the current policy samples.
md/train/HJx9EhC9tQ/HJx9EhC9tQ.md ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # REASONING ABOUT PHYSICAL INTERACTIONS WITH OBJECT-ORIENTED PREDICTION AND PLANNING
2
+
3
+ Michael Janner†, Sergey Levine†, William T. Freeman‡, Joshua B. Tenenbaum‡, Chelsea Finn†, & Jiajun $\mathbf { W } \mathbf { u } ^ { \ddag }$
4
+
5
+ †University of California, Berkeley ‡Massachusetts Institute of Technology {janner,svlevine,cbfinn}@berkeley.edu {billf,jbt,jiajunwu}@mit.edu
6
+
7
+ # ABSTRACT
8
+
9
+ Object-based factorizations provide a useful level of abstraction for interacting with the world. Building explicit object representations, however, often requires supervisory signals that are difficult to obtain in practice. We present a paradigm for learning object-centric representations for physical scene understanding without direct supervision of object properties. Our model, Object-Oriented Prediction and Planning (O2P2), jointly learns a perception function to map from image observations to object representations, a pairwise physics interaction function to predict the time evolution of a collection of objects, and a rendering function to map objects back to pixels. For evaluation, we consider not only the accuracy of the physical predictions of the model, but also its utility for downstream tasks that require an actionable representation of intuitive physics. After training our model on an image prediction task, we can use its learned representations to build block towers more complicated than those observed during training.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Consider the castle made out of toy blocks in Figure 1a. Can you imagine how each block was placed, one-by-one, to build this structure? Humans possess a natural physical intuition that aids in the performance of everyday tasks. This physical intuition can be acquired, and refined, through experience. Despite being a core focus of the earliest days of artificial intelligence and computer vision research (Roberts, 1963; Winston, 1970), a similar level of physical scene understanding remains elusive for machines.
14
+
15
+ Cognitive scientists argue that humans’ ability to interpret the physical world derives from a richly structured apparatus. In particular, the perceptual grouping of the world into objects and their relations constitutes core knowledge in cognition (Spelke & Kinzler, 2007). While it is appealing to apply such an insight to contemporary machine learning methods, it is not straightforward to do so. A fundamental challenge is the design of an interface between the raw, often high-dimensional observation space and a structured, object-factorized representation. Existing works that have investigated the benefit of using objects have either assumed that an interface to an idealized object space already exists or that supervision is available to learn a mapping between raw inputs and relevant object properties (for instance, category, position, and orientation).
16
+
17
+ Assuming access to training labels for all object properties is prohibitive for at least two reasons. The most apparent concern is that curating supervision for all object properties of interest is difficult to scale for even a modest number of properties. More subtly, a representation based on semantic attributes can be limiting or even ill-defined. For example, while the size of an object in absolute terms is unambiguous, its orientation must be defined with respect to a canonical, class-specific orientation. Object categorization poses another problem, as treating object identity as a classification problem inherently limits a system to a predefined vocabulary.
18
+
19
+ ![](images/65521d503dce4508e8ac24e5af384324c988529b6d684e8cf7943e7c03bccac4.jpg)
20
+ Figure 1: (a) A toy block castle. (b) Our method’s build of the observed castle, using its learned object representations as a guide during planning.
21
+
22
+ ![](images/0ee44ac7924b4b8b38c4d51911f991bd59561b412f6d7f20341cc1170e068cf2.jpg)
23
+ c) O2P2: Object factorization without object property supervision
24
+
25
+ ![](images/20cff57ad2fcc5617471bf71cb5229136f9996c81633636e5deb322644ef84f7.jpg)
26
+ b) Object property supervision
27
+ Figure 2: We divide physical understanding tasks into three distinct paradigms. (a) The first approach makes the fewest assumptions, posing prediction tasks as an instance of image-to-image translation. (b) The second uses ground-truth labels of object properties to supervise a learning algorithm that can map to the space of a traditional or learned physics engine. (c) O2P2, like (b), employs an object factorization and the functional structure of a physics engine, but like (a), does not assume access to supervision of object properties. Without object-level supervision, we must jointly learn a perception function to map from images to objects, a physics engine to simulate a collection of objects, and a rendering engine to map a set of objects back to a single composite image prediction. In all three approaches, we highlight the key supervision in orange.
28
+
29
+ In this paper, we propose Object-Oriented Prediction and Planning (O2P2), in which we train an object representation suitable for physical interactions without supervision of object attributes. Instead of direct supervision, we demonstrate that segments or proposal regions in video frames, without correspondence between frames, are sufficient supervision to allow a model to reason effectively about intuitive physics. We jointly train a perception module, an object-factorized physics engine, and a neural renderer on a physics prediction task with pixel generation objective. We evaluate our learned model not only on the quality of its predictions, but also on its ability to use the learned representations for tasks that demand a sophisticated physical understanding.
30
+
31
+ # 2 OBJECT-ORIENTED PREDICTION AND PLANNING (O2P2)
32
+
33
+ In this section, we describe a method for learning object-based representations suitable for planning in physical reasoning tasks. As opposed to much prior work on object-factorized scene representations (Section 4), we do not supervise the content of the object representations directly by way of labeled attributes (such as position, velocity, or orientation). Instead, we assume access only to segments or region proposals for individual video frames. Since we do not have labels for the object representations, we must have a means for converting back and forth between images and object representations for training. O2P2 consists of three components, which are trained jointly:
34
+
35
+ • A perception module that maps from an image to an object encoding. The perception module is applied to each object segment independently.
36
+ • A physics module to predict the time evolution of a set of objects. We formulate the engine as a sum of binary object interactions plus a unary transition function.
37
+ • A rendering engine that produces an image prediction from a variable number of objects. We first predict an image and single-channel heatmap for each object. We then combine all of the object images according to the weights in their heatmaps at every pixel location to produce a single composite image.
38
+
39
+ A high-level overview of the model is shown in Figure 2c. Below, we give details for the design of each component and their subsequent use in a model-based planning setting.
40
+
41
+ # 2.1 PERCEPTION MODULE
42
+
43
+ The perception module is a four-layer convolutional encoder that maps an image observation to object representation vectors $\mathbf { O } = \{ o _ { k } \} _ { k = 1 \dots N }$ . We assume access to a segmentation of the input image $\mathbf { S } = \{ s _ { k } \} _ { k = 1 \ldots N }$ and apply the encoder individually to each segment. The perception module is not supervised directly to predict semantically meaningful properties such as position or orientation; instead, its outputs are used by the physics and rendering modules to make image predictions. In this way, the perception module must be trained jointly with the other modules.
44
+
45
+ # 2.2 PHYSICS MODULE
46
+
47
+ The physics module predicts the effects of simulating a collection of object representations $\mathbf { O }$ forward in time. As in Chang et al. (2016); Watters et al. (2017), we consider the interactions of all pairs of object vectors. The physics engine contains two learned subcomponents: a unary transition function $f _ { \mathrm { t r a n s } }$ applied to each object representation independently, and a binary interaction function $f _ { \mathrm { i n t e r a c t } }$ applied to all pairs of object representations. Letting $\bar { \bf O } \doteq \{ \bar { o } _ { k } \} _ { k = 1 \dots N }$ denote the output of the physics predictor, the $k ^ { \mathrm { { t h } } }$ object is given by $\begin{array} { r } { \bar { o } _ { k } = f _ { \mathrm { t r a n s } } ( o _ { k } ) + \sum _ { j \neq k } f _ { \mathrm { i n t e r a c t } } ( o _ { k } , o _ { j } ) + o _ { k } } \end{array}$ , where both $f _ { \mathrm { t r a n s } }$ and $f _ { \mathrm { i n t e r a c t } }$ are instantiated as two-layer MLPs.
48
+
49
+ Much prior work has focused on learning to model physical interactions as an end goal. In contrast, we rely on physics predictions only insofar as they affect action planning. To that end, it is more important to know the resultant effects of an action than to make predictions at a fixed time interval. We therefore only need to make a single prediction, $\bar { \bf O } = f _ { \mathrm { p h y s i c s } } ( { \bf O } )$ , to estimate the steady-state configuration of objects as a result of simulating physics indefinitely. This simplification avoids the complications of long-horizon sequential prediction while retaining the information relevant to planning under physical laws and constraints.
50
+
51
+ # 2.3 RENDERING ENGINE
52
+
53
+ Because our only supervision occurs at the pixel level, to train our model we learn to map all objectvector predictions back to images. A challenge here lies in designing a function which constructs a single image from an entire collection of objects. The learned renderer consists of two networks, both instantiated as convolutional decoders. The first network predicts an image independently for each input object vector. Composing these images into a single reconstruction amounts to selecting which object is visible at every pixel location. In a traditional graphics engine, this would be accomplished by calculating a depth pass at each location and rendering the nearest object.
54
+
55
+ To incorporate this structure into our learned renderer, we use the second decoder network to produce a single-channel heatmap for each object. The composite scene image is a weighted average of all of the object-specific renderings, where the weights come from the negative of the predicted heatmaps. In effect, objects with lower heatmap predictions at a given pixel location will be more visible than objects with higher heatmap values. This encourages lower heatmap values for nearer objects. Although this structure is reminiscent of a depth pass in a traditional renderer, the comparison should not be taken literally; the model is only supervised by composite images and no true depth maps are provided during training.
56
+
57
+ # 2.4 LEARNING OBJECT REPRESENTATIONS
58
+
59
+ We train the perception, physics, and rendering modules jointly on an image reconstruction and prediction task. Our training data consists of image pairs $( I _ { 0 } , I _ { 1 } )$ depicting a collection of objects on a platform before and after a new object has been dropped. $I _ { 0 }$ shows one object mid-air, as if being held in place before being released. We refer to Section 3 for details about the generation of training data.) We assume access to a segmentation $\mathbf { S } _ { 0 }$ for the initial image $I _ { 0 }$ .
60
+
61
+ Given the observed segmented image $\mathbf { S } _ { 0 }$ , we predict object representations using the perception module $\mathbf { O } \ = \ f _ { \mathrm { p e r c e p t } } ( \mathbf { \bar { S } _ { 0 } } )$ and their time-evolution using the physics module $\bar { \bf O } { } = { } \bar { f } _ { \mathrm { p h y s i c s } } \mathrm { ( { \bf O } ) }$ . The rendering engine then predicts an image from each of the object representations: $\hat { I } _ { 0 } ~ =$ $f _ { \mathrm { r e n d e r } } ( \mathbf { O } ) , \hat { I _ { 1 } } \bar { = f _ { \mathrm { r e n d e r } } } ( \bar { \mathbf { O } } )$ .
62
+
63
+ We compare each image prediction $\hat { I } _ { t }$ to its ground-truth counterpart using both $\mathcal { L } _ { 2 }$ distance and a perceptual loss ${ \mathcal { L } } _ { \mathrm { V G G } }$ . As in Johnson et al. (2016), we use $\mathcal { L } _ { 2 }$ distance in the feature space of a
64
+
65
+ # Algorithm 1 Planning Procedure
66
+
67
+ <table><tr><td rowspan="17">1: 2: 3: 4: 5: 6: 11:</td><td rowspan="8">Input perception,physics,and rendering modules fpercept, fphysics,frender Input goal image Igoal with N segments Sgoal {a 二 }k=1...N</td></tr><tr><td>Encode the goal image into a set of N object representations Ogoal ={a}k=1.. = fprcepr(Sgal)</td></tr><tr><td>while Ogoal is nonempty do</td></tr><tr><td>Segment the objects that have already been placed to yield Scurr</td></tr><tr><td>for m=1toMdo</td></tr><tr><td>Sample action am of the form (shape,position,orientation,color) from uniform distribution</td></tr><tr><td>Observe action am as a segment sm by moving object to specified position and orientation</td></tr><tr><td>Concatenate the observation and segments of existing objects Sm={Sm}U Seurr</td></tr><tr><td>7: Encode segments Sm into a set of object representations Om = fpercept(Sm)</td></tr><tr><td>8: 9:</td></tr><tr><td></td></tr><tr><td>Predict the efects of simulating physics on the object representations Om =fphysics(Om) 10:</td></tr><tr><td>Select the representation ö E Om of the object placed by sampled action am Findthe goal object gmthatisclosest too:gm=arg mial 一|2</td></tr><tr><td></td></tr><tr><td>12:</td><td>Compute the corresponding distance dm = |lc 1m 一|2</td></tr><tr><td>13:</td><td>end for</td></tr><tr><td>14:</td><td></td></tr><tr><td></td><td>Select action am* with the minimal distance to its nearest goal object: m* = arg minm dm.</td></tr><tr><td>15: 16: end while</td><td></td></tr></table>
68
+
69
+ pretrained VGG network (Simonyan & Zisserman, 2014) as a perceptual loss function. The perception module is supervised by the reconstruction of $I _ { 0 }$ , the physics engine is supervised by the reconstruction of $I _ { 1 }$ , and the rendering engine is supervised by the reconstruction of both images. Specifically, $\mathcal { L } _ { \mathrm { p e r c e p t } } ( \cdot ) = \mathcal { L } _ { 2 } ( \hat { I } _ { 0 } , I _ { 0 } ) \overset { = } + \mathcal { L } _ { \mathrm { V G G } } ( \hat { I } _ { 0 } , I _ { 0 } ) , \mathcal { L } _ { \mathrm { p h y s i c s } } ( \cdot ) = \mathcal { L } _ { 2 } ( \hat { I } _ { 1 } , I _ { 1 } ) + \mathcal { L } _ { \mathrm { V G G } } ( \hat { I } _ { 1 } , I _ { 1 } )$ , and ${ \mathcal { L } } _ { \mathrm { r e n d e r } } ( \cdot ) = { \dot { \mathcal { L } } } _ { \mathrm { p e r c e p t } } ( \cdot ) + { \mathcal { L } } _ { \mathrm { p h y s i c s } } ( \cdot )$ .
70
+
71
+ # 2.5 PLANNING WITH LEARNED MODELS
72
+
73
+ We now describe the use of our perception, physics, and rendering modules in the representative planning task depicted in Figure 1, in which the goal is to build a block tower to match an observed image. Here, matching a tower does not refer simply to producing an image from the rendering engine that looks like the observation. Instead, we consider the scenario where the model must output a sequence of actions to construct the configuration.
74
+
75
+ This setting is much more challenging because there is an implicit sequential ordering to building such a tower. For example, the bottom cubes must be placed before the topmost triangle. O2P2 was trained solely on a pixel-prediction task, in which it was never shown such valid action orderings (or any actions at all). However, these orderings are essentially constraints on the physical stability of intermediate towers, and should be derivable from a model with sufficient understanding of physical interactions.
76
+
77
+ Although we train a rendering function as part of our model, we guide the planning procedure for constructing towers solely through errors in the learned object representation space. The planning procedure, described in detail in Algorithm 1, can be described at a high level in four components:
78
+
79
+ 1. The perception module encodes the segmented goal image into a set of object representations Ogoal.
80
+ 2. We sample actions of the form (shape, position, orientation, color), where shape is categorical and describes the type of block, and the remainder of the action space is continuous and describes the block’s appearance and where it should be dropped.
81
+ 3. We evaluate the samples by likewise encoding them as object vectors and comparing them with $\mathbf { O } ^ { \mathrm { g o a l } }$ . We view action sample $a _ { m }$ as an image segment $s _ { m }$ (analogous to observing a block held in place before dropping it) and use the perception module to produce object vectors ${ \bf O } ^ { \mathrm { m } }$ . Because the actions selected should produce a stable tower, we run these object representations through the physics engine to yield $\vec { \bf O } ^ { \mathrm { m } }$ before comparing with $\mathbf { O } ^ { \mathrm { g o a l } }$ . The cost is the $\mathcal { L } _ { 2 }$ distance between the object $\bar { \mathbf { o } } \in \bar { \mathbf { O } } ^ { m }$ corresponding to the most recent action and the goal object in $\mathbf { O } ^ { \mathrm { g o a l } }$ that minimizes this distance.
82
+ 4. Using the action sampler and evaluation metric, we select the sampled action that minimizes $\mathcal { L } _ { 2 }$ distance. We then execute that action in MuJoCo (Todorov et al., 2012). We continue this procedure, iteratively re-planning and executing actions, until there are as many actions in the
83
+
84
+ ![](images/f1bb5598a51bca52ac525bd00cf2540ecf6e8f52d703c6c8ba24187a2aa84735.jpg)
85
+ Figure 3: Given an observed segmented image $I _ { 0 }$ at $t ~ = ~ 0$ , our model predicts a set of object representations O, simulates the objects with a learned physics engine to produce $\bar { \bf O } = f _ { \mathrm { p h y s i c s } } ( { \bf \bar { O } } )$ , and renders the resulting predictions $\hat { I } = f _ { \mathrm { r e n d e r } } ( \bar { \bf O } )$ , the scene’s appearance at a later time. We use the convention (in all figures) that observations are outlined in green, other images rendered with the ground-truth renderer are outlined in black, and images rendered with our learned renderer are outlined in blue.
86
+
87
+ executed sequence as there are objects in the goal image. In the simplest case, the distribution from which actions are sampled may be uniform, as in Algorithm 1. Alternatively, the crossentropy method (CEM) (Rubinstein & Kroese, 2004) may be used, repeating the sampling loop multiple times and fitting a Gaussian distribution to the lowest-cost samples. In practice, we used CEM starting from a uniform distribution with five iterations, 1000 samples per iteration, and used the top $10 \%$ of samples to fit the subsequent iteration’s sampling distribution.
88
+
89
+ # 3 EXPERIMENTAL EVALUATION
90
+
91
+ In our experimental evaluation, we aim to answer the following questions, (1) After training solely on physics prediction tasks, can O2P2 reason about physical interactions in an actionable and useful way? (2) Does the implicit object factorization imposed by O2P2’s structure provide a benefit over an object-agnostic black-box video prediction approach? (3) Is an object factorization still useful even without supervision for object representations?
92
+
93
+ # 3.1 IMAGE RECONSTRUCTION AND PREDICTION
94
+
95
+ We trained O2P2 to reconstruct observed objects and predict their configuration after simulating physics, as described in Section 2.4. To generate training data, we simulated dropping a block on top of a platform containing up to four other blocks. We varied the position, color, and orientation of three block varieties (cubes, rectangular cuboids, and triangles). In total, we collected 60,000 training images using the MuJoCo simulator. Since our physics engine did not make predictions at every timestep (Section 2.2), we only recorded the initial and final frame of a simulation. For this synthetic data, we used ground truth segmentations corresponding to visible portions of objects.
96
+
97
+ Representative predictions of our model for image reconstruction (without physics) and prediction (with physics) on held-out random configurations are shown in Figure 3. Even when the model’s predictions differed from the ground truth image, such as in the last row of the figure, the physics engine produced a plausible steady-state configuration of the observed scene.
98
+
99
+ # 3.2 BUILDING TOWERS
100
+
101
+ After training O2P2 on the random configurations of blocks, we fixed its parameters and employed the planning procedure as described in Section 2.5 to build tower configurations observed in images. We also evaluated the following models as comparisons:
102
+
103
+ • No physics is an ablation of our model that does not run the learned physics engine, but instead simply sets $\bar { \mathbf { O } } = \mathbf { O }$ • Stochastic adversarial video prediction (SAVP), a block-box video prediction model which does not employ an object factorization Lee et al. (2018). The cost function of samples is evaluated directly on pixels. The sampling-based planning routine is otherwise the same as in ours.
104
+
105
+ ![](images/f10d83dc3c69bf16e9a9b400372c78008ca5fa14e7030a81853a49eb094b551f.jpg)
106
+ Figure 4: Qualitative results on building towers using planning. Given an image of the goal tower, we can use the learned object representations and predictive model in O2P2 for guiding a planner to place blocks in the world and recreate the configuration. We compare with an ablation, an objectagnostic video prediction model, and two ‘oracles’ with access to the ground-truth simulator.
107
+
108
+ Table 1: Accuracy $( \% )$ of block tower builds by our approach and the four comparison models. Our model outperforms Oracle (pixels) despite not having the ground-truth simulator by virtue of a more appropriate object-factorized objective to guide the planning procedure.
109
+
110
+ <table><tr><td>No physics</td><td>SAVP</td><td>Ours</td><td>Oracle (pixels)</td><td>Oracle (objects)</td></tr><tr><td>0</td><td>24</td><td>76</td><td>71</td><td>92</td></tr></table>
111
+
112
+ • Oracle (pixels) uses the MuJoCo simulator to evaluate samples instead of our learned physics and graphics engines. The cost of a block configuration is evaluated directly in pixel space using $\mathcal { L } _ { 2 }$ distance.
113
+
114
+ • Oracle (objects) also uses MuJoCo, but has access to segmentation masks on input images while evaluating the cost of proposals. Constraining proposed actions to account for only a single object in the observation resolves some of the inherent difficulties of using pixel-wise loss functions.
115
+
116
+ Qualitative results of all models are shown in Figure 4 and a quantitative evaluation is shown in Table 1. We evaluated tower stacking success by greedily matching the built configuration to the ground-truth state of the goal tower, and comparing the maximum object error (defined on its position, identity, and color) to a predetermined threshold. Although the threshold is arbitrary in the sense that it can be chosen low enough such that all builds are incorrect, the relative ordering of the models is robust to changes in this value. All objects must be of the correct shape for a built tower to be considered correct, meaning that our third row prediction in Figure 4 was incorrect because a green cube was mistaken for a green rectangular cuboid.
117
+
118
+ While SAVP made accurate predictions on the training data, it did not generalize well to these more complicated configurations with more objects per frame. As such, its stacking success was low. Physics simulation was crucial to our model, as our No-physics ablation failed to stack any towers correctly. We explored the role of physics simulation in the stacking task in Section 3.3. The ‘oracle’ model with access to the ground-truth physics simulator was hampered when making comparisons in pixel space. A common failure mode of this model was to drop a single large block on the first step to cover the visual area of multiple smaller blocks in the goal image. This scenario was depicted by the blue rectangular cuboid in the first row of Figure 4 in the Oracle (pixels) column.
119
+
120
+ # 3.3 THE IMPORTANCE OF UNDERSTANDING PHYSICS
121
+
122
+ Figure 5 depicts the entire planning and execution procedure for O2P2 on a pyramid of six blocks. At each step, we visualize the process by which our model selects an action by showing a heatmap of scores (negative MSE) for each action sample according to the sample’s $( x , y )$ position (Figure 5a). Although the model is never trained to produce valid action decisions, the planning procedure selects a physically stable sequence of actions. For example, at the first timestep, the model scores three $x$ -locations highly, corresponding to the three blocks at the bottom of the pyramid. It correctly determines that the height at which it releases a block at any of these locations does not particularly matter, since the block will drop to the correct height after running the physics engine. Figure 5b shows the selected action at each step, and Figure 5c shows the model’s predictions about the configuration after releasing the sampled block.
123
+
124
+ ![](images/4a4663dec8c3b1423fded92a5da17b95d0b16eda57fecc84dd33005d793d5fe3.jpg)
125
+ Figure 5: (a) Visualization of scored locations for dropping an object at each timestep. Because O2P2 simulates physics before selecting an action, it is able to plan a sequence of stable actions. (b) The selected block and drop position from the scored samples, outlined in white. (c) The prediction from our physics model of the result of running physics on the selected block.
126
+
127
+ ![](images/16736d3a32861dab38fe38d3f6cd4fd24dcc72ac8a089c7882784f31c5b0ff90.jpg)
128
+ Figure 6: Heatmaps showing sampled action scores for the initial action given a goal block tower. O2P2’s scores reflect that the objects resting directly on the platform must be dropped first, and that they may be dropped from any height because they will fall to the ground. The No-physics ablation, on the other hand, does not implicitly represent that the blocks need to be dropped in a stable sequence of actions because it does not predict the blocks moving after being released.
129
+
130
+ Similar heatmaps of scored samples are shown for the No-physics ablation of our model in Figure 6. Because this ablation does not simulate the effect of dropping a block, its highly-scored action samples correspond almost exactly to the actual locations of the objects in the goal image. Further, without physics simulation it does not implicitly select for stable action sequences; there is nothing to prevent the model from selecting the topmost block of the tower as the first action.
131
+
132
+ Planning for alternate goals. By implicitly learning the underlying physics of a domain, our model can be used for various tasks besides matching towers. In Figure 7a, we show our model’s representations being used to plan a sequence of actions to maximize the height of a tower. There is no observation for this task, and the action scores are calculated based on the highest non-zero pixels after rendering samples with the learned renderer. In Figure 7b, we consider a similar sampling procedure as in the tower-matching experiments, except here only a single unstable block is shown. Matching a free-floating block requires planning with O2P2 for multiple steps at once.
133
+
134
+ ![](images/6368dd901dcd948abd66b579dcc3ec0f65714606f0c82d1f715ba55916d733f7.jpg)
135
+
136
+ ![](images/f61a3be3240cb19bac18a55e14974299e3cc146dcefedb79845ec38e8c158d9b.jpg)
137
+ Figure 7: O2P2 being used to plan for the alternate goals of (a) maximizing the height of a tower and (b) making an observed block stable by use of any other blocks.
138
+ Figure 8: Ten goal images alongside the result of the Sawyer’s executed action sequence using O2P2 for planning. The seven action sequences counted as correct are outlined in solid black; the three counted as incorrect are outlined in dashed lines. We refer the reader to Appendix B for more evaluation examples and people.eecs.berkeley.edu/∼janner/o2p2 for videos of the evaluation.
139
+
140
+ # 3.4 TRANSFER TO ROBOTIC ARM
141
+
142
+ We evaluated O2P2 on a Sawyer robotic arm using real image inputs. We deployed the same perception, physics, and rendering modules used on synthetic data with minor changes to the planning procedure to make real-world evaluation tractable. Instead of evaluating a sampled action by moving an appropriate block to the specified position and inferring object representations with the perception module, we trained a separate two-layer MLP to map directly from actions to object representations. We refer to this module as the embedder: $o _ { m } = f _ { \mathrm { e m b e d d e r } } ( a _ { m } )$ .
143
+
144
+ Mapping actions to object representations removed the need to manually move every sampled block in front of the camera, which would have been prohibitively slow on a real robot. The embedder was supervised by the predicted object representations of the perception module on real image inputs; we collected a small dataset of the Sawyer gripper holding each object at one hundred positions and recorded the ground truth position of the gripper along with the output of the perception module for the current observation.
145
+
146
+ The embedder took the place of lines 6-8 of Algorithm 1. We also augmented the objective used to select actions in line 11. In addition to $\mathcal { L } _ { 2 }$ distance between goal and sampled object representations, we used a pixelwise $\mathcal { L } _ { 2 }$ distance between the observed and rendered object segments and between the rendered object segments before and after use of the physics module. The latter loss is useful in a real setting because the physical interactions are less predictable than their simulated counterparts, so by penalizing any predicted movement we preferentially placed blocks directly in a stable position.
147
+
148
+ By using end-effector position control on the Sawyer gripper, we could retain the same action space as in synthetic experiments. Because the position component of the sampled actions referred to the block placement location, we automated the picking motion to select the sampled block based on the shape and color components of an action. Real-world evaluation used colored wooden cubes and rectangular cuboids.
149
+
150
+ Real image object segments were estimated by applying a simple color filter and finding connected components of sufficient size. To account for shading and specularity differences, we replaced all pixels within an object segment by the average color within the segment. To account for noisy segment masks, we replaced each mask with its nearest neighbor (in terms of pixel MSE) in our MuJoCo-rendered training set.
151
+
152
+ We tested O2P2 on twenty-five goal configurations total, of which our model correctly built seventeen. Ten goal images, along with the result of our model’s executed action sequence, are shown in Figure 8. The remainder of the configurations are included in Appendix B.
153
+
154
+ # 4 RELATED WORK
155
+
156
+ Our work is situated at the intersection of two distinct paradigms. In the first, a rigid notion of object representation is enforced via supervision of object properties (such as size, position, and identity). In the second, scene representations are not factorized at all, so no extra supervision is required. These two approaches have been explored in a variety of domains.
157
+
158
+ Image and video understanding. The insight that static observations are physically stable configurations of objects has been leveraged to improve 3D scene understanding algorithms. For example, Zheng et al. (2014); Gupta et al. (2010); Shao et al. (2014); Jia et al. (2015) build physically-plausible scene representations using such stability constraints. We consider a scenario in which the physical representations are learned from data instead of taking on a predetermined form. Wu et al. (2017b;a) encode scenes in a markup-style representation suitable for consumption by off-the-shelf rendering engines and physics simulators. In contrast, we do not assume access to supervision of object properties (only object segments) for training a perception module to map into a markup language.
159
+
160
+ There has also been much attention on inferring object-factorized, or otherwise disentangled, representations of images (Eslami et al., 2016; Greff et al., 2017; van Steenkiste et al., 2018). In contrast to works which aim to discover objects in a completely unsupervised manner, we focus on using object representations learned with minimal supervision, in the form of segmentation masks, for downstream tasks. Object-centric scene decompositions have also been considered as a potential state representation in reinforcement learning (Diuk et al., 2008; Scholz et al., 2014; Devin et al., 2017; Goel et al., 2018; Keramati et al., 2018). We are specifically concerned with the problem of predicting and reasoning about physical phenomena, and show that a model capable of this can also be employed for decision making.
161
+
162
+ Learning and inferring physics. Fragkiadaki et al. (2016); Watters et al. (2017); Chang et al. (2016) have shown approaches to learning a physical interaction engine from data. Hamrick et al. (2011) use a traditional physics engine, performing inference over object parameters, and show that such a model can account for humans’ physical understanding judgments. We consider a similar physics formulation, whereby update rules are composed of sums of pairwise object-interaction functions, and incorporate it into a training routine that does not have access to ground truth supervision in the form of object parameters (such as position or velocity).
163
+
164
+ An alternative to using a traditional physics engine (or a learned object-factorized function trained to approximate one) is to treat physics prediction as an image-to-image translation or classification problem. In contrast to these prior methods, we consider not only the accuracy of the predictions of our model, but also its utility for downstream tasks that are intentionally constructed to evaluate its ability to acquire an actionable representation of intuitive physics. Comparing with representative video prediction (Lee et al., 2018; Babaeizadeh et al., 2018) and physical prediction (Ehrhardt et al., 2017; Mottaghi et al., 2016; Li et al., 2017; Lerer et al., 2016) methods, our approach achieves substantially better results at tasks that require building structures out of blocks.
165
+
166
+ # 5 CONCLUSION
167
+
168
+ We introduced a method of learning object-centric representations suitable for physical interactions. These representations did not assume the usual supervision of object properties in the form of position, orientation, velocity, or shape labels. Instead, we relied only on segment proposals and a factorized structure in a learned physics engine to guide the training of such representations. We demonstrated that this approach is appropriate for a standard physics prediction task. More importantly, we showed that this method gives rise to object representations that can be used for difficult planning problems, in which object configurations differ from those seen during training, without further adaptation. We evaluated our model on a block tower matching task and found that it outperformed object-agnostic approaches that made comparisons in pixel-space directly.
169
+
170
+ # ACKNOWLEDGMENTS
171
+
172
+ We thank Michael Chang for insightful discussion and anonymous reviewers for feedback on an early draft of this paper. This work was supported by the National Science Foundation Graduation Research Fellowship and the Open Philanthropy Project AI Fellowship.
173
+
174
+ # REFERENCES
175
+
176
+ Mohammad Babaeizadeh, Chelsea Finn, Dumitru Erhan, Roy H. Campbell, and Sergey Levine. Stochastic variational video prediction. In International Conference on Learning Representations, 2018.
177
+
178
+ Michael B Chang, Tomer Ullman, Antonio Torralba, and Joshua B Tenenbaum. A compositional object-based approach to learning physical dynamics. In International Conference on Learning Representations, 2016.
179
+
180
+ Coline Devin, Pieter Abbeel, Trevor Darrell, and Sergey Levine. Deep object-centric representations for generalizable robot learning. CoRR, abs/1708.04225, 2017.
181
+
182
+ Carlos Diuk, Andre Cohen, and Michael L. Littman. An object-oriented representation for efficient reinforcement learning. In Proceedings of the 25th International Conference on Machine Learning, 2008.
183
+
184
+ Sebastien Ehrhardt, Aron Monszpart, Niloy J. Mitra, and Andrea Vedaldi. Taking Visual Motion ´ Prediction To New Heightfields. arXiv preprint arXiv:1712.09448, 2017.
185
+
186
+ S. M. Ali Eslami, Nicolas Heess, Theophane Weber, Yuval Tassa, David Szepesvari, Koray Kavukcuoglu, and Geoffrey E Hinton. Attend, infer, repeat: Fast scene understanding with generative models. In Advances in Neural Information Processing Systems 29. 2016.
187
+
188
+ Katerina Fragkiadaki, Pulkit Agrawal, Sergey Levine, and Jitendra Malik. Learning visual predictive models of physics for playing billiards. In International Conference on Learning Representations, 2016.
189
+
190
+ Vik Goel, Jameson Weng, and Pascal Poupart. Unsupervised video object segmentation for deep reinforcement learning. CoRR, abs/1805.07780, 2018.
191
+
192
+ Klaus Greff, Sjoerd van Steenkiste, and Jurgen Schmidhuber. Neural expectation maximization. In ¨ I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30. 2017.
193
+
194
+ Abhinav Gupta, Alexei A. Efros, and Martial Hebert. Blocks world revisited: Image understanding using qualitative geometry and mechanics. In European Conference on Computer Vision(ECCV), 2010.
195
+
196
+ Jessica B. Hamrick, Peter Battaglia, and Joshua B. Tenenbaum. Internal physics models guide probabilistic judgments about object dynamics. In Proceedings of the 33rd annual conference of the cognitive science society, 2011.
197
+
198
+ Z. Jia, A. C. Gallagher, A. Saxena, and T. Chen. 3d reasoning from blocks to stability. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2015.
199
+
200
+ Justin Johnson, Alexandre Alahi, and Li Fei-Fei. Perceptual losses for real-time style transfer and super-resolution. In European Conference on Computer Vision, 2016.
201
+
202
+ Ramtin Keramati, Jay Whang, Patrick Cho, and Emma Brunskill. Strategic object oriented reinforcement learning. arXiv preprint arXiv:1806.00175, 2018.
203
+
204
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.
205
+
206
+ Alex X. Lee, Richard Zhang, Frederik Ebert, Pieter Abbeel, Chelsea Finn, and Sergey Levine. Stochastic adversarial video prediction. arXiv preprint arXiv:1804.01523, 2018.
207
+
208
+ Adam Lerer, Sam Gross, and Rob Fergus. Learning physical intuition of block towers by example. In Proceedings of the 33rd International Conference Machine Learning, 2016.
209
+
210
+ W. Li, A. Leonardis, and M. Fritz. Visual stability prediction for robotic manipulation. In IEEE International Conference on Robotics and Automation, 2017.
211
+
212
+ Roozbeh Mottaghi, Hessam Bagherinezhad, Mohammad Rastegari, and Ali Farhadi. Newtonian scene understanding: Unfolding the dynamics of objects in static images. In IEEE Conference on Computer Vision and Pattern Recognition, 2016.
213
+
214
+ Lawrence G. Roberts. Machine Perception of Three-Dimensional Solids. Outstanding Dissertations in the Computer Sciences. 1963.
215
+
216
+ Reuven Y. Rubinstein and Dirk P. Kroese. The Cross Entropy Method: A Unified Approach To Combinatorial Optimization, Monte-carlo Simulation (Information Science and Statistics). SpringerVerlag, Berlin, Heidelberg, 2004. ISBN 038721240X.
217
+
218
+ Jonathan Scholz, Martin Levihn, Charles Isbell, and David Wingate. A physics-based model prior for object-oriented mdps. In Proceedings of the 31st International Conference on Machine Learning, 2014.
219
+
220
+ Tianjia Shao, Aron Monszpart, Youyi Zheng, Bongjin Koo, Weiwei Xu, Kun Zhou, and Niloy Mitra. Imagining the unseen: Stability-based cuboid arrangements for scene understanding. ACM SIGGRAPH Asia 2014, 2014. \* Joint first authors.
221
+
222
+ K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. CoRR, abs/1409.1556, 2014.
223
+
224
+ Elizabeth S. Spelke and Katherine D. Kinzler. Core knowledge. Developmental Science, 10(1): 89–96, 2007.
225
+
226
+ Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In IROS, pp. 5026–5033, 2012.
227
+
228
+ Sjoerd van Steenkiste, Michael Chang, Klaus Greff, and Jrgen Schmidhuber. Relational neural expectation maximization: Unsupervised discovery of objects and their interactions. In International Conference on Learning Representations, 2018.
229
+
230
+ Nicholas Watters, Daniel Zoran, Theophane Weber, Peter Battaglia, Razvan Pascanu, and Andrea Tacchetti. Visual interaction networks: Learning a physics simulator from video. In Advances in Neural Information Processing Systems 30. 2017.
231
+
232
+ Patrick Henry Winston. Learning structural descriptions from examples. Technical report, 1970.
233
+
234
+ Jiajun Wu, Erika Lu, Pushmeet Kohli, William T Freeman, and Joshua B Tenenbaum. Learning to see physics via visual de-animation. In Advances in Neural Information Processing Systems, 2017a.
235
+
236
+ Jiajun Wu, Joshua B Tenenbaum, and Pushmeet Kohli. Neural scene de-rendering. In IEEE Conference on Computer Vision and Pattern Recognition, 2017b.
237
+
238
+ Bo Zheng, Yibiao Zhao, Joey C. Yu, Katsushi Ikeuchi, and Song-Chun Zhu. Scene understanding by reasoning stability and safety. International Journal of Computer Vision, 2014.
239
+
240
+ # A IMPLEMENTATIONS DETAILS
241
+
242
+ Objects were represented as 256-dimensional vectors. The perception module had four convolutional layers of $\left\{ 3 2 , 6 4 , 1 2 8 , 2 5 6 \right\}$ channels, a kernel size of 4, and a stride of 2 followed by a single fully-connected layer with output size matching the object representation dimension. Both MLPs in the physics engine had two hidden layers each of size 512. The rendering networks had convolutional layers with $\{ 1 2 8 , 6 4 , 3 2 , 3 \}$ channels (or 1 output channel in the case of the heatmap predictor), kernel sizes of $\left\{ 5 , 5 , 6 , 6 \right\}$ , and strides of 2. We used the Adam optimizer (Kingma & Ba, 2015) with a learning rate of 1e-3.
243
+
244
+ # B SAWYER RESULTS
245
+
246
+ ![](images/8691e74dc17075789d361862a936c892b670ca58ea8ef1dee985bc2af2ad6f10.jpg)
247
+ Figure 9: Extension of Figure 8, showing our planning results on a Sawyer arm with real image inputs. The seven action sequences counted as correct are outlined in solid black; the three counted as incorrect are outlined in dashed lines.
248
+
249
+ ![](images/ca7cd604f1372843d129f330575fa61ad4fc2a006e900dce40abcd7485580e72.jpg)
250
+ Figure 10: All actions taken by our planning procedure for one of the goal configurations from Figure 8.
md/train/HkNKFiGex/HkNKFiGex.md ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NEURAL PHOTO EDITING WITH INTROSPECTIVE AD-VERSARIAL NETWORKS
2
+
3
+ Andrew Brock, Theodore Lim, & J.M. Ritchie
4
+
5
+ # Nick Weston
6
+
7
+ School of Engineering and Physical Sciences
8
+ Heriot-Watt University
9
+ Edinburgh, UK
10
+ {ajb5, t.lim, j.m.ritchie}@hw.ac.uk
11
+ Renishaw plc
12
+ Research Ave, North
13
+ Edinburgh, UK
14
+ Nick.Weston@renishaw.com
15
+
16
+ # ABSTRACT
17
+
18
+ The increasingly photorealistic sample quality of generative image models suggests their feasibility in applications beyond image generation. We present the Neural Photo Editor, an interface that leverages the power of generative neural networks to make large, semantically coherent changes to existing images. To tackle the challenge of achieving accurate reconstructions without loss of feature quality, we introduce the Introspective Adversarial Network, a novel hybridization of the VAE and GAN. Our model efficiently captures long-range dependencies through use of a computational block based on weight-shared dilated convolutions, and improves generalization performance with Orthogonal Regularization, a novel weight regularization method. We validate our contributions on CelebA, SVHN, and CIFAR-100, and produce samples and reconstructions with high visual fidelity.
19
+
20
+ # 1 INTRODUCTION
21
+
22
+ Editing photos typically involves some form of manipulating individual pixels, and achieving desirable results often requires significant user expertise. Given a sufficiently powerful image model, however, a user could quickly make large, photorealistic changes with ease by instead interacting with the model’s controls. Two recent advances, the Variational Autoencoder (VAE)(Kingma & Welling, 2014) and Generative Adversarial Network (GAN)(Goodfellow et al., 2014), have shown great promise for use in modeling the complex, high-dimensional distributions of natural images, but significant challenges remain before these models can be used as general-purpose image editors.
23
+
24
+ VAEs are probabilistic graphical models that learn to maximize a variational lower bound on the likelihood of the data by projecting into a learned latent space, then reconstructing samples from that space. GANs learn a generative model by training one network, the "discriminator," to distinguish between real and generated data, while simultaneously training a second network, the "generator," to transform a noise vector into samples which the discriminator cannot distinguish from real data. Both approaches can be used to generate and interpolate between images by operating in a low-dimensional learned latent space, but each comes with its own set of benefits and drawbacks.
25
+
26
+ VAEs have stable training dynamics, but tend to produce images that discard high-frequency details when trained using maximum likelihood. Using the intermediate activations of a pre-trained discriminative neural network as features for comparing reconstructions to originals (Lamb et al., 2016) mollifies this effect, but requires labels in order to train the discriminative network in a supervised fashion.
27
+
28
+ By contrast, GANs have unstable and often oscillatory training dynamics, but produce images with sharp, photorealistic features. Basic GANs lack an inference mechanism, though techniques to train an inference network (Dumoulin et al., 2016) (Donahue et al., 2016) have recently been developed, as well as a hybridization that uses the VAE’s inference network (Larsen et al., 2015).
29
+
30
+ Two key issues arise when attempting to use a latent-variable generative model to manipulate natural images. First, producing acceptable edits requires that the model be able to achieve close-to-exact reconstructions by inferring latents, or else the model’s output will not match the original image. This simultaneously necessitates an inference mechanism (or inference-by-optimization) and careful design of the model architecture, as there is a tradeoff between reconstruction accuracy and learned feature quality that varies with the size of the information bottleneck.
31
+
32
+ ![](images/bb41ca7b420c67f041de42331cd2d9d44d00d983c1abe4451522b81618f7637c.jpg)
33
+ Figure 1: The Neural Photo Editor. The original image is center. The red and blue tiles are visualizations of the latent space, and can be directly manipulated as well.
34
+
35
+ Second, achieving a specific desired edit requires that the user be able to manipulate the model’s latent variables in an interpretable way. Typically, this would require that the model’s latent space be augmented during training and testing with a set of labeled attributes, such that interpolating along a latent such as "not smiling/smiling" produces a specific change. In the fully unsupervised setting, however, such semantically meaningful output features are generally controlled by an entangled set of latents which cannot be directly manipulated.
36
+
37
+ In this paper, we present the Neural Photo Editor, an interface that handles both of these issues, enabling a user to make large, coherent changes to the output of unsupervised generative models by indirectly manipulating the latent vector with a "contextual paintbrush." By applying a simple interpolating mask, we enable this same exploration for existing photos despite reconstruction errors.
38
+
39
+ Complementary to the Neural Photo Editor, we develop techniques to improve on common design tradeoffs in generative models. Our model, the Introspective Adversarial Network (IAN), is a hybridization of the VAE and GAN that leverages the power of the adversarial objective while maintaining the VAE’s efficient inference mechanism, improving upon previous VAE/GAN hybrids both in parametric efficiency and output quality. We employ a novel convolutional block based on dilated convolutions (Yu & Koltun, 2016) to efficiently increase the network’s receptive field, and Orthogonal Regularization, a novel weight regularizer.
40
+
41
+ We demonstrate the qualitative sampling, reconstructing, and interpolating ability of the IAN on CelebA (Liu et al., 2015), SVHN (Netzer et al., 2011), CIFAR-10 (Krizhevsky & Hinton, 2009), and Imagenet (Russakovsky et al., 2015), and quantitatively demonstrate its inference capabilities with competitive performance on the semi-supervised SVHN classification task. Further quantitative experiments on CIFAR-100 (Krizhevsky & Hinton, 2009) verify the generality of our dilated convolution blocks and Orthogonal Regularization.
42
+
43
+ # 2 NEURAL PHOTO EDITING
44
+
45
+ We present an interface, shown in Figure 1, that turns a coarse user input into a refined, photorealistic image edit by indirectly manipulating the latent space with a "contextual paintbrush." The key idea is simple: a user selects a paint brush size and color (as with a typical image editor) and paints on the output image. Instead of changing individual pixels, the interface backpropagates the difference between the local image patch and the requested color, and takes a gradient descent step in the latent space to minimize that difference. This step results in globally coherent changes that are semantically meaningful in the context of the requested color change. Given an output image $\hat { X }$ and a user requested color $X _ { u s e r }$ , the change in latent values is $- \frac { d | | X _ { u s e r } - \hat { X } | | _ { 2 } } { d Z }$ , evaluated at the current paintbrush location each time a user requests an edit.
46
+
47
+ ![](images/ee59a3db2ae4092a6663370bd7f68a2ee9c7dc14ad97ca97e9d7786d06317db7.jpg)
48
+ Figure 2: Visualizing the interpolation mask. Top, left to right: Reconstruction, reconstruction error, original image. Bottom: Modified reconstruction, $\Delta$ , output.
49
+
50
+ For example, if a user has an image of a person with light skin, dark hair, and a widow’s peak, by painting a dark color on the forehead, the system will automatically add hair in the requested area. Similarly, if a user has a photo of a person with a closed-mouth smile, the user can produce a toothy grin by painting bright white over the target’s mouth.
51
+
52
+ This technique enables exploration of samples generated by the network, but fails when applied directly to existing photos, as it relies on the manipulated image being completely controlled by the latent variables, and reconstructions are usually imperfect. We circumvent this issue by introducing a simple masking technique that transfers edits from a reconstruction back to the original image.
53
+
54
+ We take the output image to be a sum of the reconstruction, and a masked combination of the requested pixel-wise changes and the reconstruction error:
55
+
56
+ $$
57
+ Y = \hat { X } + M \Delta + ( 1 - M ) ( X - \hat { X } )
58
+ $$
59
+
60
+ Where $X$ is the original image, $\hat { X }$ is the model’s reconstruction of $X$ , and $\Delta$ is the difference between the modified reconstruction and $\hat { X }$ . The mask $M$ is the channel-wise mean of the absolute value of $\Delta$ , smoothed with a Gaussian filter $g$ and truncated pointwise to be between 0 and 1:
61
+
62
+ $$
63
+ M = m i n ( g ( | \bar { \Delta } | ) , 1 )
64
+ $$
65
+
66
+ The mask is designed to allow changes to the reconstruction to show through based on their magnitude. This relaxes the accuracy constraints by requiring that the reconstruction be feature-aligned rather than pixel-perfect, as only modifications to the reconstruction are applied to the original image. As long as the reconstruction is close enough and interpolations are smooth and plausible, the system will successfully transfer edits.
67
+
68
+ A visualization of the masking technique is shown in Figure 2. This method adds minimal computational cost to the underlying latent space exploration and produces convincing changes of features including hair color and style, skin tone, and facial expression. A video of the interface in action is available online.1
69
+
70
+ ![](images/5eddbfc3033b5b8129b26c2966cc3c3c58b622b794a55ab63641164707df0738.jpg)
71
+ Figure 3: The Introspective Adversarial Network (IAN).
72
+
73
+ # 3 INTROSPECTIVE ADVERSARIAL NETWORKS
74
+
75
+ Complementary to the Neural Photo Editor, we introduce the Introspective Adversarial Network (IAN), a novel hybridization of the VAE and GAN motivated by the need for an image model with photorealistic outputs that achieves high-quality reconstructions without loss of representational power. There is typically a design tradeoff between these two goals related to the size of the latent space: a higher-dimensional latent space (i.e. a wider representational bottleneck) tends to learn less descriptive features, but produces higher quality reconstructions.
76
+
77
+ We thus seek techniques to improve the capacity of the latent space without increasing its dimensionality. Similar to VAE/GAN (Larsen et al., 2015), we use the decoder network of the autoencoder as the generator network of the GAN, but instead of training a separate discriminator network, we combine the encoder and discriminator into a single network. Central to the IAN is the idea that features learned by a discriminatively trained network tend to be more expressive those learned by an encoder network trained via maximum likelihood (i.e. more useful on semi-supervised tasks), and thus better suited for inference. As the Neural Photo Editor relies on high-quality reconstructions, the inference capacity of the underlying model is critical. Accordingly, we use the discriminator of the GAN, $D$ , as a feature extractor for an inference subnetwork, $E$ , which is implemented as a fully-connected layer on top of the final convolutional layer of the discriminator. We infer latent values $Z \sim E ( X ) = q ( Z | X )$ for reconstruction and sample random values $Z \sim p ( Z )$ from a standard normal for random image generation using the generator network, $G$ .
78
+
79
+ Similar to VAE/GAN and DeePSiM (Dosovitskiy & Brox, 2016), we use three distinct loss functions:
80
+
81
+ • $\mathcal { L } _ { i m g }$ , the $\mathcal { L } _ { 1 }$ pixel-wise reconstruction loss, which we prefer to the $\mathcal { L } _ { 2 }$ reconstruction loss for its higher average gradient.
82
+ • $\mathcal { L } _ { f e a t u r e }$ , the feature-wise reconstruction loss, evaluated as the $\mathcal { L } _ { 2 }$ difference between the original and reconstruction in the space of the hidden layers of the discriminator.
83
+ • $\mathcal { L } _ { a d v }$ , the ternary adversarial loss, a modification of the adversarial loss that forces the discriminator to label a sample as real, generated, or reconstructed (as opposed to a binary real vs. generated label).
84
+
85
+ Including the VAE’s KL divergence between the inferred latents $E ( X )$ and the prior $p ( Z )$ , the loss function for the generator and encoder network is thus:
86
+
87
+ Where the $\lambda$ terms weight the relative importance of each loss. We set $\lambda _ { i m g }$ to 3 and leave the other terms at 1. The discriminator is updated solely using the ternary adversarial loss. During each training step, the generator produces reconstructions $G ( E ( X ) )$ (using the standard VAE reparameterization trick) from data $X$ and random samples $G ( Z )$ , while the discriminator observes $X$ as well as the reconstructions and random samples, and both networks are simultaneously updated.
88
+
89
+ # 3.1 FEATURE-WISE LOSS
90
+
91
+ We compare reconstructions using the intermediate activations, $f ( G ( E ( X ) ) )$ , of all convolutional layers of the discriminator, mirroring the perceptual losses of Discriminative Regularization (Lamb et al., 2016), VAE/GAN (Larsen et al., 2015), and DeepSiM (Dosovitskiy & Brox, 2016). We note that Feature Matching (Salimans et al., 2016) is designed to operate in a similar fashion, but without the guidance of an inference mechanism to match latent values $Z$ to particular values of $f ( G ( Z ) )$ . We find that using this loss to complement the pixel-wise difference results in sharper reconstructions that better preserve higher frequency features and edges.
92
+
93
+ # 3.2 TERNARY ADVERSARIAL LOSS
94
+
95
+ The standard GAN discriminator network is trained using an implicit label source (real vs fake); noting the success of augmenting the discriminator’s objective with supervised labels (Odena et al., 2016), we seek additional sources of implicit labels, in the hopes of achieving similar improvements. The ternary loss provides an additional source of supervision to the discriminator by asking it to determine if a sample is real, generated, or a reconstruction, while the generator’s goal is still to have the discriminator assign a high "real" probability to both samples and reconstructions. We thus modify the discriminator to have three output units with a softmax nonlinearity, and train it to minimize the categorical cross-entropy:
96
+
97
+ $$
98
+ { \mathcal { L } } _ { D a d v } = - l o g ( D _ { r e a l } ( X ) ) - l o g ( D _ { g e n e r a t e d } ( G ( Z ) ) ) - l o g ( D _ { r e c o n s t r u c t e d } ( G ( E ( X ) ) ) )
99
+ $$
100
+
101
+ Where each $D$ term in Equation 4 indicates the discriminator output unit assigned to each label class. The generator is trained to produce outputs that maximize the probability of the label "real" being assigned by the discriminator by minimizing $\mathcal { L } _ { G a d v }$ :
102
+
103
+ $$
104
+ \mathcal { L } _ { G a d v } = - l o g ( D _ { r e a l } ( G ( Z ) ) ) - l o g ( D _ { r e a l } ( G ( E ( X ) ) )
105
+ $$
106
+
107
+ We posit that this loss helps maintain the balance of power early in training by preventing the discriminator from learning a small subset of features (e.g. artifacts in the generator’s output) that distinguish real and generated samples, reducing the range of useful features the generator can learn from the discriminator. We also find that this loss leads to higher sample quality, perhaps because the additional source of supervision leads to the discriminator ultimately learning a richer feature space.
108
+
109
+ # 3.3 ARCHITECTURE
110
+
111
+ Our model has the same basic structure as DCGAN (Radford et al., 2015), augmented with Multiscale Dilated Convolution (MDC) blocks in the generator, and Minibatch Discrimination (Salimans et al., 2016) in the discriminator. As in (Radford et al., 2015), we use Batch Normalization (Ioffe & Szegedy, 2015) and Adam (Kingma & Ba, 2014) in both networks. All of our code is publicly available.2
112
+
113
+ # 3.4 MULTISCALE DILATED CONVOLUTION BLOCKS
114
+
115
+ We propose a novel Inception-style (Szegedy et al., 2016) convolutional block motivated by the ideas that image features naturally occur at multiple scales, that a network’s expressivity is proportional to the range of functions it can represent divided by its total number of parameters, and by the desire to efficiently expand a network’s receptive field. The Multiscale Dilated Convolution (MDC) block applies a single FxF filter at multiple dilation factors, then performs a weighted elementwise sum of each dilated filter’s output, allowing the network to simultaneously learn a set of features and the relevant scales at which those features occur with a minimal increase in parameters. This also rapidly expands the network’s receptive field without requiring an increase in depth or the number of parameters. Dilated convolutions have previously been successfully applied in semantic segmentation (Yu & Koltun, 2016), and a similar scheme, minus the parameter sharing, is proposed in (Chen et al., 2016).
116
+
117
+ ![](images/06cab2de1dc14543946c0e397839ca08df89190f2f212ea3147a13ba935a15a3.jpg)
118
+ Figure 4: (a) Multiscale Dilated Convolution Block. (b) Visualizing a 3d3 MDC filter composition.
119
+
120
+ As shown in Figure 4(a), each block is parameterized by a bank of $\mathbf { N } \mathbf { F x F }$ filters $W$ , applied with S factors of dilation, and a set of $\mathbf { N } { \ast } \mathbf { S }$ scalars $k$ , which relatively weight the output of each filter at each scale. This is naturally and efficiently implemented by reparameterizing a sparsely populated $\mathrm { F + } ( \mathrm { S } { \mathrm { - } } 1 ) ^ { \ast } ( \mathrm { F } { \mathrm { - } } 1 )$ filterbank as displayed in Figure 4(b). We propose two variants: Standard MDC, where the filter weights are tied to a base $W$ , and Full-Rank MDC, where filters are given the sparse layout of Figure 4(b) but the weights are not tied. Selecting Standard versus Full-Rank MDC blocks allows for a design tradeoff between parametric efficiency and model flexibility. In our architecture, we replace the hidden layers of the generator with Standard MDC blocks, using $\mathrm { F } { = } 5$ and $\scriptstyle \mathbf { D } = 2$ ; we specify MDC blocks by their base filter size and their maximum dilation factor (e.g. 5d2).
121
+
122
+ # 3.5 ORTHOGONAL REGULARIZATION
123
+
124
+ Orthogonality is a desirable quality in ConvNet filters, partially because multiplication by an orthogonal matrix leaves the norm of the original matrix unchanged. This property is valuable in deep or recurrent networks, where repeated matrix multiplication can result in signals vanishing or exploding. We note the success of initializing weights with orthogonal matrices (Saxe et al., 2014), and posit that maintaining orthogonality throughout training is also desirable. To this end, we propose a simple weight regularization technique, Orthogonal Regularization, that encourages weights to be orthogonal by pushing them towards the nearest orthogonal manifold. We augment our objective with the cost:
125
+
126
+ $$
127
+ \mathcal { L } _ { o r t h o } = \Sigma ( | W W ^ { T } - I | )
128
+ $$
129
+
130
+ Where $\Sigma$ indicates a sum across all filter banks, $W$ is a filter bank, and $I$ is the identity matrix.
131
+
132
+ # 4 RELATED WORK
133
+
134
+ Our architecture builds directly off of previous VAE/GAN hybrids (Larsen et al., 2015) (Dosovitskiy & Brox, 2016), with the key difference being our combination of the discriminator and the encoder to improve computational and parametric efficiency (by reusing discriminator features) as well as reconstruction accuracy (as demonstrated in our CelebA ablation studies). The methods of ALI (Dumoulin et al., 2016) and BiGAN (Donahue et al., 2016) provide an orthogonal approach to GAN inference, in which an inference network is trained by an adversarial (as opposed to a variational) process.
135
+
136
+ The method of iGAN (Zhu et al., 2016) bears the most relation to our interface. The iGAN interface allows a user to impose shape or color constraints on an image of an object through use of a brush tool, then optimizes to solve for the output of a DCGAN (Radford et al., 2015) which best satisfies those constraints. Photorealistic edits are transferred to existing images via motion and color flow estimation.
137
+
138
+ ![](images/510977899825ff77d5fc6e0273b3f9ef6770190fa7e74614846692d054d7c09a.jpg)
139
+ Figure 5: CelebA and SVHN samples.
140
+
141
+ Both iGAN and the Neural Photo Editor turn coarse user input into refined outputs through use of a generative model, but the methods differ in several key ways. First, we focus on editing portraits, rather than objects such as shoes or handbags, and are thus more concerned with modifying features, as opposed to overall color or shape, for which our method is less well-suited. Our edit transfer technique follows this difference as well: we directly transfer the local image changes produced by the model back onto the original image, rather than estimating and mimicking motion and color flow.
142
+
143
+ Second, our interface applies user edits one step at a time, rather than iteratively optimizing the output. This highlights the difference in design approaches: iGAN seeks to produce outputs that best match a given set of user constraints, while we seek to allow a user to guide the latent space traversal.
144
+
145
+ Finally, we explicitly tailor our model design to the task at hand and jointly train an inference network which we use at test time to produce reconstructions in a single shot. In contrast, iGAN trains an inference network to minimize the $\mathcal { L } _ { 2 }$ loss after training the generator network, and use the inference network to get an initial estimate of the inferred latents, which are then iteratively optimized.
146
+
147
+ Another related interface (Champanard, 2016) refines simple user input into complex textures through use of artistic style transfer (Gatys et al., 2015). Other related work (White, 2016) also circumvents the need for labeled attributes by constructing latent vectors by analogy and bias-correcting them.
148
+
149
+ # 5 EXPERIMENTS
150
+
151
+ We qualitatively evaluate the IAN on 64x64 CelebA (Liu et al., 2015), 32x32 SVHN (Netzer et al., 2011), 32x32 CIFAR-10 (Krizhevsky & Hinton, 2009), and $6 4 \mathrm { x } 6 4$ Imagenet (Russakovsky et al., 2015). Our models are implemented in Theano (Team, 2016) with Lasagne (Dieleman et al., 2015). Samples from the IAN, randomly selected and shown in Figure 5, display the visual fidelity typical of adversarially trained networks. The IAN demonstrates high quality reconstructions on previously unseen data, shown in Figure 6, and smooth, plausible interpolations, even between drastically different samples. CIFAR and Imagenet samples, along with additional comparisons to samples from other models, are available in the appendix.
152
+
153
+ # 5.1 DISCRIMINATIVE EXPERIMENTS
154
+
155
+ We quantitatively demonstrate the effectiveness of our MDC blocks and Orthogonal Regularization on the CIFAR-100 (Krizhevsky & Hinton, 2009) benchmark. Using standard data augmentation, we train a set of 40-layer, $_ { \mathrm { k = } 1 2 }$ DenseNets (Huang et al., 2016) for 50 epochs, annealing the learning rate at 25 and 37 epochs. We add varying amounts of Orthogonal Regularization and modify the standard DenseNet architecture by replacing every 3x3 filterbank with 3d3 MDC blocks, and report the test error after training in Table 1. In addition, we compare to performance using full $7 \mathbf { x } 7$ filters.
156
+
157
+ ![](images/09acb38288cf98ef47fe1871fa9835d29cfd8eee73911cbd325f64e6adec78e2.jpg)
158
+ Figure 6: CelebA and SVHN Reconstructions and Interpolations. The outermost images are originals, the adjacent images are reconstructions.
159
+
160
+ There is a noticeable increase in performance with the progressive addition of our modifications, despite a negligible increase in the number of parameters. Adding Orthogonal Regularization improves the network’s generalization ability; we suspect this is because it encourages the filter weights to remain close to a desirable, non-zero manifold, increasing the likelihood that all of the available model capacity is used by preventing the magnitude of the weights from overly diminishing. Replacing 3x3 filters with MDC blocks yields additional performance gains; we suspect this is due to an increase in the expressive power and receptive field of the network, allowing it to learn longer-range dependencies with ease. We also note that substituting Full-Rank MDC blocks into a 40-Layer DenseNet improves performance by a relative $5 \%$ , with the only increased computational cost coming from using the larger filters.
161
+
162
+ For use in evaluating the IAN, we additionally train 40-layer, $_ { \mathrm { k = } 1 2 }$ DenseNets on the CelebA attribute classification task with varying amounts of Orthogonal Regularization. A plot of the train and validation error during training is available in Figure 7. The addition of of Orthogonal Regularization improves the validation error from $6 . 5 5 \%$ to $4 . 2 2 \%$ , further demonstrating its utility.
163
+
164
+ # 5.2 EVALUATING MODIFICATIONS
165
+
166
+ For use in editing photos, a model must produce reconstructions which are photorealistic and featurealigned, and have smooth, plausible interpolations between outputs. We perform an ablation study to investigate the effects of our proposals, and employ several metrics to evaluate model quality given these goals. In this study, we progressively add modifications to a VAE/GAN (Larsen et al., 2015) baseline, and train each network for 50 epochs.
167
+
168
+ For reconstruction accuracy, pixel-wise distance does not tend to correlate well with perceptual similarity. In addition to pixel-wise $\mathcal { L } _ { 2 }$ distance, we therefore compare model reconstruction accuracy in terms of:
169
+
170
+ • Feature-wise $\mathcal { L } _ { 2 }$ distance in the final layer of a 40-Layer $_ { \mathrm { k = } 1 2 }$ DenseNet trained for the CelebA attribute classification task.
171
+ • Trait reconstruction error. We run our classification DenseNet to predict a binary attribute vector $y ( X )$ given an image $\mathbf { X }$ , and $y ( G ( E ( X ) ) )$ given a model’s reconstruction, then measure the percent error.
172
+ • Fiducial keypoint Error, measured as the mean $\mathcal { L } _ { 2 }$ distance between the facial landmarks predicted by the system of (Sankaranarayanan et al., 2016).
173
+
174
+ Table 1: Error rates on CIFAR- $1 0 0 +$ after 50 epochs.
175
+
176
+ <table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>#Params</td><td rowspan=1 colspan=1>MDC</td><td rowspan=1 colspan=1>Ortho. Reg.</td><td rowspan=1 colspan=1>Error (%)</td></tr><tr><td rowspan=1 colspan=1>Baseline DenseNet (D=40,K=12)</td><td rowspan=1 colspan=1>1.0M</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>26.71</td></tr><tr><td rowspan=1 colspan=1>DenseNet with Ortho. Reg.</td><td rowspan=1 colspan=1>1.0M</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>1e-3</td><td rowspan=1 colspan=1>26.51</td></tr><tr><td rowspan=1 colspan=1>DenseNet with Ortho. Reg</td><td rowspan=1 colspan=1>1.0M</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>1e-1</td><td rowspan=1 colspan=1>26.46</td></tr><tr><td rowspan=1 colspan=1>DenseNet with 7x7 Filters</td><td rowspan=1 colspan=1>5.0M</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>26.39</td></tr><tr><td rowspan=1 colspan=1>DenseNet with 3d3MDC</td><td rowspan=1 colspan=1>1.0M</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>×</td><td rowspan=1 colspan=1>26.02</td></tr><tr><td rowspan=1 colspan=1>DenseNet with Ortho. Reg &amp; MDC</td><td rowspan=1 colspan=1>1.0M</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>1e-3</td><td rowspan=1 colspan=1>25.72</td></tr><tr><td rowspan=1 colspan=1>DenseNet with Ortho.Reg&amp;MDC</td><td rowspan=1 colspan=1>1.0M</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>1e-1</td><td rowspan=1 colspan=1>25.39</td></tr><tr><td rowspan=1 colspan=1>DenseNet (Huang et al., 2016), 300 epochs</td><td rowspan=1 colspan=1>1.0M</td><td rowspan=1 colspan=1>×</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>24.42</td></tr><tr><td rowspan=1 colspan=1>DenseNet with Full MDC, 300 epochs</td><td rowspan=1 colspan=1>2.8M</td><td rowspan=1 colspan=1>full</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>23.30</td></tr></table>
177
+
178
+ Table 2: CelebA investigations.
179
+
180
+ <table><tr><td rowspan=1 colspan=1>MDC</td><td rowspan=1 colspan=1>Ortho. Reg.</td><td rowspan=1 colspan=1>Ternary</td><td rowspan=1 colspan=1>Pixel</td><td rowspan=1 colspan=1>Feature</td><td rowspan=1 colspan=1>Trait(%)</td><td rowspan=1 colspan=1>Keypoint</td><td rowspan=1 colspan=1>Inception</td></tr><tr><td rowspan=1 colspan=2>VAE/GAN Baseline</td><td rowspan=1 colspan=1>line</td><td rowspan=1 colspan=1>0.295</td><td rowspan=1 colspan=1>4.86</td><td rowspan=1 colspan=1>0.197</td><td rowspan=1 colspan=1>2.21</td><td rowspan=1 colspan=1>1389(±64)</td></tr><tr><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>0.285</td><td rowspan=1 colspan=1>4.76</td><td rowspan=1 colspan=1>0.189</td><td rowspan=1 colspan=1>2.11</td><td rowspan=1 colspan=1>1772(±37)</td></tr><tr><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>0.258</td><td rowspan=1 colspan=1>4.67</td><td rowspan=1 colspan=1>0.182</td><td rowspan=1 colspan=1>1.79</td><td rowspan=1 colspan=1>2160(±70)</td></tr><tr><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>0.248</td><td rowspan=1 colspan=1>4.69</td><td rowspan=1 colspan=1>0.172</td><td rowspan=1 colspan=1>1.54</td><td rowspan=1 colspan=1>2365(±97)</td></tr><tr><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>0.230</td><td rowspan=1 colspan=1>4.39</td><td rowspan=1 colspan=1>0.165</td><td rowspan=1 colspan=1>1.47</td><td rowspan=1 colspan=1>3158(±98)</td></tr><tr><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>0.254</td><td rowspan=1 colspan=1>4.60</td><td rowspan=1 colspan=1>0.177</td><td rowspan=1 colspan=1>1.67</td><td rowspan=1 colspan=1>2648(±69)</td></tr><tr><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>0.239</td><td rowspan=1 colspan=1>4.51</td><td rowspan=1 colspan=1>0.164</td><td rowspan=1 colspan=1>1.57</td><td rowspan=1 colspan=1>3161(±70)</td></tr><tr><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>0.221</td><td rowspan=1 colspan=1>4.37</td><td rowspan=1 colspan=1>0.158</td><td rowspan=1 colspan=1>0.99</td><td rowspan=1 colspan=1>3300(±123)</td></tr><tr><td rowspan=1 colspan=1>【</td><td rowspan=1 colspan=1>了</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>0.192</td><td rowspan=1 colspan=1>4.33</td><td rowspan=1 colspan=1>0.155</td><td rowspan=1 colspan=1>0.97</td><td rowspan=1 colspan=1>3627(±146)</td></tr></table>
181
+
182
+ Gauging the visual quality of the model’s outputs is notoriously difficult, but the Inception score recently proposed by (Salimans et al., 2016) has been found to correlate positively with humanevaluated sample quality. Using our CelebA attribute classification network in place of the Inception (Szegedy et al., 2016) model, we compare the Inception score of each model evaluated on 50,000 random samples. We posit that this metric is also indicative of interpolation quality, as a high visual quality score on a large sample population suggests that the model’s output quality remains high regardless of the state of the latent space.
183
+
184
+ Results of this ablation study are presented in Table 2; samples and reconstructions from each configuration are available in the appendix, along with comparisons between a fully-trained IAN and related models. As with our discriminative experiments, we find that the progressive addition of modifications results in consistent performance improvements across our reconstruction metrics and the Inception score.
185
+
186
+ We note that the single largest gains come from the inclusion of MDC blocks, suggesting that the network’s receptive field is a critical aspect of network design for both generative and discriminative tasks, with an increased receptive field correlating positively with reconstruction accuracy and sample quality.
187
+
188
+ The improvements from Orthogonal Regularization suggest that encouraging weights to lie close to the orthogonal manifold is beneficial for improving the sample and reconstruction quality of generative neural networks by preventing learned weights from collapsing to an undesirable manifold; this is consistent with our experience iterating through network designs, where we have found mode collapse to occur less frequently while using Orthogonal Regularization.
189
+
190
+ Finally, the increase in sample quality and reconstruction accuracy through use of the ternary adversarial loss suggests that including the "reconstructed" target in the discriminator’s objective does lead to the discriminator learning a richer feature space. This comes along with our observations that training with the ternary loss, where we have observed that the generator and discriminator losses tend to be more balanced than when training with the standard binary loss.
191
+
192
+ Table 3: Error rates on Semi-Supervised SVHN with 1000 training examples. Figure 7: Performance on CelebA Classification task with varying Orthogonal Regularization.
193
+
194
+ <table><tr><td>Method</td><td>Error rate</td></tr><tr><td>VAE (M1+ M2) (Kingma et al.,2014)</td><td>36.02%</td></tr><tr><td>SWWAE with dropout (Zhao et al.,2015)</td><td>23.56%</td></tr><tr><td>DCGAN + L2-SVM (Radford et al.,2015)</td><td>22.18%(±1.13%)</td></tr><tr><td>SDGM (Maalge et al., 2016)</td><td>16.61%(±0.24%)</td></tr><tr><td>ALI (L2-SVM) (Dumoulin et al., 2016)</td><td>19.14%(±0.50%)</td></tr><tr><td>IAN (ours,L2-SVM)</td><td>18.50%(±0.38%)</td></tr><tr><td>IAN (ours, Improved-GAN)</td><td>8.34%(±0.91%)</td></tr><tr><td>Improved-GAN (Salimans et al., 2016)</td><td>8.11%(±1.3%)</td></tr><tr><td>ALI (Improved-GAN)</td><td>7.3%</td></tr><tr><td colspan="2">Table3</td></tr></table>
195
+
196
+ ![](images/675e2187393fc42a1103a2d900d34370f161fa5252f349e195730ccdb12ae8fc.jpg)
197
+ Figure 7
198
+
199
+ # 5.3 SEMI-SUPERVISED LEARNING WITH SVHN
200
+
201
+ We quantitatively evaluate the inference abilities of our architecture by applying it to the semisupervised SVHN classification task using two different procedures. We first evaluate using the procedure of (Radford et al., 2015) by training an L2-SVM on the output of the FC layer of the encoder subnetwork, and report average test error and standard deviation across 100 different SVMs, each trained on 1000 random examples from the training set.
202
+
203
+ Next, we use the procedure of (Salimans et al., 2016), where the discriminator outputs a distribution over the $K$ object categories and an additional "fake" category, for a total of $K { + 1 }$ outputs. The discriminator is trained to predict the category when given labeled data, to assign the "fake" label when provided data from the generator, and to assign $\bar { k } \in \{ 1 , . . . , K \}$ when provided unlabeled real data. We modify feature-matching based Improved-GAN to include the encoder subnetwork and reconstruction losses detailed in Section 3, but do not include the ternary adversarial loss.
204
+
205
+ Our performance, as shown in Table 3, is competitive with other networks evaluated in these fashions, achieving $1 8 . 5 \%$ mean classification accuracy when using SVMs and $8 . 3 4 \%$ accuracy when using the method of Improved-GAN. When using SVMs, our method tends to demonstrate improvement over previous methods, particularly over standard VAEs. We believe this is due to the encoder subnetwork being based on more descriptive features (i.e. those of the discriminator), and therefore better suited to discriminating between SVHN classes.
206
+
207
+ We find the lack of improvement when using the method of Improved-GAN unsurprising, as the IAN architecture does not change the goal of the discriminator; any changes in behavior are thus indirectly due to changes in the generator, whose loss is only slightly modified from feature-matching Improved-GAN.
208
+
209
+ # 6 CONCLUSION
210
+
211
+ We introduced the Neural Photo Editor, a novel interface for exploring the learned latent space of generative models and for making specific semantic changes to natural images. Our interface makes use of the Introspective Adversarial Network, a hybridization of the VAE and GAN that outputs high fidelity samples and reconstructions, and achieves competitive performance in a semi-supervised classification task. The IAN makes use of Multiscale Dilated Convolution Blocks and Orthogonal Regularization, two improvements designed to improve model expressivity and feature quality for convolutional networks.
212
+
213
+ # ACKNOWLEDGMENTS
214
+
215
+ This research was made possible by grants and support from Renishaw plc and the Edinburgh Centre For Robotics. The work presented herein is also partially funded under the European H2020 Programme BEACONING project, Grant Agreement nr. 687676.
216
+
217
+ REFERENCES
218
+ A.J. Champanard. Semantic style transfer and turning two-bit doodles into fine artwork. arXiv Preprint arXiv: 1603.01768, 2016.
219
+ L-C. Chen, G. Papandreou, I. Kokkinos, K. Murphy, , and A. L. Yuille. Deeplab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected crfs. arXiv Preprint arXiv:1606.00915, 2016.
220
+ S. Dieleman, J. Schlüter, C. Raffel, E. Olson, S.K. Sønderby, D. Nouri, and E. Battenberg. Lasagne: First release., 2015. URL http://dx.doi.org/10.5281/zenodo.27878.
221
+ J. Donahue, P. Krähenbühl, and T. Darrell. Adversarial feature learning. arXiv preprint arXiv:1605.09782, 2016.
222
+ A. Dosovitskiy and T. Brox. Generating images with perceptual similarity metrics based on deep networks. arXiv Preprint arXiv:1602.02644, 2016.
223
+ V. Dumoulin, I. Belghazi, B. Poole, A. Lamb, M. Arjovsky, O. Mastropietro, and A. Courville. Adversarially learned inference. arXiv Preprint arXiv: 1606.0070, 2016.
224
+ L.A. Gatys, A.S. Ecker, and M. Bethge. A neural algorithm of artistic style. arXiv Preprint arXiv: 1508.06576, 2015.
225
+ I. Goodfellow, J. Pouget-Abadie, Jean, M. Mehdi, X. Bing, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio. Generative adversarial nets. In Advances in Neural Information Processing Systems, pp. 2672–2680, 2014.
226
+ G. Huang, Z. Liu, K.Q. Weinberger, and L. van der Maaten. Densely connected convolutional networks. arXiv Preprint arXiv:1608.06993, 2016.
227
+ S. Ioffe and C. Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML 2015, 2015.
228
+ D.P. Kingma and J. Ba. Adam: A method for stochastic optimization. arXiv Preprint arXiv: 1412.6980, 2014.
229
+ D.P. Kingma and M. Welling. Auto-encoding variational bayes. In ICLR 2014, 2014.
230
+ D.P. Kingma, S Mohamed, D.J. Rezende, and M. Welling. Semi-supervised learning with deep generative models. In Advances in Neural Information Processing Systems, pp. 3581–3589, 2014.
231
+ A. Krizhevsky and G. Hinton. Learning multiple layers of features from tiny images, 2009.
232
+ A. Lamb, V. Dumoulin, and A. Courville. Discriminative regularization for generative models. arXiv preprint arXiv:1602.03220, 2016.
233
+ A.B.L. Larsen, S.K. Sønderby, and O. Winther. Autoencoding beyond pixels using a learned similarity metric. arXiv preprint arXiv:1512.09300, 2015.
234
+ Z. Liu, P. Luo, X. Wang, and X. Tang. Deep learning face attributes in the wild. In Proceedings of the IEEE International Conference on Computer Vision, pp. 3730–3738, 2015.
235
+ L. Maaløe, C.K. Sønderby, S.K. Sønderby, and O. Winther. Auxiliary deep generative models. arXiv preprint arXiv:1602.05473, 2016.
236
+ Y. Netzer, T. Wang, A. Coates, A. Bissacco, B. Wu, and A.Y. Ng. Reading digits in natural images with unsupervised feature learning. In NIPS workshop on deep learning and unsupervised feature learning, volume 2011, pp. 4. Granada, Spain, 2011.
237
+ A. Odena, C. Olah, and J. Shiens. Conditional image synthesis with auxiliary classifier gans. arXiv Preprint arXiv: 1610.09585, 2016.
238
+ A. Radford, L. Metz, and S. Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
239
+ 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, 115(3):211–252, 2015.
240
+ T. Salimans, I. Goodfellow, W. Zaremba, V. Cheung, A. Radford, and X. Chen. Improved techniques for training gans. arXiv Preprint arXiv: 1606.03498, 2016.
241
+ S. Sankaranarayanan, R. Ranjan, C. D. Castillo, and R. Chellappa. An all-in-one convolutional neural network for face analysis. arXiv Preprint arXiv:1611.00851, 2016.
242
+ A.M. Saxe, J. L. McClelland, and S. Ganguli. Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. In ICLR 2014, 2014.
243
+ C. Szegedy, S. Ioffe, and V. Vanhoucke. Inception-v4, inception-resnet and the impact of residual connections on learning. arXiv Preprint arXiv: 1602.07261, 2016.
244
+ The Theano Development Team. Theano: A python framework for fast computation of mathematical expressions. arXiv Preprint arXiv: 1605.02688, 2016.
245
+ T. White. Sampling generative networks. arXiv Preprint arXiv:1609.04468, 2016.
246
+ F. Yu and V. Koltun. Multi-scale context aggregation by dilated convolutions. In ICLR 2016, 2016.
247
+ J. Zhao, M. Mathieu, R. Goroshin, and Y. Lecun. Stacked what-where auto-encoders. arXiv preprint arXiv:1506.02351, 2015.
248
+ J.-Y. Zhu, P. Krähenbuhl, E. Shechtman, and A. A. Efros. Generative visual manipulation on the natural image manifold. In ECCV 2016, 2016.
249
+
250
+ ![](images/667c4e636421add6a983628f34ed42736c7ceb7b0bf94ee8dcb8c25927fa48be.jpg)
251
+ Figure 7: Comparing samples from different models. From top: VAE(Kingma & Welling, 2014), DCGAN (Goodfellow et al., 2014), VAE/GAN from (Larsen et al., 2015), ALI from(Dumoulin et al., 2016), IAN (ours).
252
+
253
+ ![](images/d57168d78c04507291733989df912a8dad2a2198f75b4bbd34d39605590b8b11.jpg)
254
+ Table 4: Reconstructions and samples from CelebA ablation Study.
255
+
256
+ ![](images/d3e733e57fe4cb2afb4fc0a653d775afc0c21482a77070654a9344b93a6ca501.jpg)
257
+ Figure 8: Samples, reconstructions, and interpolations on CIFAR-10. Top three rows: samples, bottom three rows: reconstructions and interpolations. Our model achieves an Inception score of $6 . 8 8 ( \pm 0 . 0 8 )$ , on par with the $6 . 8 6 ( \pm 0 . 0 6 ) $ achieved by Improved-GAN with historical averaging.
258
+
259
+ ![](images/bb7d1bd177f78dbbe9f649235db84f51524cc73faa583131df7f1e712e6e0d60.jpg)
260
+ Figure 9: Samples, reconstructions, and interpolations on Imagenet. Top three rows: samples, bottom three rows: reconstructions and interpolations. Our model achieves an Inception score of $8 . 5 6 ( \pm 0 . 0 9 )$ .
md/train/HkgH0TEYwH/HkgH0TEYwH.md ADDED
@@ -0,0 +1,458 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DEEP SEMI-SUPERVISED ANOMALY DETECTION
2
+
3
+ Lukas Ruff1 Robert A. Vandermeulen1∗ Nico Görnitz 1 2
4
+ Alexander Binder3 Emmanuel Müller4
5
+ Klaus-Robert Müller1 5 6 Marius Kloft7†
6
+ 1Technical University of Berlin, Germany
7
+ 2123ai.de, Berlin, Germany
8
+ 3Singapore University of Technology & Design, Singapore
9
+ 4Bonn-Aachen International Center for Information Technology, Germany
10
+ 5Korea University, Seoul, Republic of Korea
11
+ 6Max Planck Institute for Informatics, Saarbrücken, Germany
12
+ 7Technical University of Kaiserslautern, Germany
13
+ {lukas.ruff, vandermeulen, nico.goernitz}@tu-berlin.de
14
+ alexander_binder@sutd.edu.sg mueller@bit.uni-bonn.de
15
+ klaus-robert.mueller@tu-berlin.de kloft@cs.uni-kl.de
16
+
17
+ # ABSTRACT
18
+
19
+ Deep approaches to anomaly detection have recently shown promising results over shallow methods on large and complex datasets. Typically anomaly detection is treated as an unsupervised learning problem. In practice however, one may have— in addition to a large set of unlabeled samples—access to a small pool of labeled samples, e.g. a subset verified by some domain expert as being normal or anomalous. Semi-supervised approaches to anomaly detection aim to utilize such labeled samples, but most proposed methods are limited to merely including labeled normal samples. Only a few methods take advantage of labeled anomalies, with existing deep approaches being domain-specific. In this work we present Deep SAD, an end-to-end deep methodology for general semi-supervised anomaly detection. We further introduce an information-theoretic framework for deep anomaly detection based on the idea that the entropy of the latent distribution for normal data should be lower than the entropy of the anomalous distribution, which can serve as a theoretical interpretation for our method. In extensive experiments on MNIST, Fashion-MNIST, and CIFAR-10, along with other anomaly detection benchmark datasets, we demonstrate that our method is on par or outperforms shallow, hybrid, and deep competitors, yielding appreciable performance improvements even when provided with only little labeled data.
20
+
21
+ # 1 INTRODUCTION
22
+
23
+ Anomaly detection (AD) (Chandola et al., 2009; Pimentel et al., 2014) is the task of identifying unusual samples in data. Typically AD methods attempt to learn a “compact” description of the data in an unsupervised manner assuming that most of the samples are normal (i.e., not anomalous). For example, in one-class classification (Moya et al., 1993; Schölkopf et al., 2001) the objective is to find a set of small measure which contains most of the data and samples not contained in that set are deemed anomalous. Shallow unsupervised AD methods such as the One-Class SVM (Schölkopf et al., 2001; Tax & Duin, 2004), Kernel Density Estimation (Parzen, 1962; Kim & Scott, 2012; Vandermeulen & Scott, 2013), or Isolation Forest (Liu et al., 2008) often require manual feature engineering to be effective on high-dimensional data and are limited in their scalability to large datasets. These limitations have sparked great interest in developing novel deep approaches to unsupervised AD (Erfani et al., 2016; Zhai et al., 2016; Chen et al., 2017; Ruff et al., 2018; Deecke et al., 2018; Ruff et al., 2019; Golan & El-Yaniv, 2018; Pang et al., 2019; Hendrycks et al., 2019a;b).
24
+
25
+ ![](images/02c48cf35711844c4c8cab31564d4ffeb713ae13f5c873422a05faebe883c03c.jpg)
26
+ Figure 1: The need for semi-supervised anomaly detection: The training data (shown in (a)) consists of (mostly normal) unlabeled data (gray) as well as a few labeled normal samples (blue) and labeled anomalies (orange). Figures (b)–(f) show the decision boundaries of the various learning paradigms at testing time along with novel anomalies that occur (bottom left in each plot). Our semi-supervised AD approach takes advantage of all training data: unlabeled samples, labeled normal samples, as well as labeled anomalies. This strikes a balance between one-class learning and classification.
27
+
28
+ Unlike the standard unsupervised AD setting, in many real-world applications one may also have access to some verified (i.e., labeled) normal or anomalous samples in addition to the unlabeled data. Such samples could be hand labeled by a domain expert for instance. This leads to a semi-supervised AD problem: given $n$ (mostly normal but possibly containing some anomalous contamination) unlabeled samples $\pmb { x } _ { 1 } , \ldots , \pmb { x } _ { n }$ and $m$ labeled samples $( \tilde { \pmb { x } } _ { 1 } , \tilde { y } _ { 1 } ) , \dots , ( \tilde { \pmb { x } } _ { m } , \tilde { y } _ { m } )$ , where $\tilde { y } = + 1$ and $\tilde { y } = - 1$ denote normal and anomalous samples respectively, the task is to learn a model that compactly characterizes the “normal class.”
29
+
30
+ The term semi-supervised anomaly detection has been used to describe two different AD settings. Most existing “semi-supervised” AD methods, both shallow (Muñoz-Marí et al., 2010; Blanchard et al., 2010; Chandola et al., 2009) and deep (Song et al., 2017; Akcay et al., 2018; Chalapathy & Chawla, 2019), only incorporate the use of labeled normal samples but not labeled anomalies, i.e. they are more precisely instances of Learning from Positive (i.e., normal) and Unlabeled Examples (LPUE) (Denis, 1998; Zhang & Zuo, 2008). A few works (Wang et al., 2005; Liu & Zheng, 2006; Görnitz et al., 2013) have investigated the general semi-supervised AD setting where one also utilizes labeled anomalies, however existing deep approaches are domain or data-type specific (Ergen et al., 2017; Kiran et al., 2018; Min et al., 2018).
31
+
32
+ Research on deep semi-supervised learning has almost exclusively focused on classification as the downstream task (Kingma et al., 2014; Rasmus et al., 2015; Odena, 2016; Dai et al., 2017; Oliver et al., 2018). Such semi-supervised classifiers typically assume that similar points are likely to be of the same class, this is known as the cluster assumption (Zhu, 2005; Chapelle et al., 2009). This assumption, however, only holds for the “normal class” in AD, but is crucially invalid for the “anomaly class” since anomalies are not necessarily similar to one another. Instead, semi-supervised AD approaches must find a compact description of the normal class while also correctly discriminating the labeled anomalies (Görnitz et al., 2013). Figure 1 illustrates the differences between various learning paradigms applied to AD on a toy example.
33
+
34
+ We introduce Deep SAD (Deep Semi-supervised Anomaly Detection) in this work, an end-to-end deep method for general semi-supervised AD. Our main contributions are the following:
35
+
36
+ • We introduce Deep SAD, a generalization of the unsupervised Deep SVDD method (Ruff et al., 2018) to the semi-supervised AD setting.
37
+ • We present an information-theoretic framework for deep AD, which can serve as an interpretation of our Deep SAD method and similar approaches.
38
+ • We conduct extensive experiments in which we establish experimental scenarios for the general semi-supervised AD problem where we also introduce novel baselines.
39
+
40
+ # 2 AN INFORMATION-THEORETIC VIEW ON DEEP ANOMALY DETECTION
41
+
42
+ The study of the theoretical foundations of deep learning is an active and ongoing research effort (Montavon et al., 2011; Tishby & Zaslavsky, 2015; Cohen et al., 2016; Eldan & Shamir, 2016; Neyshabur et al., 2017; Raghu et al., 2017; Zhang et al., 2017; Achille & Soatto, 2018; Arora et al., 2018; Belkin et al., 2018; Wiatowski & Bölcskei, 2018; Lapuschkin et al., 2019). One important line of research that has emerged is rooted in information theory (Shannon, 1948). In the supervised classification setting where one has input variable $X$ , latent variable $Z$ (e.g., the final layer of a deep network), and output variable $Y$ (i.e., the label), the well-known Information Bottleneck principle (Tishby et al., 1999; Tishby & Zaslavsky, 2015; Shwartz-Ziv & Tishby, 2017; Alemi et al., 2017; Saxe et al., 2018) provides an explanation for representation learning as the trade-off between finding a minimal compression $Z$ of the input $X$ while retaining the informativeness of $Z$ for predicting the label $Y$ . Put formally, supervised deep learning seeks to minimize the mutual information $\mathcal { T } ( X ; Z )$ between the input $X$ and the latent representation $Z$ while maximizing the mutual information $\mathcal { T } ( Z ; Y )$ between $Z$ and the classification task $Y$ , i.e.
43
+
44
+ $$
45
+ \begin{array} { r l } { \underset { p ( z | x ) } { \operatorname* { m i n } } } & { { } \mathcal { T } ( X ; Z ) - \alpha \mathcal { T } ( Z ; Y ) , } \end{array}
46
+ $$
47
+
48
+ where $p ( z | x )$ is modeled by a deep network and the hyperparameter $\alpha > 0$ controls the trade-off between compression (i.e., complexity) and classification accuracy.
49
+
50
+ For unsupervised deep learning, due to the absence of labels $Y$ and thus the lack of a clear task, other information-theoretic learning principles have been formulated. Of these, the Infomax principle (Linsker, 1988; Bell & Sejnowski, 1995; Hjelm et al., 2019) is one of the most prevalent and widely used principles. In contrast to (1), the objective of Infomax is to maximize the mutual information $\mathcal { T } ( X ; Z )$ between the data $X$ and its latent representation $Z$ :
51
+
52
+ $$
53
+ \begin{array} { r l } { \underset { p ( z | x ) } { \operatorname* { m a x } } } & { { } \mathcal { T } ( X ; Z ) + \beta \mathcal { R } ( Z ) . } \end{array}
54
+ $$
55
+
56
+ This is typically done under some additional constraint or regularization $\mathcal { R } ( Z )$ on the representation $Z$ with hyperparameter $\beta > 0$ to obtain statistical properties desired for some specific downstream task. Examples where the Infomax principle has been applied include tasks such as independent component analysis (Bell & Sejnowski, 1995), clustering (Slonim et al., 2005; Ji et al., 2018), generative modeling (Chen et al., 2016; Hoffman $\&$ Johnson, 2016; Zhao et al., 2017; Alemi et al., 2018), and unsupervised representation learning in general (Hjelm et al., 2019).
57
+
58
+ We observe that the Infomax principle has also been applied in previous deep representations for AD. Most notably autoencoders (Rumelhart et al., 1986; Hinton & Salakhutdinov, 2006), which are the predominant approach to deep AD (Hawkins et al., 2002; Sakurada & Yairi, 2014; Andrews et al., 2016; Erfani et al., 2016; Zhai et al., 2016; Chen et al., 2017; Chalapathy & Chawla, 2019), can be understood as implicitly maximizing the mutual information $\mathcal { T } ( X ; Z )$ via the reconstruction objective (Vincent et al., 2008) under some regularization of the latent code $Z$ . Choices for regularization include sparsity (Makhzani & Frey, 2014), the distance to some latent prior distribution, e.g. measured via the KL divergence (Kingma & Welling, 2013; Rezende et al., 2014), an adversarial loss (Makhzani et al., 2015), or simply a bottleneck in dimensionality. Such restrictions for AD share the idea that the latent representation of the normal data should be in some sense “compact.”
59
+
60
+ As illustrated in Figure 1, a supervised (or semi-supervised) classification approach to AD only learns to recognize anomalies similar to those seen during training, due to the class cluster assumption (Chapelle et al., 2009). However, anything not normal is by definition an anomaly and thus anomalies do not have to be similar. This makes supervised (or semi-supervised) classification learning principles such as (1) ill-defined for AD. We instead build upon principle (2) to motivate a deep method for general semi-supervised AD, where we include the label information $Y$ through a novel representation learning regularization objective $\mathcal { R } ( Z ) = \mathcal { R } ( Z ; Y )$ that is based on entropy.
61
+
62
+ # 3 DEEP SEMI-SUPERVISED ANOMALY DETECTION
63
+
64
+ In the following, we introduce Deep $S A D$ , a deep method for general semi-supervised AD. To formulate our objective, we first briefly explain the unsupervised Deep SVDD method (Ruff et al., 2018) which we then generalize to the semi-supervised AD setting.
65
+
66
+ # 3.1 UNSUPERVISED DEEP SVDD AND ENTROPY MINIMIZATION
67
+
68
+ For input space $\boldsymbol { \mathcal { X } } \subseteq \mathbb { R } ^ { D }$ and output space $\mathcal { Z } \subseteq \mathbb { R } ^ { d }$ , let $\phi ( \cdot ; \mathcal { W } ) : \mathcal { X } \to \mathcal { Z }$ be a neural network with $L$ hidden layers and corresponding set of weights ${ \mathcal { W } } = \{ W ^ { 1 } , \ldots , W ^ { L } \}$ . The objective of Deep SVDD is to train the neural network $\phi$ to learn a transformation that minimizes the volume of a data-enclosing hypersphere in output space $\mathcal { Z }$ centered on a predetermined point $^ c$ . Given $n$ (unlabeled) training samples $\pmb { x } _ { 1 } , \dots , \pmb { x } _ { n } \in \pmb { \chi } ^ { }$ , the One-Class Deep SVDD objective is
69
+
70
+ $$
71
+ \operatorname* { m i n } _ { \mathcal { W } } \quad \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \| \phi ( \pmb { x } _ { i } ; \mathcal { W } ) - \pmb { c } \| ^ { 2 } + \frac { \lambda } { 2 } \sum _ { \ell = 1 } ^ { L } \| \pmb { W } ^ { \ell } \| _ { F } ^ { 2 } , \quad \lambda > 0 .
72
+ $$
73
+
74
+ Penalizing the mean squared distance of the mapped samples to the hypersphere center $^ c$ forces the network to extract those common factors of variation which are most stable within the dataset. As a consequence normal data points tend to get mapped near the hypersphere center, whereas anomalies are mapped further away (Ruff et al., 2018). The second term is a standard weight decay regularizer.
75
+
76
+ Deep SVDD is optimized via SGD using backpropagation. For initialization, Ruff et al. (2018) first pre-train an autoencoder and then initialize the weights $\mathcal { W }$ of the network $\phi$ with the converged weights of the encoder. After initialization, the hypersphere center $^ c$ is set as the mean of the network outputs obtained from an initial forward pass of the data. Once the network is trained, the anomaly score for a test point $_ { \textbf { \em x } }$ is given by the distance from $\phi ( { \pmb x } ; \mathcal { W } )$ to the center of the hypersphere:
77
+
78
+ $$
79
+ s ( \pmb { x } ) = \| \phi ( \pmb { x } ; \mathcal { W } ) - \pmb { c } \| .
80
+ $$
81
+
82
+ We now argue that Deep SVDD may not only be interpreted in geometric terms as minimum volume estimation (Scott & Nowak, 2006), but also in probabilistic terms as entropy minimization over the latent distribution. For a latent random variable $Z$ with covariance $\Sigma$ , pdf $p ( z )$ , and support $\mathcal { Z } \subseteq \mathbb { R } ^ { d }$ , we have the following bound on entropy
83
+
84
+ $$
85
+ \mathcal { H } ( Z ) = \mathbb { E } [ - \log p ( Z ) ] = - \int _ { \mathcal { Z } } p ( z ) \log p ( z ) { \mathrm { d } } z \leq \frac { 1 } { 2 } \log ( ( 2 \pi e ) ^ { d } \operatorname* { d e t } \Sigma ) ,
86
+ $$
87
+
88
+ which holds with equality iff $Z$ is jointly Gaussian (Cover & Thomas, 2012). Assuming the latent distribution $Z$ follows an isotropic Gaussian, $Z \sim N ( \pmb { \mu } , \sigma ^ { 2 } I )$ with $\sigma > 0$ , we get
89
+
90
+ $$
91
+ \mathcal { H } ( Z ) = \frac { 1 } { 2 } \log ( ( 2 \pi e ) ^ { d } \operatorname* { d e t } \sigma ^ { 2 } I ) = \frac { 1 } { 2 } \log ( ( 2 \pi e \sigma ^ { 2 } ) ^ { d } \cdot 1 ) = \frac { d } { 2 } ( 1 + \log ( 2 \pi \sigma ^ { 2 } ) ) \propto \log \sigma ^ { 2 } ,
92
+ $$
93
+
94
+ .e. for a fixed dimensionality $d$ , the entropy of $Z$ is proportional to its log-variance.
95
+
96
+ Now observe that the Deep SVDD objective (3) (disregarding weight decay regularization) is equivalent to minimizing the empirical variance and thus minimizes an upper bound on the entropy of a latent Gaussian. Since the Deep SVDD network is pre-trained on an autoencoding objective that implicitly maximizes the mutual information $\mathcal { T } ( X ; Z )$ (Vincent et al., 2008), we may interpret Deep SVDD as following the Infomax principle (2) with the additional “compactness” objective that the latent distribution should have minimal entropy.
97
+
98
+ # 3.2 DEEP SAD
99
+
100
+ We now introduce our method for deep semi-supervised anomaly detection: Deep $S A D$ . Assume that, in addition to the $n$ unlabeled samples $\pmb { x } _ { 1 } , \dots , \pmb { x } _ { n } \in \pmb { \mathcal { X } }$ with $\boldsymbol { \mathcal { X } } \subseteq \mathbb { R } ^ { D }$ , we also have access to $m$ labeled samples $( \tilde { \pmb { x } } _ { 1 } , \tilde { y } _ { 1 } ) , \dots , ( \tilde { \pmb { x } } _ { m } , \tilde { y } _ { m } ) \in \mathcal { X } \times \mathcal { Y }$ with $\mathcal { V } = \{ - 1 , + 1 \}$ where $\tilde { y } = + 1$ denotes known normal samples and $\tilde { y } ~ = ~ - 1$ known anomalies. We define our Deep $S A D$ objective as follows:
101
+
102
+ $$
103
+ \operatorname* { m i n } _ { \mathcal { W } } \quad \frac { 1 } { n + m } \sum _ { i = 1 } ^ { n } \| \phi ( \boldsymbol { x } _ { i } ; \mathcal { W } ) - c \| ^ { 2 } + \frac { \eta } { n + m } \sum _ { j = 1 } ^ { m } \left( \| \phi ( \tilde { \boldsymbol { x } } _ { j } ; \mathcal { W } ) - c \| ^ { 2 } \right) ^ { \tilde { y } _ { j } } + \frac { \lambda } { 2 } \sum _ { \ell = 1 } ^ { L } \| \boldsymbol { W } ^ { \ell } \| _ { F } ^ { 2 } .
104
+ $$
105
+
106
+ We employ the same loss term as Deep SVDD for the unlabeled data in our Deep SAD objective and thus recover Deep SVDD (3) as the special case when there is no labeled training data available $( m = 0$ ). In doing this we also incorporate the assumption that most of the unlabeled data is normal.
107
+
108
+ For the labeled data, we introduce a new loss term that is weighted via the hyperparameter $\eta > 0$ which controls the balance between the labeled and the unlabeled term. Setting $\eta > 1$ puts more emphasis on the labeled data whereas $\eta < 1$ emphasizes the unlabeled data. For the labeled normal samples $\tilde { y } = + 1 )$ ), we also impose a quadratic loss on the distances of the mapped points to the center $^ c$ , thus intending to overall learn a latent distribution which concentrates the normal data. Again, one might consider $\eta > 1$ to emphasize labeled normal over unlabeled samples. For the labeled anomalies $( \tilde { y } = - 1 )$ in contrast, we penalize the inverse of the distances such that anomalies must be mapped further away from the center.1 Note that this is in line with the common assumption that anomalies are not concentrated (Schölkopf & Smola, 2002; Steinwart et al., 2005). In our experiments we found that simply setting $\eta = 1$ yields a consistent and substantial performance improvement. A sensitivity analysis on $\eta$ is in Section 4.3.
109
+
110
+ We define the Deep SAD anomaly score again by the distance of the mapped point to the center $c$ as given in Eq. (4) and optimize our Deep SAD objective (7) via SGD using backpropagation. We provide a summary of the Deep SAD optimization procedure and further details in Appendix C.
111
+
112
+ In addition to the inverse squared norm loss we experimented with several other losses including the negative squared norm loss, negative robust losses, and the hinge loss. The negative squared norm loss, which is unbounded from below, resulted in an ill-posed optimization problem and caused optimization to diverge. Negative robust losses, such as the Hampel loss, introduce one or more scale parameters which are difficult to select or optimize in conjunction with the changing representation learned by the network. Like Ruff et al. (2018), we observed that the hinge loss was difficult to optimize and resulted in poorer performance. The inverse squared norm loss instead is bounded from below and smooth, which are crucial properties for losses used in deep learning (Goodfellow et al., 2016), and ultimately performed the best while remaining conceptually simple.
113
+
114
+ Following our insights on the connection between Deep SVDD and entropy minimization from Section 3.1, we may interpret our Deep SAD objective as modeling the latent distribution of normal data, $Z ^ { + } ~ = ~ Z | \{ Y = + 1 \}$ , to have low entropy, and the latent distribution of anomalies, $Z ^ { - } = Z | \{ Y = - 1 \}$ , to have high entropy. Minimizing the distances to the center $^ c$ (i.e., minimizing the empirical variance) for the mapped points of labeled normal samples $( \tilde { y } = + 1$ ) induces a latent distribution with low entropy for the normal data. In contrast, penalizing low variance via the inverse squared norm loss for the mapped points of labeled anomalies $\tilde { y } = - 1$ ) induces a latent distribution with high entropy for the anomalous data. That is, the network must attempt to map known anomalies to some heavy-tailed distribution. We argue that such a model better captures the nature of anomalies, which can be thought of as being generated from an infinite mixture of distributions that are different from the normal data distribution, indubitably a distribution that has high entropy. Our objective notably does not impose any cluster assumption on the anomaly-generating distribution $X | \{ Y = - 1 \}$ as is typically made in supervised or semi-supervised classification approaches (Zhu, 2005; Chapelle et al., 2009). We can express this interpretation in terms of principle (2) with an entropy regularization objective on the latent distribution:
115
+
116
+ $$
117
+ \begin{array} { r l } { \underset { p ( z | x ) } { \operatorname* { m a x } } } & { { } \mathcal { T } ( X ; Z ) + \beta ( \mathcal { H } ( Z ^ { - } ) - \mathcal { H } ( Z ^ { + } ) ) . } \end{array}
118
+ $$
119
+
120
+ To maximize the mutual information $\mathcal { T } ( X ; Z )$ , Deep SAD also relies on autoencoder pre-training (Vincent et al., 2008; Ruff et al., 2018).
121
+
122
+ # 4 EXPERIMENTS
123
+
124
+ We evaluate Deep SAD on MNIST, Fashion-MNIST, and CIFAR-10 as well as on classic AD benchmark datasets. We compare to shallow, hybrid, as well as deep unsupervised, semi-supervised and supervised competitors. We refer to other recent works (Ruff et al., 2018; Golan & El-Yaniv, 2018; Hendrycks et al., 2019a) for further comparisons between unsupervised deep AD methods.2
125
+
126
+ # 4.1 COMPETING METHODS
127
+
128
+ We consider the OC-SVM (Schölkopf et al., 2001) and SVDD (Tax & Duin, 2004) with Gaussian kernel (which in this case are equivalent), Isolation Forest (Liu et al., 2008), and KDE (Parzen, 1962) for shallow unsupervised baselines. For deep unsupervised competitors, we consider wellestablished (convolutional) autoencoders and the state-of-the-art unsupervised Deep SVDD method (Ruff et al., 2018). To avoid confusion, we note again that some literature (Song et al., 2017; Chalapathy & Chawla, 2019) refer to the methods above as being “semi-supervised” if they are trained on only labeled normal samples. For general semi-supervised AD approaches that also take advantage of labeled anomalies, we consider the state-of-the-art shallow SSAD method (Görnitz et al., 2013) with Gaussian kernel. As mentioned earlier, there are no deep competitors for general semisupervised AD that are applicable to general data types. To get a comprehensive comparison we therefore introduce a novel hybrid $S S A D$ baseline that applies SSAD to the latent codes of autoencoder models. Such hybrid methods have demonstrated solid performance improvements over their raw feature counterparts on high-dimensional data (Erfani et al., 2016; Nicolau et al., 2016). We also include such hybrid variants for all unsupervised shallow competitors. To also compare to a deep semi-supervised learning method that targets classification as the downstream task, we add the well-known Semi-Supervised Deep Generative Model (SS-DGM) (Kingma et al., 2014) where we use the latent class probability estimate (normal vs. anomalous) as the anomaly score. To complete the full learning spectrum, we also include a fully supervised deep classifier trained on the binary cross-entropy loss.
129
+
130
+ In our experiments we deliberately grant the shallow and hybrid methods an unfair advantage by selecting their hyperparameters to maximize AUC on a subset $( 1 0 \% )$ of the test set to minimize hyperparameter selection issues. To control for architectural effects between the deep methods, we always use the same (LeNet-type) deep networks. Full details on network architectures and hyperparameter selection can be found in Appendices D and E. Due to space constraints, in the main text we only report results for methods which showed competitive performance and defer results for the underperforming methods in Appendix F.
131
+
132
+ # 4.2 EXPERIMENTAL SCENARIOS ON MNIST, FASHION-MNIST, AND CIFAR-10
133
+
134
+ Semi-supervised anomaly detection setup MNIST, Fashion-MNIST, and CIFAR-10 all have ten classes from which we derive ten AD setups on each dataset following previous works (Ruff et al., 2018; Chalapathy et al., 2018; Golan & El-Yaniv, 2018). In every setup, we set one of the ten classes to be the normal class and let the remaining nine classes represent anomalies. We use the original training data of the respective normal class as the unlabeled part of our training set. Thus we start with a clean AD setting that fulfills the assumption that most (in this case all) unlabeled samples are normal. The training data of the respective nine anomaly classes then forms the data pool from which we draw anomalies for training to create different scenarios. We compute the commonly used AUC measure on the original respective test sets using ground truth labels to make a quantitative comparison, i.e. $\tilde { y } = + 1$ for the normal class and $\tilde { y } = - 1$ for the respective nine anomaly classes. We rescale pixels to $[ 0 , 1 ]$ via min-max feature scaling as the only data pre-processing step.
135
+
136
+ Experimental scenarios We examine three scenarios in which we vary the following three experimental parameters: (i) the ratio of labeled training data $\gamma _ { l }$ , (ii) the ratio of pollution $\gamma _ { p }$ in the unlabeled training data with (unknown) anomalies, and (iii) the number of anomaly classes $k _ { l }$ included in the labeled training data.
137
+
138
+ (i) Adding labeled anomalies In this scenario, we investigate the effect that including labeled anomalies during training has on detection performance to see the benefit of a general semisupervised AD approach over other paradigms. To do this we increase the ratio of labeled training data $\gamma _ { l } = m / ( n \bar { + } \dot { m } )$ by adding more and more known anomalies $\tilde { \pmb { x } } _ { 1 } , \ldots , \tilde { \pmb { x } } _ { m }$ with $\tilde { y } _ { j } = - 1$ to the training set. The labeled anomalies are sampled from one of the nine anomaly classes $k _ { l } = 1 \AA$ ). For testing, we then consider all nine remaining classes as anomalies, i.e. there are eight novel classes at testing time. We do this to simulate the unpredictable nature of anomalies. For the unlabeled part of the training set, we keep the training data of the respective normal class, which we leave unpolluted in this experimental setup, i.e. $\gamma _ { p } = 0$ . We iterate this training set generation process per AD setup always over all the nine respective anomaly classes and report the average results over the ten AD setups $\times$ nine anomaly classes, i.e. over 90 experiments per labeled ratio $\gamma _ { l }$ .
139
+
140
+ (ii) Polluted training data Here we investigate the robustness of the different methods to an increasing pollution ratio $\gamma _ { p }$ of the training set with unlabeled anomalies. To do so we pollute the unlabeled part of the training set with anomalies drawn from all nine respective anomaly classes in each AD setup. We fix the ratio of labeled training samples at $\gamma _ { l } = 0 . 0 5$ where we again draw samples only from $k _ { l } = 1$ anomaly class in this scenario. We repeat this training set generation process per AD setup over all the nine respective anomaly classes and report the average results over the resulting 90 experiments per pollution ratio $\gamma _ { p }$ . We hypothesize that learning from labeled anomalies in a semi-supervised AD approach alleviates the negative impact pollution has on detection performance since similar unknown anomalies in the unlabeled data might be detected.
141
+
142
+ (iii) Number of known anomaly classes In the last scenario, we compare the detection performance at various numbers of known anomaly classes. In scenarios (i) and (ii), we always sample labeled anomalies only from one out of the nine anomaly classes $k _ { l } = 1 \AA$ ). In this scenario, we now increase the number of anomaly classes $k _ { l }$ included in the labeled part of the training set. Since we have a limited number of anomaly classes (nine) in each AD setup, we expect the supervised classifier to catch up at some point. We fix the overall ratio of labeled training examples again at $\gamma _ { l } = 0 . 0 5$ and consider a pollution ratio of $\gamma _ { p } = 0 . 1$ for the unlabeled training data in this scenario. We repeat this training set generation process for ten seeds in each of the ten AD setups and report the average results over the resulting 100 experiments per number $k _ { l }$ . For each seed, the $k _ { l }$ classes are drawn uniformly at random from the nine respective anomaly classes.
143
+
144
+ ![](images/6a4b30e8401af0b6a995b9e62b56f40d202178ef149aa66c18ea58a6fdf3e812.jpg)
145
+ Figure 2: Results of scenario (i), where we increase the ratio of labeled anomalies $\gamma _ { l }$ in the training set. We report avg. AUC with st. dev. over 90 experiments at various ratios $\gamma _ { l }$ . A $" \star "$ indicates a statistically significant $\alpha = 0 . 0 5$ ) difference between the $1 ^ { \mathrm { s t } }$ and $2 ^ { \mathrm { n d } }$ best method.
146
+
147
+ Results The results of scenarios (i)–(iii) are shown in Figures 2–4. In addition to the avg. AUC with st. dev., we report the outcome of Wilcoxon signed-rank tests (Wilcoxon, 1945) applied to the first and second best performing method to indicate statistically significant $\alpha = 0 . 0 5$ ) differences in performance. Figure 2 demonstrates the benefit of our semi-supervised approach to AD especially on the most complex CIFAR-10 dataset, where Deep SAD performs best. Figure 2 moreover confirms that a supervised classification approach is vulnerable to novel anomalies at testing time when only little labeled training data is available. In comparison, Deep SAD generalizes to novel anomalies while also taking advantage of the labeled examples. Note that our novel hybrid SSAD baseline also performs well. Figure 3 shows that the detection performance of all methods decreases with increasing data pollution. Deep SAD proves to be most robust again especially on CIFAR-10. Finally, Figure 4 shows that the more diverse the labeled anomalies in the training set, the better the detection performance becomes. We can again see that the supervised method is very sensitive to the number of anomaly classes but catches up at some point as suspected. This does not occur with CIFAR-10, however, where $\gamma _ { l } = 0 . 0 5$ labeled training samples seems to be insufficient for classification. Overall, we see that Deep SAD is particularly beneficial on the more complex data.
148
+
149
+ ![](images/77079043d4f5c35a574f01e8bf0d578a39b1fd6053b2c4422952b88068ae2153.jpg)
150
+ Figure 3: Results of scenario (ii), where we pollute the unlabeled part of the training set with (unknown) anomalies. We report avg. AUC with st. dev. over 90 experiments at various ratios $\gamma _ { p }$ . A $\cdot _ { \star } \vec { \mathbf { \nabla } }$ indicates a statistically significant $\alpha = 0 . 0 5$ ) difference between the $1 ^ { \mathrm { s t } }$ and $2 ^ { \mathrm { n d } }$ best method.
151
+
152
+ ![](images/ea09a333f7ad7be84cd20324190c10f16c0bcd6343971d15247a86cacd5ce4c2.jpg)
153
+ Figure 4: Results of scenario (iii), where we increase the number of anomaly classes $k _ { l }$ included in the labeled training data. We report avg. AUC with st. dev. over 100 experiments for various $k _ { l }$ . A $" \star "$ indicates a statistically significant $\alpha = 0 . 0 5$ ) difference between the $1 ^ { \mathrm { s t } }$ and $2 ^ { \mathrm { n d } }$ best method.
154
+
155
+ # 4.3 SENSITIVITY ANALYSIS
156
+
157
+ We run Deep SAD experiments on the ten AD setups described above on each dataset for $\eta \in$ $\{ 1 0 ^ { - 2 } , \ldots , 1 0 ^ { 2 } \}$ to analyze the sensitivity of Deep SAD with respect to the hyperparameter $\eta > 0$ . In this analysis, we set the experimental parameters to their default, $\gamma _ { l } = 0 . 0 5$ , $\gamma _ { p } = 0 . 1$ , and $k _ { l } = 1$ , and again iterate over all nine anomaly classes in every AD setup. The results shown in Figure 5 suggest that Deep SAD is fairly robust against changes of the hyperparameter $\eta$ .
158
+
159
+ In addition, we run experiments under the same experimental settings while varying the dimension $d \ \in \ \{ 2 ^ { 4 } , \dots , 2 ^ { 9 } \}$ of the output space $\mathcal { Z } \subseteq \mathbb { R } ^ { d }$ to infer the sensitivity of Deep SAD with respect to the representation dimensionality, where we keep $\eta = 1$ . The results are given in Figure 6 in Appendix A. There we also com
160
+
161
+ ![](images/ca86446aec4da516756d81d49533dd6e4b1b33f86e59c0a467a08ac963eb32f9.jpg)
162
+ Figure 5: Deep SAD sensitivity analysis w.r.t. $\eta$ We report avg. AUC with st. dev. over 90 experiments for various values of hyperparameter $\eta$ .
163
+
164
+ pare to our hybrid SSAD baseline, which was the strongest competitor. Interestingly we observe that detection performance increases with dimension $d$ , converging to an upper bound in performance. This suggests that one would want to set $d$ large enough to have sufficiently high mutual information $\mathcal { T } ( X ; Z )$ before compressing to a compact characterization.
165
+
166
+ # 4.4 CLASSIC ANOMALY DETECTION BENCHMARK DATASETS
167
+
168
+ In a final experiment, we also examine the detection performance of the various methods on some well-established AD benchmark datasets (Rayana, 2016). We run these experiments to evaluate the deep versus the shallow approaches on non-image datasets that are rarely considered in deep AD literature. Here we observe that the shallow kernel methods seem to have a slight edge on the relatively small, low-dimensional benchmarks. Nonetheless, Deep SAD proves competitive and the small differences observed might be explained by the advantage we grant the shallow methods in their hyperparameter selection. We give the full details and results in Appendix B.
169
+
170
+ Our results and other recent works (Ruff et al., 2018; Golan & El-Yaniv, 2018; Hendrycks et al., 2019a) overall demonstrate that deep methods are especially superior on complex data with hierarchical structure. Unlike other deep approaches (Ergen et al., 2017; Kiran et al., 2018; Min et al., 2018; Deecke et al., 2018; Golan & El-Yaniv, 2018), however, our Deep SAD method is not domain or data-type specific. Due to its good performance using both deep and shallow networks we expect Deep SAD to extend well to other data types.
171
+
172
+ # 5 CONCLUSION AND FUTURE WORK
173
+
174
+ In this work we introduced Deep SAD, a deep method for general semi-supervised anomaly detection. Our method is a generalization of the unsupervised Deep SVDD method (Ruff et al., 2018) to the semi-supervised setting. The results of our experimental evaluation suggest that general semisupervised anomaly detection should always be preferred whenever some labeled information on both normal samples or anomalies is available.
175
+
176
+ Moreover, we formulated an information-theoretic framework for deep anomaly detection based on the Infomax principle. Using this framework, we interpreted our method as minimizing the entropy of the latent distribution for normal data and maximizing the entropy of the latent distribution for anomalous data. We introduced this framework with the aim of forming a basis for new methods as well as rigorous theoretical analyses in the future, e.g. studying deep anomaly detection under the rate-distortion curve (Alemi et al., 2018).
177
+
178
+ # ACKNOWLEDGMENTS
179
+
180
+ LR acknowledges support by the German Ministry of Education and Research (BMBF) in the project ALICE III (01IS18049B). MK and RV acknowledge support by the German Research Foundation (DFG) award KL 2698/2-1 and by the German Ministry of Education and Research (BMBF) awards 031L0023A, 01IS18051A, and 031B0770E. AB is grateful for support by the National Research Foundation of Singapore, STEE-SUTD Cyber Security Laboratory, and the Ministry of Education, Singapore, under its program MOE2016-T2-2-154. NG acknowledges support by the German Ministry of Education and Research (BMBF) through the Berlin Center for Machine Learning (01IS18037I). KRM acknowledges partial financial support by the German Ministry of Education and Research (BMBF) under grants 01IS14013A-E, 01IS18025A, 01IS18037A, 01GQ1115 and 01GQ0850; Deutsche Forschungsgesellschaft (DFG) under grant Math+, EXC 2046/1, project-ID 390685689, and by the Technology Promotion (IITP) grant funded by the Korea government (No. 2017-0-00451, No. 2017-0-01779).
181
+
182
+ # REFERENCES
183
+
184
+ Alessandro Achille and Stefano Soatto. Emergence of invariance and disentanglement in deep representations. Journal of Machine Learning Research, 19(1):1947–1980, 2018.
185
+
186
+ Samet Akcay, Amir Atapour-Abarghouei, and Toby P Breckon. GANomaly: Semi-supervised anomaly detection via adversarial training. In ACCV, pp. 622–637, 2018.
187
+
188
+ Alexander A Alemi, Ian Fischer, Joshua V Dillon, and Kevin Murphy. Deep variational information bottleneck. In ICLR, 2017.
189
+ Alexander A Alemi, Ben Poole, Ian Fischer, Joshua V Dillon, Rif A Saurous, and Kevin Murphy. Fixing a broken ELBO. In ICML, volume 80, pp. 159–168, 2018.
190
+ Jerone T A Andrews, Edward J Morton, and Lewis D Griffin. Detecting Anomalous Data Using Auto-Encoders. IJMLC, 6(1):21, 2016.
191
+ Sanjeev Arora, Nadav Cohen, and Elad Hazan. On the optimization of deep networks: Implicit acceleration by overparameterization. In ICML, volume 80, pp. 244–253, 2018.
192
+ Mikhail Belkin, Siyuan Ma, and Soumik Mandal. To understand deep learning we need to understand kernel learning. In ICML, pp. 540–548, 2018.
193
+ Anthony J Bell and Terrence J Sejnowski. An information-maximization approach to blind separation and blind deconvolution. Neural computation, 7(6):1129–1159, 1995.
194
+ Gilles Blanchard, Gyemin Lee, and Clayton Scott. Semi-supervised novelty detection. Journal of Machine Learning Research, 11(Nov):2973–3009, 2010.
195
+ Raghavendra Chalapathy and Sanjay Chawla. Deep learning for anomaly detection: A survey. arXiv:1901.03407, 2019.
196
+ Raghavendra Chalapathy, Aditya Krishna Menon, and Sanjay Chawla. Anomaly detection using one-class neural networks. arXiv:1802.06360, 2018.
197
+ Varun Chandola, Arindam Banerjee, and Vipin Kumar. Anomaly Detection: A Survey. ACM Computing Surveys, 41(3):1–58, 2009.
198
+ Olivier Chapelle, Bernhard Schölkopf, and Alexander Zien. Semi-supervised learning. IEEE Transactions on Neural Networks, 20(3):542–542, 2009.
199
+ Jinghui Chen, Saket Sathe, Charu C Aggarwal, and Deepak S Turaga. Outlier Detection with Autoencoder Ensembles. In SDM, pp. 90–98, 2017.
200
+ Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. InfoGAN: Interpretable representation learning by information maximizing generative adversarial nets. In NIPS, pp. 2172–2180, 2016.
201
+ Nadav Cohen, Or Sharir, and Amnon Shashua. On the expressive power of deep learning: A tensor analysis. In COLT, volume 49, pp. 698–728, 2016.
202
+ Thomas M Cover and Joy A Thomas. Elements of Information Theory. John Wiley & Sons, 2012.
203
+ Zihang Dai, Zhilin Yang, Fan Yang, William W Cohen, and Ruslan R Salakhutdinov. Good semisupervised learning that requires a bad gan. In NIPS, pp. 6510–6520, 2017.
204
+ Lucas Deecke, Robert A Vandermeulen, Lukas Ruff, Stephan Mandt, and Marius Kloft. Image anomaly detection with generative adversarial networks. In ECML-PKDD, 2018.
205
+ François Denis. PAC learning from positive statistical queries. In International Conference on Algorithmic Learning Theory, pp. 112–126, 1998.
206
+ Ronen Eldan and Ohad Shamir. The power of depth for feedforward neural networks. In COLT, volume 49, pp. 907–940, 2016.
207
+ Sarah M Erfani, Sutharshan Rajasegarar, Shanika Karunasekera, and Christopher Leckie. Highdimensional and large-scale anomaly detection using a linear one-class SVM with deep learning. Pattern Recognition, 58:121–134, 2016.
208
+ Tolga Ergen, Ali Hassan Mirza, and Suleyman Serdar Kozat. Unsupervised and semi-supervised anomaly detection with LSTM neural networks. arXiv:1710.09207, 2017.
209
+
210
+ Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In AISTATS, pp. 249–256, 2010.
211
+
212
+ Izhak Golan and Ran El-Yaniv. Deep anomaly detection using geometric transformations. In NeurIPS, pp. 9758–9769, 2018.
213
+
214
+ Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep Learning. MIT Press, 2016. http: //www.deeplearningbook.org.
215
+
216
+ Nico Görnitz, Marius Kloft, Konrad Rieck, and Ulf Brefeld. Toward supervised anomaly detection. Journal of Artificial Intelligence Research, 46:235–262, 2013.
217
+
218
+ Simon Hawkins, Hongxing He, Graham Williams, and Rohan Baxter. Outlier Detection Using Replicator Neural Networks. In DaWaK, volume 2454, pp. 170–180, 2002.
219
+
220
+ Dan Hendrycks, Mantas Mazeika, and Thomas G Dietterich. Deep anomaly detection with outlier exposure. In ICLR, 2019a.
221
+
222
+ Dan Hendrycks, Mantas Mazeika, Saurav Kadavath, and Dawn Song. Using self-supervised learning can improve model robustness and uncertainty. In NeurIPS, pp. 15637–15648, 2019b.
223
+
224
+ Geoffrey E Hinton and Ruslan R Salakhutdinov. Reducing the Dimensionality of Data with Neural Networks. Science, 313(5786):504–507, 2006.
225
+
226
+ R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. In ICLR, 2019.
227
+
228
+ Matthew D Hoffman and Matthew J Johnson. ELBO surgery: yet another way to carve up the variational evidence lower bound. In NIPS Workshop in Advances in Approximate Bayesian Inference, 2016.
229
+
230
+ Sergey Ioffe and Christian Szegedy. Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift. In ICML, pp. 448–456, 2015.
231
+
232
+ Xu Ji, Joao F Henriques, and Andrea Vedaldi. Invariant information distillation for unsupervised image segmentation and clustering. arXiv:1807.06653, 2018.
233
+
234
+ JooSeuk Kim and Clayton D Scott. Robust kernel density estimation. Journal of Machine Learning Research, 13(Sep):2529–2565, 2012.
235
+
236
+ Diederik P Kingma and Jimmy Ba. Adam: A Method for Stochastic Optimization. In ICLR, 2015.
237
+
238
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. In ICLR, 2013.
239
+
240
+ Diederik P Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semi-supervised learning with deep generative models. In NIPS, pp. 3581–3589, 2014.
241
+
242
+ B Kiran, Dilip Thomas, and Ranjith Parakkal. An overview of deep learning based methods for unsupervised and semi-supervised anomaly detection in videos. Journal of Imaging, 4(2):36, 2018.
243
+
244
+ Sebastian Lapuschkin, Stephan Wäldchen, Alexander Binder, Grégoire Montavon, Wojciech Samek, and Klaus-Robert Müller. Unmasking clever hans predictors and assessing what machines really learn. Nature communications, 10(1):1096, 2019.
245
+
246
+ Ralph Linsker. Self-organization in a perceptual network. IEEE Computer, 21(3):105–117, 1988.
247
+
248
+ Fei T Liu, Kai M Ting, and Zhi-Hua Zhou. Isolation Forest. In ICDM, pp. 413–422, 2008.
249
+
250
+ Yi Liu and Yuan F Zheng. Minimum enclosing and maximum excluding machine for pattern description and discrimination. In ICPR, pp. 129–132, 2006.
251
+
252
+ Alireza Makhzani and Brendan Frey. K-sparse autoencoders. In ICLR, 2014.
253
+
254
+ Alireza Makhzani, Jonathon Shlens, Navdeep Jaitly, Ian Goodfellow, and Brendan Frey. Adversarial autoencoders. arXiv:1511.05644, 2015.
255
+
256
+ Erxue Min, Jun Long, Qiang Liu, Jianjing Cui, Zhiping Cai, and Junbo Ma. SU-IDS: A semisupervised and unsupervised framework for network intrusion detection. In International Conference on Cloud Computing and Security, pp. 322–334, 2018.
257
+
258
+ Grégoire Montavon, Mikio L Braun, and Klaus-Robert Müller. Kernel analysis of deep networks. Journal of Machine Learning Research, 12(Sep):2563–2581, 2011.
259
+
260
+ Mary M Moya, Mark W Koch, and Larry D Hostetler. One-class classifier networks for target recognition applications. In Proceedings World Congress on Neural Networks, pp. 797–801, 1993.
261
+
262
+ Jordi Muñoz-Marí, Francesca Bovolo, Luis Gómez-Chova, Lorenzo Bruzzone, and Gustavo CampValls. Semi-Supervised One-Class Support Vector Machines for Classification of Remote Sensing Sata. IEEE Transactions on Geoscience and Remote Sensing, 48(8):3188–3197, 2010.
263
+
264
+ Behnam Neyshabur, Srinadh Bhojanapalli, David McAllester, and Nati Srebro. Exploring generalization in deep learning. In NIPS, pp. 5947–5956, 2017.
265
+
266
+ Miguel Nicolau, James McDermott, et al. A hybrid autoencoder and density estimation model for anomaly detection. In International Conference on Parallel Problem Solving from Nature, pp. 717–726, 2016.
267
+
268
+ Augustus Odena. Semi-supervised learning with generative adversarial networks. arXiv:1606.01583, 2016.
269
+
270
+ Avital Oliver, Augustus Odena, Colin Raffel, Ekin D Cubuk, and Ian J Goodfellow. Realistic evaluation of deep semi-supervised learning algorithms. In NeurIPS, pp. 3235–3246, 2018.
271
+
272
+ Guansong Pang, Chunhua Shen, and Anton van den Hengel. Deep anomaly detection with deviation networks. In KDD, pp. 353–362, 2019.
273
+
274
+ E. Parzen. On Estimation of a Probability Density Function and Mode. The annals of mathematical statistics, 33(3):1065–1076, 1962.
275
+
276
+ Marco AF Pimentel, David A Clifton, Lei Clifton, and Lionel Tarassenko. A review of novelty detection. Signal Processing, 99:215–249, 2014.
277
+
278
+ Maithra Raghu, Ben Poole, Jon Kleinberg, Surya Ganguli, and Jascha Sohl Dickstein. On the expressive power of deep neural networks. In ICML, volume 70, pp. 2847–2854, 2017.
279
+
280
+ Antti Rasmus, Mathias Berglund, Mikko Honkala, Harri Valpola, and Tapani Raiko. Semisupervised learning with ladder networks. In NIPS, pp. 3546–3554, 2015.
281
+
282
+ Shebuti Rayana. ODDS library, 2016. URL http://odds.cs.stonybrook.edu.
283
+
284
+ Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic Backpropagation and Approximate Inference in Deep Generative Models. In ICML, volume 32, pp. 1278–1286, 2014.
285
+
286
+ Lukas Ruff, Robert A Vandermeulen, Nico Görnitz, Lucas Deecke, Shoaib A Siddiqui, Alexander Binder, Emmanuel Müller, and Marius Kloft. Deep one-class classification. In ICML, volume 80, pp. 4390–4399, 2018.
287
+
288
+ Lukas Ruff, Yury Zemlyanskiy, Robert Vandermeulen, Thomas Schnake, and Marius Kloft. Selfattentive, multi-context one-class classification for unsupervised anomaly detection on text. In ACL, pp. 4061–4071, 2019.
289
+
290
+ David E Rumelhart, Geoffrey E Hinton, and Ronald J Williams. Learning internal representations by error propagation. In Parallel Distributed Processing – Explorations in the Microstructure of Cognition, chapter 8, pp. 318–362. MIT Press, 1986.
291
+
292
+ Mayu Sakurada and Takehisa Yairi. Anomaly detection using autoencoders with nonlinear dimensionality reduction. In Proceedings of the 2nd MLSDA Workshop, pp. 4, 2014.
293
+
294
+ Andrew Michael Saxe, Yamini Bansal, Joel Dapello, Madhu Advani, Artemy Kolchinsky, Brendan Daniel Tracey, and David Daniel Cox. On the information bottleneck theory of deep learning. In ICLR, 2018.
295
+
296
+ Bernhard Schölkopf and Alex J Smola. Learning with Kernels. MIT press, 2002.
297
+
298
+ Bernhard Schölkopf, 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.
299
+
300
+ Clayton D Scott and Robert D Nowak. Learning minimum volume sets. Journal of Machine Learning Research, 7(Apr):665–704, 2006.
301
+
302
+ Claude Elwood Shannon. A mathematical theory of communication. Bell system technical journal, 27(3):379–423, 1948.
303
+
304
+ Ravid Shwartz-Ziv and Naftali Tishby. Opening the black box of deep neural networks via information. arXiv:1703.00810, 2017.
305
+
306
+ Noam Slonim, Gurinder Singh Atwal, Gašper Tkacik, and William Bialek. Information-based clus- ˇ tering. Proceedings of the National Academy of Sciences, 102(51):18297–18302, 2005.
307
+
308
+ Hongchao Song, Zhuqing Jiang, Aidong Men, and Bo Yang. A hybrid semi-supervised anomaly detection model for high-dimensional data. Computational Intelligence and Neuroscience, 2017.
309
+
310
+ Ingo Steinwart, Don Hush, and Clint Scovel. A classification framework for anomaly detection. Journal of Machine Learning Research, 6(Feb):211–232, 2005.
311
+
312
+ David M J Tax and Robert P W Duin. Support Vector Data Description. Machine learning, 54(1): 45–66, 2004.
313
+
314
+ Naftali Tishby and Noga Zaslavsky. Deep learning and the information bottleneck principle. In 2015 IEEE Information Theory Workshop (ITW), pp. 1–5, 2015.
315
+
316
+ Naftali Tishby, Fernando C Pereira, and William Bialek. The information bottleneck method. In The 37th annual Allerton Conference on Communication, Control and Computing, pp. 368–377, 1999.
317
+
318
+ Robert A Vandermeulen and Clayton Scott. Consistency of robust kernel density estimators. In COLT, pp. 568–591, 2013.
319
+
320
+ Pascal Vincent, Hugo Larochelle, Yoshua Bengio, and Pierre-Antoine Manzagol. Extracting and composing robust features with denoising autoencoders. In ICML, pp. 1096–1103, 2008.
321
+
322
+ Jigang Wang, Predrag Neskovic, and Leon N Cooper. Pattern classification via single spheres. In International Conference on Discovery Science, pp. 241–252. Springer, 2005.
323
+
324
+ Thomas Wiatowski and Helmut Bölcskei. A mathematical theory of deep convolutional neural networks for feature extraction. IEEE Transactions on Information Theory, 64(3):1845–1866, 2018.
325
+
326
+ Frank Wilcoxon. Individual comparisons by ranking methods. Biometrics Bulletin, 1(6):80–83, 1945.
327
+
328
+ Shuangfei Zhai, Yu Cheng, Weining Lu, and Zhongfei Zhang. Deep structured energy based models for anomaly detection. In ICML, volume 48, pp. 1100–1109, 2016.
329
+
330
+ Bangzuo Zhang and Wanli Zuo. Learning from positive and unlabeled examples: A survey. In Proceedings of the IEEE International Symposium on Information Processing, pp. 650–654, 2008.
331
+
332
+ Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. In ICLR, 2017.
333
+
334
+ Shengjia Zhao, Jiaming Song, and Stefano Ermon. InfoVAE: Information maximizing variational autoencoders. arXiv:1706.02262, 2017.
335
+
336
+ Xiaojin Zhu. Semi-supervised learning literature survey. Computer Sciences TR 1530, University of Wisconsin Madison, 2005.
337
+
338
+ # A ADDITIONAL RESULTS ON MNIST, FASHION-MNIST, AND CIFAR-10
339
+
340
+ A.1 SENSITIVITY ANALYSIS W.R.T REPRESENTATION DIMENSIONALITY
341
+
342
+ ![](images/9023e0362409f6833a18a34cd3af1afe3da07b10c9f56b27b87c016a8b9903cf.jpg)
343
+ Figure 6: Sensitivity analysis w.r.t. the network representation dimensionality $d$ for our Deep SAD method and the closest competitor hybrid SSAD. We report avg. AUC with st. dev. over 90 experiments for various values of $d$ .
344
+
345
+ # A.2 AUC SCATTERPLOTS OF BEST VS. SECOND BEST METHODS ON CIFAR-10
346
+
347
+ We provide AUC scatterplots in Figures 7–9 of the best $( 1 ^ { \mathrm { s t } } )$ vs. second best $( 2 ^ { \mathrm { n d } } )$ performing methods in the experimental scenarios (i)–(iii) on the most complex CIFAR-10 dataset. If most points fall above the identity line, this is a very strong indication that the best method indeed significantly outperforms the second best, which often is the case for our Deep SAD method.
348
+
349
+ ![](images/9403cd0c598271c54ceff11f270616b78afaee33e58abc542411d1856bb0e1f9.jpg)
350
+ Figure 7: AUC scatterplots of best $( 1 ^ { \mathrm { s t } } )$ vs. second best $( 2 ^ { \mathrm { n d } } )$ performing methods in experimental scenario (i) on CIFAR-10, where we increase the ratio of labeled anomalies $\gamma _ { l }$ in the training set.
351
+
352
+ ![](images/cb77ea14cda51fd3e24cdbc43d07eec56ab80c71a52f9daaf32dbcd29044a11e.jpg)
353
+ Figure 8: AUC scatterplots of best $( 1 ^ { \mathrm { s t } } )$ vs. second best $( 2 ^ { \mathrm { n d } } )$ performing methods in experimental scenario (ii) on CIFAR-10, where we pollute the unlabeled part of the training set with (unknown) anomalies at various ratios $\gamma _ { p }$ .
354
+
355
+ ![](images/bd99c8ef9a36fc4da2f4d83426b7d9bbf7398cb08af547eb554baa3b35194a0f.jpg)
356
+ Figure 9: AUC scatterplots of best $( 1 ^ { \mathrm { s t } } )$ vs. second best $( 2 ^ { \mathrm { n d } } )$ performing methods in experimental scenario (iii) on CIFAR-10, where we increase the number of anomaly classes $k _ { l }$ included in the labeled training data.
357
+
358
+ # B RESULTS ON CLASSIC ANOMALY DETECTION BENCHMARK DATASETS
359
+
360
+ In this experiment, we examine the detection performance on some well-established AD benchmark datasets (Rayana, 2016) listed in Table 1. We do this to evaluate the deep against the shallow approaches also on non-image, tabular datasets that are rarely considered in the deep AD literature. For the evaluation, we consider random train-to-test set splits of 60:40 while maintaining the original proportion of anomalies in each set. We then run experiments for 10 seeds with $\gamma _ { l } = 0 . 0 1$ and $\gamma _ { p } = 0$ , i.e. $1 \%$ of the training set are labeled anomalies and the
361
+
362
+ Table 1: Anomaly detection benchmarks.
363
+
364
+ <table><tr><td>Dataset</td><td>N</td><td>D</td><td>#outliers (%)</td></tr><tr><td>arrhythmia</td><td>452</td><td>274</td><td>66 (14.6%)</td></tr><tr><td>cardio</td><td>1,831</td><td>21</td><td>176 (9.6%)</td></tr><tr><td>satellite</td><td>6,435</td><td>36</td><td>2,036 (31.6%)</td></tr><tr><td>satimage-2</td><td>5,803</td><td>36</td><td>71 (1.2%)</td></tr><tr><td>shuttle</td><td>49,097</td><td>9</td><td>3,511 (7.2%)</td></tr><tr><td>thyroid</td><td>3,772</td><td>6</td><td>93 (2.5%)</td></tr></table>
365
+
366
+ unlabeled training data is unpolluted. Since there are no specific different anomaly classes in these datasets, we have $k _ { l } = 1$ . We standardize features to have zero mean and unit variance as the only pre-processing step.
367
+
368
+ Table 2 shows the results of the competitive methods. We observe that the shallow kernel methods seem to perform slightly better on the rather small, low-dimensional benchmarks. Deep SAD proves competitive though and the small differences might be explained by the strong advantage we grant the shallow methods in the selection of their hyperparameters. We provide the complete table with the results from all methods in Appendix F
369
+
370
+ Table 2: Results on classic AD benchmark datasets in the setting with no pollution $\gamma _ { p } = 0$ and a ratio of labeled anomalies of $\gamma _ { l } = 0 . 0 1$ in the training set. We report avg. AUC with st. dev. computed over 10 seeds. A $" \star "$ indicates a statistically significant $\alpha = 0 . 0 5$ ) difference between $1 ^ { \mathrm { s t } }$ and $2 ^ { \mathrm { n d } }$ .
371
+
372
+ <table><tr><td>Dataset</td><td>OC-SVM Raw</td><td>OC-SVM Hybrid</td><td>Deep SVDD</td><td>SSAD Raw</td><td>SSAD Hybrid</td><td>Supervised Classifier</td><td>Deep SAD</td></tr><tr><td>arrhythmia</td><td>84.5±3.9</td><td>76.7±6.2</td><td>74.6±9.0</td><td>86.7±4.0*</td><td>78.3±5.1</td><td>39.2±9.5</td><td>75.9±8.7</td></tr><tr><td>cardio</td><td>98.5±0.3</td><td>82.8±9.3</td><td>84.8±3.6</td><td>98.8±0.3</td><td>86.3±5.8</td><td>83.2±9.6</td><td>95.0±1.6</td></tr><tr><td>satellite</td><td>95.1±0.2</td><td>68.6±4.8</td><td>79.8±4.1</td><td>96.2±0.3*</td><td>86.9±2.8</td><td>87.2±2.1</td><td>91.5±1.1</td></tr><tr><td>satimage-2</td><td>99.4±0.8</td><td>96.7±2.1</td><td>98.3±1.4</td><td>99.9±0.1</td><td>96.8±2.1</td><td>99.9±0.1</td><td>99.9±0.1</td></tr><tr><td>shuttle</td><td>99.4±0.9</td><td>94.1±9.5</td><td>86.3±7.5</td><td>99.6±0.5</td><td>97.7±1.0</td><td>95.1±8.0</td><td>98.4±0.9</td></tr><tr><td>thyroid</td><td>98.3±0.9</td><td>91.2±4.0</td><td>72.0±9.7</td><td>97.9±1.9</td><td>95.3±3.1</td><td>97.8±2.6</td><td>98.6±0.9</td></tr></table>
373
+
374
+ # C OPTIMIZATION OF DEEP SAD
375
+
376
+ Our Deep SAD objective (7) is generally non-convex in the network weights $\mathcal { W }$ which usually is the case in deep learning. For a computationally efficient optimization, we rely on (mini-batch) SGD to optimize the network weights using backpropagation. For improved generalization, we add $L ^ { 2 }$ weight decay regularization with hyperparameter $\lambda > 0$ to the objective. Algorithm 1 summarizes the Deep SAD optimization routine.
377
+
378
+ # Algorithm 1 Optimization of Deep SAD
379
+
380
+ #
381
+
382
+ Unlabeled data: $\pmb { x } _ { 1 } , \ldots , \pmb { x } _ { n }$
383
+ Labeled data: $( \pmb { x } _ { 1 } ^ { \prime } , \pmb { y } _ { 1 } ^ { \prime } ) , \dots , ( \pmb { x } _ { m } ^ { \prime } , \pmb { y } _ { m } ^ { \prime } )$
384
+ Hyperparameters: $\eta , \lambda$
385
+ SGD learning rate: $\varepsilon$
386
+
387
+ Output: Trained model: $\mathcal { W } ^ { \ast }$
388
+
389
+ 1: Initialize: Neural network weights: $\mathcal { W }$ Hypersphere center: $^ c$
390
+
391
+ 2: for each epoch do
392
+ 3: for each mini-batch do
393
+ 4: Draw mini-batch $\boldsymbol { B }$
394
+ 5: $\mathcal { W } \mathcal { W } - \varepsilon \cdot \nabla \mathcal { w } J ( \mathcal { W } ; \mathcal { B } )$
395
+ 6: end for
396
+ 7: end for
397
+
398
+ Using SGD allows Deep SAD to scale with large datasets as the computational complexity scales linearly in the number of training batches and computations in each batch can be parallelized (e.g., by training on GPUs). Moreover, Deep SAD has low memory complexity as a trained model is fully characterized by the final network parameters $\mathcal { W } ^ { \ast }$ and no data must be saved or referenced for prediction. Instead, the prediction only requires a forward pass on the network which usually is just a concatenation of simple functions. This enables fast predictions for Deep SAD.
399
+
400
+ Initialization of the network weights $\mathcal { W }$ We establish an autoencoder pre-training routine for initialization. That is, we first train an autoencoder that has an encoder with the same architecture as network $\phi$ on the reconstruction loss (mean squared error or cross-entropy). After training, we then initialize $\mathcal { W }$ with the converged parameters of the encoder. Note that this is in line with the Infomax principle (2) for unsupervised representation learning (Vincent et al., 2008).
401
+
402
+ Initialization of the center $^ c$ After initializing the network weights $\mathcal { W }$ , we fix the hypersphere center $^ c$ as the mean of the network representations that we obtain from an initial forward pass on the data (excluding labeled anomalies). We found SGD convergence to be smoother and faster by fixing center $^ c$ in the neighborhood of the initial data representations as also observed by Ruff et al. (2018). If sufficiently many labeled normal examples are available, using only those examples for a mean initialization would be another strategy to minimize possible distortions from polluted unlabeled training data. Adding center $^ c$ as a free optimization variable would allow a trivial “hypersphere collapse” solution for the fully unlabeled setting, i.e. for unsupervised Deep SVDD.
403
+
404
+ Preventing a hypersphere collapse A “hypersphere collapse” describes the trivial solution that neural network $\phi$ converges to the constant function $\phi \equiv c$ , i.e. the hypersphere collapses to a single point. Ruff et al. (2018) demonstrate theoretical network properties that prevent such a collapse which we adopt for Deep SAD. Most importantly, network $\phi$ must have no bias terms and no bounded activation functions. We refer to Ruff et al. (2018) for further details. If there are sufficiently many labeled anomalies available for training, however, hypersphere collapse is not a problem for Deep SAD due to the opposing labeled and unlabeled objectives.
405
+
406
+ # D NETWORK ARCHITECTURES
407
+
408
+ We employ LeNet-type convolutional neural networks (CNNs) on MNIST, Fashion-MNIST, and CIFAR-10, where each convolutional module consists of a convolutional layer followed by leaky ReLU activations with leakiness $\alpha = 0 . 1$ and $( 2 \times 2 )$ -max-pooling. On MNIST, we employ a CNN with two modules, $8 \times ( 5 \times 5 )$ -filters followed by $4 \times ( 5 \times 5 )$ -filters, and a final dense layer of 32 units. On Fashion-MNIST, we employ a CNN also with two modules, $1 6 \times ( 5 \times 5 )$ -filters and $3 2 \times ( 5 \times 5 )$ - filters, followed by two dense layers of 64 and 32 units respectively. On CIFAR-10, we employ a CNN with three modules, $3 2 \times ( 5 \times 5 )$ -filters, $6 4 \times ( 5 \times 5 )$ -filters, and $1 2 8 \times ( 5 \times 5 )$ -filters, followed by a final dense layer of 128 units.
409
+
410
+ On the classic AD benchmark datasets, we employ standard MLP feed-forward architectures. On arrhythmia, a 3-layer MLP with 128-64-32 units. On cardio, satellite, satimage-2, and shuttle a 3-layer MLP with 32-16-8 units. On thyroid a 3-layer MLP with 32-16-4 units.
411
+
412
+ For the (convolutional) autoencoders, we always employ the above architectures for the encoder networks and then construct the decoder networks symmetrically, where we replace max-pooling with simple upsampling and convolutions with deconvolutions.
413
+
414
+ # E DETAILS ON COMPETING METHODS
415
+
416
+ OC-SVM/SVDD The OC-SVM and SVDD are equivalent for the Gaussian/RBF kernel we employ. As mentioned in the main paper, we deliberately grant the OC-SVM/SVDD an unfair advantage by selecting its hyperparameters to maximize AUC on a subset $( 1 0 \% )$ of the test set to establish a strong baseline. To do this, we consider the RBF scale parameter $\gamma \in \{ 2 ^ { - 7 } , 2 ^ { - 6 } , \dots 2 ^ { 2 } \}$ and select the best performing one. Moreover, we always repeat this over $\nu$ -parameter $\nu \in$ $\{ 0 . 0 1 , 0 . 0 5 , 0 . 1 , 0 . 2 , \bar { 0 } . 5 \}$ and then report the best final result.
417
+
418
+ Isolation Forest $\mathbf { \Pi } ^ { ( \mathbf { I I F } ) }$ We set the number of trees to $t = 1 0 0$ and the sub-sampling size to $\psi = 2 5 6$ as recommended in the original work (Liu et al., 2008).
419
+
420
+ Kernel Density Estimator (KDE) We select the bandwidth $h$ of the Gaussian kernel from $h \in$ $\{ 2 ^ { 0 . 5 } , 2 ^ { 1 } , \dots , \bar { 2 } ^ { 5 } \}$ via 5-fold cross-validation using the log-likelihood score following (Ruff et al., 2018).
421
+
422
+ SSAD We also deliberately grant the state-of-the-art semi-supervised AD kernel method SSAD the unfair advantage of selecting its hyperparameters optimally to maximize AUC on a subset $( 1 0 \% )$ of the test set. To do this, we again select the scale parameter $\gamma$ of the RBF kernel we use from $\gamma \in \{ 2 ^ { - 7 } , 2 ^ { - 6 } , \dots 2 ^ { 2 } \}$ and select the best performing one. Otherwise we set the hyperparameters as recommend by the original authors to $\kappa = 1$ , $\kappa = 1$ , $\eta _ { u } = 1$ , and $\eta _ { l } = 1$ (Görnitz et al., 2013).
423
+
424
+ (Convolutional) Autoencoder ((C)AE) To create the (convolutional) autoencoders, we symmetrically construct the decoders w.r.t. the architectures reported in Appenidx D, which make up the encoder parts of the autoencoders. Here, we replace max-pooling with simple upsampling and convolutions with deconvolutions. We train the autoencoders on the MSE reconstruction loss that also serves as the anomaly score.
425
+
426
+ Hybrid Variants To establish hybrid methods, we apply the OC-SVM, IF, KDE, and SSAD as outlined above to the resulting bottleneck representations given by the respective converged autoencoders.
427
+
428
+ Unsupervised Deep SVDD We consider both variants, Soft-Boundary Deep SVDD and One-Class Deep SVDD as unsupervised baselines and always report the better performance as the unsupervised result. For Soft-Boundary Deep SVDD, we optimally solve for the radius $R$ on every mini-batch and run experiments for $\nu \in \{ 0 . 0 1 , 0 . 1 \}$ . We set the weight decay hyperparameter to $\lambda = 1 0 ^ { - 6 }$ . Fo r Deep SVDD, we always remove all the bias terms from a network to prevent a hypersphere collapse as recommended by the authors in the original work (Ruff et al., 2018).
429
+
430
+ Deep SAD We set $\lambda = 1 0 ^ { - 6 }$ and equally weight the unlabeled and labeled examples by setting $\eta = 1$ if not reported otherwise.
431
+
432
+ SS-DGM We consider both the M2 and $\mathbf { M } 1 { + } \mathbf { M } 2$ model and always report the better performing result. Otherwise we follow the settings as recommended in the original work (Kingma et al., 2014).
433
+
434
+ Note that we use the latent class probability estimate (normal vs. anomalous) of semi-supervised DGM as a natural choice for the anomaly score, and not the reconstruction error as used for unsupervised autoencoding models such as the (convolutional) autoencoder we consider. Such deep semi-supervised models designed for classification as the downstream task have no notion of outof-distribution and again implicitly make the cluster assumption (Zhu, 2005; Chapelle et al., 2009) we refer to. Thus, semi-supervised DGM also suffers from overfitting to previously seen anomalies at training similar to the supervised model which explains its bad AD performance.
435
+
436
+ Supervised Deep Binary Classifier To interpret AD as a binary classification problem, we rely on the typical assumption that most of the unlabeled training data is normal by assigning $y = + 1$ to all unlabeled examples. Already labeled normal examples and labeled anomalies retain their assigned labels of $\tilde { y } = + 1$ and $\tilde { y } = - 1$ respectively. We train the supervised classifier on the binary crossentropy loss. Note that in scenario (i), in particular, the supervised classifier has perfect, unpolluted label information but still fails to generalize as there are novel anomaly classes at testing.
437
+
438
+ SGD Optimization Details for Deep Methods We use the Adam optimizer with recommended default hyperparameters (Kingma & Ba, 2015) and apply Batch Normalization (Ioffe & Szegedy, 2015) in SGD optimization. For all deep approaches and on all datasets, we employ a two-phase (“searching” and “fine-tuning”) learning rate schedule. In the searching phase we first train with a learning rate $\varepsilon = 1 0 ^ { - 4 }$ for 50 epochs. In the fine-tuning phase we train with $\varepsilon = 1 0 ^ { - 5 }$ for another 100 epochs. We always use a batch size of 200. For the autoencoder, SS-DGM, and the supervised classifier, we initialize the network with uniform Glorot weights (Glorot & Bengio, 2010). For Deep SVDD and Deep SAD, we establish an unsupervised pre-training routine via autoencoder as explained in Appendix C, where we set the network $\phi$ to be the encoder of the autoencoder that we train beforehand.
439
+
440
+ # F COMPLETE TABLES OF EXPERIMENTAL RESULTS
441
+
442
+ The following Tables 3–6 list the complete experimental results of all the methods in all our experiments.
443
+
444
+ Table 3 : Complete results of experimental scenario (i) , where we increase the ratio of labeled anomalies $\gamma _ { l }$ in the training set. We report the avg. AUC with st. dev. computed over 90 experiments at various ratios $\gamma _ { l }$
445
+
446
+ <table><tr><td rowspan="2">Data</td><td rowspan="2">2</td><td rowspan="2">OC-SVM Raw</td><td rowspan="2">OC-SVM Hybrid</td><td rowspan="2">IF Raw</td><td rowspan="2">IF Hybrid</td><td rowspan="2">KDE Raw</td><td rowspan="2">KDE Hybrid</td><td rowspan="2">CAE</td><td rowspan="2">Deep SVDD</td><td rowspan="2">SSAD</td><td rowspan="2">SSAD Hybrid</td><td rowspan="2">SS-DGM</td><td rowspan="2">Deep SAD</td><td rowspan="2">Supervised Classifier</td></tr><tr><td>Raw</td></tr><tr><td rowspan="6">MNIST</td><td>.00</td><td>96.0±2.9</td><td>96.3±2.5</td><td>85.4±8.7</td><td>90.5±5.3</td><td>95.0±3.3</td><td>87.8±5.6</td><td>92.9±5.7</td><td>92.8±4.9</td><td>96.0±2.9 96.6±2.4</td><td>96.3±2.5 96.8±2.3</td><td></td><td>92.8±4.9</td><td></td></tr><tr><td>.01</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>93.3±3.6</td><td>97.4±2.0</td><td>89.9±9.2 92.2±5.6</td><td>96.4±2.7 96.7±2.4</td><td>92.8±5.5</td></tr><tr><td>.05</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>90.7±4.4</td><td>97.6±1.7</td><td>91.6±5.5</td><td>96.9±2.3</td><td>94.5±4.6</td></tr><tr><td>.10</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>87.2±5.6</td><td>97.8±1.5</td><td>91.2±5.6</td><td>96.9±2.4</td><td>95.0±4.7</td></tr><tr><td>.20</td><td></td><td></td><td></td><td></td><td>92.0±4.9</td><td>69.7±14.4</td><td>90.2±5.8</td><td></td><td></td><td></td><td></td><td></td><td>95.6±4.4</td></tr><tr><td>.00</td><td>92.8±4.7</td><td>91.2±4.7</td><td>91.6±5.5</td><td>82.5±8.1</td><td></td><td></td><td></td><td>89.2±6.2</td><td>92.8±4.7 92.1±5.0</td><td>91.2±4.7 89.4±6.0</td><td>65.1±16.3</td><td>89.2±6.2 90.0±6.4</td><td>74.4±13.6</td></tr><tr><td rowspan="5">CIFAR-10</td><td>.01 .05</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>88.3±6.2</td><td>90.5±5.9</td><td>71.4±12.7</td><td>90.5±6.5</td><td>76.8±13.2</td></tr><tr><td>.10</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>85.5±7.1</td><td>91.0±5.6</td><td>72.9±12.2</td><td>91.3±6.0</td><td>79.0±12.3</td></tr><tr><td>.20</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>82.0±8.0</td><td>89.7±6.6</td><td>74.7±13.5</td><td>91.0±5.5</td><td>81.4±12.0</td></tr><tr><td>.00</td><td>62.0±10.6</td><td>63.8±9.0</td><td>60.0±10.0</td><td>59.9±6.7</td><td>59.9±11.7</td><td>56.1±10.2</td><td>56.2±13.2</td><td>60.9±9.4</td><td>62.0±10.6</td><td>63.8±9.0</td><td></td><td>60.9±9.4</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>73.0±8.0</td><td>70.5±8.3</td><td>49.7±1.7</td><td>72.6±7.4</td><td>55.6±5.0</td></tr><tr><td rowspan="4"></td><td>.01 .05</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>71.5±8.1</td><td>73.3±8.4</td><td>50.8±4.7</td><td>77.9±7.2</td><td>63.5±8.0</td></tr><tr><td>.10</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>70.1±8.1</td><td>74.0±8.1</td><td>52.0±5.5</td><td>79.8±7.1</td><td>67.7±9.6</td></tr><tr><td>.20</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>67.4±8.8</td><td>74.5±8.0</td><td>53.2±6.7</td><td>81.9±7.0</td><td>80.5±5.9</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
447
+
448
+ Table 4 : Complete results of experimental scenario (ii) , where we pollute the unlabeled part of the training set with (unknown) anomalies . We report the avg. AUC with st. dev. computed over 90 experiments at various ratios $\gamma _ { p }$
449
+
450
+ <table><tr><td>Data</td><td>Yp</td><td>OC-SVM Raw</td><td>OC-SVM Hybrid</td><td>IF Raw</td><td>IF Hybrid</td><td>KDE Raw</td><td>KDE Hybrid</td><td>CAE</td><td>Deep SVDD</td><td>SSAD Raw</td><td>SSAD Hybrid</td><td>SS-DGM</td><td>Deep SAD</td><td>Supervised Classifier</td></tr><tr><td>MNIST</td><td>.00 .01</td><td>96.0±2.9</td><td>96.3±2.5</td><td>85.4±8.7</td><td>90.5±5.3</td><td>95.0±3.3</td><td>87.8±5.6</td><td>92.9±5.7</td><td>92.8±4.9</td><td>97.9±1.8</td><td>97.4±2.0</td><td>92.2±5.6</td><td>96.7±2.4</td><td>94.5±4.6</td></tr><tr><td></td><td></td><td>94.3±3.9</td><td>95.6±2.5</td><td>85.2±8.8</td><td>90.6±5.0</td><td>91.2±4.9</td><td>87.9±5.3</td><td>91.3±6.1</td><td>92.1±5.1</td><td>96.6±2.4</td><td>95.2±2.3</td><td>92.0±6.0</td><td>95.5±3.3</td><td>91.5±5.9</td></tr><tr><td>.05</td><td></td><td>91.4±5.2</td><td>93.8±3.9</td><td>83.9±9.2</td><td>89.7±6.0</td><td>85.5±7.1</td><td>87.3±7.0</td><td>87.2±7.1</td><td>89.4±5.8</td><td>93.4±3.4</td><td>89.5±3.9</td><td>91.0±6.9</td><td>93.5±4.1</td><td>86.7±7.4</td></tr><tr><td></td><td>.10</td><td>88.8±6.0</td><td>91.4±5.1</td><td>82.3±9.5</td><td>88.2±6.5</td><td>82.1±8.5</td><td>85.9±6.6</td><td>83.7±8.4</td><td>86.5±6.8</td><td>90.7±4.4</td><td>86.0±4.6</td><td>89.7±7.5</td><td>91.2±4.9</td><td>83.6±8.2</td></tr><tr><td></td><td>.20</td><td>84.1±7.6</td><td>85.9±7.6</td><td>78.7±10.5</td><td>85.3±7.9</td><td>77.4±10.9</td><td>82.6±8.6</td><td>78.6±10.3</td><td>81.5±8.4</td><td>87.4±5.6</td><td>82.1±5.4</td><td>87.4±8.6</td><td>86.6±6.6</td><td>79.7±9.4</td></tr><tr><td>F-MNIST</td><td>.00</td><td>92.8±4.7</td><td>91.2±4.7</td><td>91.6±5.5</td><td>82.5±8.1</td><td>92.0±4.9</td><td>69.7±14.4</td><td>90.2±5.8</td><td>89.2±6.2</td><td>94.0±4.4</td><td>90.5±5.9</td><td>71.4±12.7</td><td>90.5±6.5</td><td>76.8±13.2</td></tr><tr><td></td><td></td><td>91.7±5.0</td><td>91.5±4.6</td><td>91.5±5.5</td><td>84.9±7.2</td><td>89.4±6.3</td><td>73.9±12.4</td><td>87.1±7.3</td><td>86.3±6.3</td><td>92.2±4.9</td><td>87.8±6.1</td><td>71.2±14.3</td><td>87.2±7.1</td><td>67.3±8.1</td></tr><tr><td></td><td>.01 .05</td><td>90.7±5.5</td><td>90.7±4.9</td><td>90.9±5.9</td><td>85.5±7.2</td><td>85.2±9.1</td><td>75.4±12.9</td><td>81.6±9.6</td><td>80.6±7.1</td><td>88.3±6.2</td><td>82.7±7.8</td><td>71.9±14.3</td><td>81.5±8.5</td><td>59.8±4.6</td></tr><tr><td></td><td>.10</td><td>89.5±6.1</td><td>89.3±6.2</td><td>90.2±6.3</td><td>85.5±7.7</td><td>81.8±11.2</td><td>77.8±12.0</td><td>77.4±11.1</td><td>76.2±7.3</td><td>85.6±7.0</td><td>79.8±9.0</td><td>72.5±15.5</td><td>78.2±9.1</td><td>56.7±4.1</td></tr><tr><td></td><td>.20</td><td>86.3±7.7</td><td>88.1±6.9</td><td>88.4±7.6</td><td>86.3±7.4</td><td>77.4±13.6</td><td>82.1±9.8</td><td>72.5±12.6</td><td>69.3±6.3</td><td>81.9±8.1</td><td>74.3±10.6</td><td>70.8±16.0</td><td>74.8±9.4</td><td>53.9±2.9</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>CIFAR-10</td><td>.00</td><td>62.0±10.6</td><td>63.8±9.0</td><td>60.0±10.0</td><td>59.9±6.7</td><td>59.9±11.7</td><td>56.1±10.2</td><td>56.2±13.2</td><td>60.9±9.4</td><td>73.8±7.6</td><td>73.3±8.4</td><td>50.8±4.7</td><td>77.9±7.2</td><td>63.5±8.0</td></tr><tr><td></td><td>.01</td><td>61.9±10.6</td><td>63.8±9.3</td><td>59.9±10.1</td><td>59.9±6.7</td><td>59.2±12.3</td><td>56.3±10.4</td><td>56.2±13.1</td><td>60.5±9.4</td><td>73.0±8.0</td><td>72.8±8.1</td><td>51.1±4.7</td><td>76.5±7.2</td><td>62.9±7.3</td></tr><tr><td></td><td>.05</td><td>61.4±10.7</td><td>62.6±9.2</td><td>59.6±10.1</td><td>59.6±6.4</td><td>58.1±12.9</td><td>55.6±10.5</td><td>55.7±13.3</td><td>59.6±9.8</td><td>71.5±8.2</td><td>71.0±8.4</td><td>50.1±2.9</td><td>74.0±6.9</td><td>62.2±8.2</td></tr><tr><td></td><td>.10</td><td>60.8±10.7</td><td>62.9±8.2</td><td>58.8±10.1</td><td>59.1±6.6</td><td>57.3±13.5</td><td>54.9±11.1</td><td>55.4±13.3</td><td>58.6±10.0</td><td>69.8±8.4</td><td>69.3±8.5</td><td>50.5±3.6</td><td>71.8±7.0</td><td>60.6±8.3</td></tr><tr><td></td><td>.20</td><td>60.3±10.3</td><td>61.9±8.1</td><td>57.9±10.1</td><td>58.3±6.2</td><td>56.2±13.9</td><td>54.2±11.1</td><td>54.6±13.3</td><td>57.0±10.6</td><td>67.8±8.6</td><td>67.9±8.1</td><td>50.1±1.7</td><td>68.5±7.1</td><td>58.5±6.7</td></tr></table>
451
+
452
+ Table 5 : Complete results of experimental scenario (iii) , where we increase the number of anomaly classes $k _ { l }$ included in the labeled training data. We report the avg. AUC with st. dev. computed over 1OO experiments at various numbers $k _ { l }$
453
+
454
+ <table><tr><td>Data</td><td>k</td><td>OC-SVM Raw</td><td>OC-SVM Hybrid</td><td>IF Raw</td><td>IF Hybrid</td><td>KDE KDE Raw Hybrid</td><td>CAE</td><td></td><td>Deep SVDD</td><td>SSAD Raw</td><td>SSAD Hybrid</td><td>SS-DGM</td><td>Deep SAD</td><td>Supervised Classifier</td></tr><tr><td>MNIST</td><td>0 1 2</td><td>88.8±6.0</td><td>91.4±5.1</td><td>82.3±9.5</td><td>88.2±6.5</td><td>82.1±8.5</td><td>85.9±6.6</td><td>83.7±8.4</td><td>86.5±6.8</td><td>88.8±6.0 90.7±4.4 92.5±3.6 93.9±3.3</td><td>91.4±5.1 86.0±4.6 87.7±3.8 89.8±3.3</td><td>89.7±7.5 92.8±5.3 94.9±4.2</td><td>86.5±6.8 91.2±4.9 92.0±3.6 94.7±2.8</td><td>83.6±8.2 90.3±4.6 93.9±2.8</td></tr><tr><td>F-MNIST</td><td>3 0 1 2 3</td><td>89.5±6.1</td><td>89.3±6.2</td><td>90.2±6.3</td><td>85.5±7.7</td><td>81.8±11.2</td><td>77.8±12.0</td><td>77.4±11.1</td><td>76.2±7.3</td><td>95.5±2.5 89.5±6.1 85.6±7.0 87.8±6.1 89.4±5.5</td><td>91.9±3.0 89.3±6.2 79.8±9.0 80.1±10.5 83.8±9.4 86.8±7.7</td><td>96.7±2.3 72.5±15.5 74.3±15.4 77.5±14.7 79.9±13.8</td><td>97.3±1.8 76.2±7.3 78.2±9.1 80.5±8.2 83.9±7.4</td><td>96.9±1.7 56.7±4.1 62.3±2.9 67.3±3.0</td></tr><tr><td>CIFAR-10</td><td>5 0 1 2 3</td><td>60.8±10.7</td><td>62.9±8.2</td><td>58.8±10.1</td><td>59.1±6.6</td><td>57.3±13.5</td><td>54.9±11.1</td><td>55.4±13.3</td><td>58.6±10.0</td><td>60.8±10.7 69.8±8.4 73.0±7.1 73.8±6.6 75.1±5.5</td><td>62.9±8.2 69.3±8.5 72.3±7.5 73.3±7.0 74.2±6.5</td><td>50.5±3.6 50.3±2.4 50.0±0.7 50.0±1.0</td><td>58.6±10.0 71.8±7.0 75.2±6.4 77.5±5.9 80.4±4.6</td><td>60.6±8.3 61.0±6.6 62.7±6.8 60.9±4.6</td></tr></table>
455
+
456
+ Table 6 : Complete results on classic AD benchmark datasets in the setting with no pollution $\gamma _ { p } = 0$ and a ratio of labeled anomalies of $\gamma _ { l } = 0 . 0 1$ in the training set. We report the avg. AUC with st. dev. computed over 10 seeds.
457
+
458
+ <table><tr><td></td><td>OC-SVM</td><td>OC-SVM</td><td></td><td>Deep</td><td>SSAD</td><td>SSAD</td><td></td><td>Deep</td><td>Supervised</td></tr><tr><td>Data</td><td>Raw</td><td>Hybrid</td><td>CAE</td><td>SVDD</td><td>Raw</td><td>Hybrid</td><td>SS-DGM</td><td>SAD</td><td>Classifier</td></tr><tr><td>arrhythmia</td><td>84.5±3.9</td><td>76.7±6.2</td><td>74.0±7.5</td><td>74.6±9.0</td><td>86.7±4.0</td><td>78.3±5.1</td><td>50.3±9.8</td><td>75.9±8.7</td><td>39.2±9.5</td></tr><tr><td>cardio</td><td>98.5±0.3</td><td>82.8±9.3</td><td>94.3±2.0</td><td>84.8±3.6</td><td>98.8±0.3</td><td>86.3±5.8</td><td>66.2±14.3</td><td>95.0±1.6</td><td>83.2±9.6</td></tr><tr><td>satellite</td><td>95.1±0.2</td><td>68.6±4.8</td><td>80.0±1.7</td><td>79.8±4.1</td><td>96.2±0.3</td><td>86.9±2.8</td><td>57.4±6.4</td><td>91.5±1.1</td><td>87.2±2.1</td></tr><tr><td>satimage-2</td><td>99.4±0.8</td><td>96.7±2.1</td><td>99.9±0.0</td><td>98.3±1.4</td><td>99.9±0.1</td><td>96.8±2.1</td><td>99.2±0.6</td><td>99.9±0.1</td><td>99.9±0.1</td></tr><tr><td>shuttle</td><td>99.4±0.9</td><td>94.1±9.5</td><td>98.2±1.2</td><td>86.3±7.5</td><td>99.6±0.5</td><td>97.7±1.0</td><td>97.9±0.3</td><td>98.4±0.9</td><td>95.1±8.0</td></tr><tr><td>thyroid</td><td>98.3±0.9</td><td>91.2±4.0</td><td>75.2±10.2</td><td>72.0±9.7</td><td>97.9±1.9</td><td>95.3±3.1</td><td>72.7±12.0</td><td>98.6±0.9</td><td>97.8±2.6</td></tr></table>
md/train/HyGh4sR9YQ/HyGh4sR9YQ.md ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DEEP NEUROEVOLUTION: GENETIC ALGORITHMS ARE A COMPETITIVE ALTERNATIVE FOR TRAINING DEEP NEURAL NETWORKS FOR REINFORCEMENT LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Deep artificial neural networks (DNNs) are typically trained via gradient-based learning algorithms, namely backpropagation. Evolution strategies (ES) can rival backprop-based algorithms such as Q-learning and policy gradients on challenging deep reinforcement learning (RL) problems. However, ES can be considered a gradient-based algorithm because it performs stochastic gradient descent via an operation similar to a finite-difference approximation of the gradient. That raises the question of whether non-gradient-based evolutionary algorithms can work at DNN scales. Here we demonstrate they can: we evolve the weights of a DNN with a simple, gradient-free, population-based genetic algorithm (GA) and it performs well on hard deep RL problems, including Atari and humanoid locomotion. The Deep GA successfully evolves networks with over four million free parameters, the largest neural networks ever evolved with a traditional evolutionary algorithm. These results (1) expand our sense of the scale at which GAs can operate, (2) suggest intriguingly that in some cases following the gradient is not the best choice for optimizing performance, and (3) make immediately available the multitude of neuroevolution techniques that improve performance. We demonstrate the latter by showing that combining DNNs with novelty search, which encourages exploration on tasks with deceptive or sparse reward functions, can solve a high-dimensional problem on which reward-maximizing algorithms (e.g. DQN, A3C, ES, and the GA) fail. Additionally, the Deep GA is faster than ES, A3C, and DQN (it can train Atari in ${ \sim } 4$ hours on one workstation or ${ \sim } 1$ hour distributed on 720 cores), and enables a state-of-the-art, up to 10,000-fold compact encoding technique.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ A recent trend in machine learning and AI research is that old algorithms work remarkably well when combined with sufficient computing resources and data. That has been the story for (1) backpropagation applied to deep neural networks in supervised learning tasks such as computer vision Krizhevsky et al. (2012) and voice recognition Seide et al. (2011), (2) backpropagation for deep neural networks combined with traditional reinforcement learning algorithms, such as Q-learning Watkins and Dayan (1992); Mnih et al. (2015) or policy gradient (PG) methods Sehnke et al. (2010); Mnih et al. (2016), and (3) evolution strategies (ES) applied to reinforcement learning benchmarks Salimans et al. (2017). One common theme is that all of these methods are gradient-based, including ES, which involves a gradient approximation similar to finite differences Williams (1992); Wierstra et al. (2008); Salimans et al. (2017). This historical trend raises the question of whether a similar story will play out for gradient-free methods, such as population-based GAs.
12
+
13
+ This paper investigates that question by testing the performance of a simple GA on hard deep reinforcement learning (RL) benchmarks, including Atari 2600 Bellemare et al. (2013); Brockman et al. (2016); Mnih et al. (2015) and Humanoid Locomotion in the MuJoCo simulator Todorov et al. (2012); Schulman et al. (2015; 2017); Brockman et al. (2016). We compare the performance of the GA with that of contemporary algorithms applied to deep RL (i.e. DQN Mnih et al. (2015), a
14
+
15
+ Q-learning method, A3C Mnih et al. (2016), a policy gradient method, and ES). One might expect GAs to perform far worse than other methods because they are so simple and do not follow gradients. Surprisingly, we found that GAs turn out to be a competitive algorithm for RL – performing better on some domains and worse on others, and roughly as well overall as A3C, DQN, and ES – adding a new family of algorithms to the toolbox for deep RL problems. We also validate the effectiveness of learning with GAs by comparing their performance to that of random search (RS). While the GA always outperforms random search, interestingly we discovered that in some Atari games random search outperforms powerful deep RL algorithms (DQN on 3/13 games, A3C on 6/13, and ES on 3/13), suggesting that local optima, saddle points, noisy gradient estimates, or other factors are impeding progress on these problems for gradient-based methods. Although deep neural networks often do not struggle with local optima in supervised learning Pascanu et al. (2014), local optima remain an issue in RL because the reward signal may deceptively encourage the agent to perform actions that prevent it from discovering the globally optimal behavior.
16
+
17
+ Like ES and the deep RL algorithms, the GA has unique benefits. GAs prove slightly faster than ES (discussed below). The GA and ES are thus both substantially faster in wall-clock speed than Q-learning and policy gradient methods. We explore two distinct GA implementations: (1) a singlemachine version with GPUs and CPUs, and (2) a distributed version on many CPUs across many machines. On a single modern workstation with 4 GPUs and 48 CPU cores, the GA can train Atari in ${ \sim } 4$ hours. Training to comparable performance takes ${ \sim } 7 { - } 1 0$ days for DQN and ${ \sim } 4$ days for A3C. This speedup enables individual researchers with single (albeit expensive) workstations to start using domains formerly reserved for well-funded labs only and iterate perhaps more rapidly than with any other RL algorithm. Given substantial distributed computation (here, 720 CPU cores across dozens of machines), the GA and ES can train Atari in ${ \sim } 1$ hour. Also beneficial, via a new technique we introduce, even multi-million-parameter networks trained by GAs can be encoded with very few (thousands of) bytes, yielding the state-of-the-art compact encoding method.
18
+
19
+ Overall, the unexpectedly competitive performance of the GA (and random search) suggests that the structure of the search space in some of these domains is not amenable to gradient-based search. That realization opens up new research directions on when/how to exploit the regions where a gradientfree search might be more appropriate and motivates research into new kinds of hybrid algorithms.
20
+
21
+ # 2 BACKGROUND
22
+
23
+ At a high level, an RL problem challenges an agent to maximize some notion of cumulative reward (e.g. total, or discounted) without supervision as to how to accomplish that goal Sutton and Barto (1998). A host of traditional RL algorithms perform well on small, tabular state spaces Sutton and Barto (1998). However, scaling to high-dimensional problems (e.g. learning to act directly from pixels) was challenging until RL algorithms harnessed the representational power of deep neural networks (DNNs), thus catalyzing the field of deep reinforcement learning (deep RL) Mnih et al. (2015). Three broad families of deep learning algorithms have shown promise on RL problems so far: Q-learning methods such as DQN Mnih et al. (2015), policy gradient methods Sehnke et al. (2010) (e.g. A3C Mnih et al. (2016), TRPO Schulman et al. (2015), PPO Schulman et al. (2017)), and more recently evolution strategies (ES) Salimans et al. (2017).
24
+
25
+ Deep Q-learning algorithms approximate the optimal Q function with DNNs, yielding policies that, for a given state, choose the action with the maximum Q-value Watkins and Dayan (1992); Mnih et al. (2015); Hessel et al. (2017). Policy gradient methods directly learn the parameters of a DNN policy that outputs the probability of taking each action in each state. A team from OpenAI recently experimented with a simplified version of Natural Evolution Strategies Wierstra et al. (2008), specifically one that learns the mean of a distribution of parameters, but not its variance. They found that this algorithm, which we will refer to simply as evolution strategies (ES), is competitive with DQN and A3C on difficult RL benchmark problems, with much faster training times (i.e. faster wall-clock time when many CPUs are available) due to better parallelization Salimans et al. (2017).
26
+
27
+ All of these methods can be considered gradient-based methods, as they all calculate or approximate gradients in a DNN and optimize those parameters via stochastic gradient descent/ascent (though they do not require differentiating through the reward function, e.g. a simulator). DQN calculates the gradient of the loss of the DNN Q-value function approximator via backpropagation. Policy gradients sample behaviors stochastically from the current policy and then reinforce those that perform well via stochastic gradient ascent. ES does not calculate gradients analytically, but approximates the gradient of the reward function in the parameter space Salimans et al. (2017); Wierstra et al. (2008).
28
+
29
+ Here we test whether a truly gradient-free method, a GA, can perform well on challenging deep RL tasks. We find GAs perform surprisingly well and thus can be considered a new addition to the set of algorithms for deep RL problems.
30
+
31
+ # 3 METHODS
32
+
33
+ # 3.1 GENETIC ALGORITHM
34
+
35
+ We purposefully test with an extremely simple GA to set a baseline for how well evolutionary algorithms work for RL problems. We expect future work to reveal that adding the legion of enhancements that exist for GAs Fogel and Stayton (1994); Haupt and Haupt (2004); Clune et al. (2011); Mouret and Doncieux (2009); Lehman and Stanley (2011a); Stanley et al. (2009); Mouret and Clune (2015) will improve their performance on deep RL tasks.
36
+
37
+ A genetic algorithm Holland (1992); Eiben et al. (2003) evolves a population $\mathcal { P }$ of $N$ individuals (here, neural network parameter vectors $\theta$ , often called genotypes). At every generation, each $\theta _ { i }$ is evaluated, producing a fitness score (aka reward) $F ( \theta _ { i } )$ . Our GA variant performs truncation selection, wherein the top $T$ individuals become the parents of the next generation. To produce the next generation, the following process is repeated $N - 1$ times: A parent is selected uniformly at random with replacement and is mutated by applying additive Gaussian noise to the parameter vector: $\theta ^ { \prime } = \theta + \bar { \sigma } \epsilon$ where $\epsilon \sim \mathcal { N } ( 0 , I )$ . The appropriate value of $\sigma$ was determined empirically for each experiment, as described in Supplementary Information (SI) Table 2. The $N ^ { \mathrm { t h } }$ individual is an unmodified copy of the best individual from the previous generation, a technique called elitism. To more reliably try to select the true elite in the presence of noisy evaluation, we evaluate each of the top 10 individuals per generation on 30 additional episodes (counting these frames as ones consumed during training); the one with the highest mean score is the designated elite. Historically, GAs often involve crossover (i.e. combining parameters from multiple parents to produce an offspring), but for simplicity we did not include it. The new population is then evaluated and the process repeats for $G$ generations or until some other stopping criterion is met. SI Algorithm 1 provides pseudocode for our version.
38
+
39
+ Open source code and hyperparameter configurations for all of our experiments are available: anonymous. Hyperparameters are also listed in SI Table 2. Hyperparameters were fixed for all Atari games, chosen from a set of 36 hyperparameters tested on six games (Asterix, Enduro, Gravitar, Kangaroo, Seaquest, Venture).
40
+
41
+ GA implementations traditionally store each individual as a parameter vector $\theta$ , but this approach scales poorly in memory and network transmission costs with large populations and large (deeper and wider) neural networks. We propose a novel method to store large parameter vectors compactly by representing each parameter vector as an initialization seed plus the list of random seeds that produced each of the mutations that led to each $\theta$ . This information is sufficient to reconstruct each $\theta$ . This innovation was critical for an efficient implementation of a distributed deep GA. SI Fig. 1 shows, and Eq. 1 describes, the method.
42
+
43
+ $$
44
+ \theta ^ { n } = \psi ( \theta ^ { n - 1 } , \tau _ { n } ) = \theta ^ { n - 1 } + \sigma \varepsilon ( \tau _ { n } )
45
+ $$
46
+
47
+ where $\theta ^ { n }$ is an offspring of $\theta ^ { n - 1 }$ , $\psi ( \theta ^ { n - 1 } , \tau _ { n } )$ is a deterministic mutation function, $\tau$ is a vector of mutation seeds that encodes $\theta ^ { n }$ , $\theta ^ { 0 } = \phi ( \tau _ { 0 } )$ , where $\phi$ is a deterministic initialization function, and $\varepsilon ( \tau _ { n } ) \sim \mathcal { N } ( 0 , I )$ is a deterministic Gaussian pseudo-random number generator with an input seed $\tau _ { n }$ that produces a vector of length $| \theta |$ . In our case, $\varepsilon ( \tau _ { n } )$ is a large precomputed table that is indexed by 28-bit seeds. SI Sec. 7.3 provides more details, including how the seeds could be smaller.
48
+
49
+ This technique is advantageous because the size of the compressed representation increases linearly with the number of generations (often order thousands), and is independent of the size of the network (often order millions or more). It does, of course, require computation to reconstruct the DNN weight vector. Competitive Atari-playing agents evolve in as little as tens of generations, enabling a compressed representation of a $^ { 4 \mathbf { M } + }$ parameter neural network in just thousands of bytes (a 10,000- fold compression). The compression rate depends on the number of generations, but in practice is always substantial: all Atari final networks were compressible 8,000-50,000-fold. This represents the state of the art in encoding large networks compactly. However, it is not a general network compression technique because it cannot compress arbitrary networks, and instead only works for networks evolved with a GA.
50
+
51
+ One motivation for choosing ES versus Q-learning and policy gradient methods is its faster wallclock time with distributed computation, owing to better parallelization Salimans et al. (2017). We found that the distributed CPU-only Deep GA not only preserves this benefit, but slightly improves upon it (SI Sec. 7.1 describes why GAs–distributed or local–are faster than ES). Importantly, GAs can also use GPUs to speed up the forward pass of DNNs (especially large ones), making it possible to train on a single workstation. With our GPU-enabled implementation, on one modern workstation we can train Atari in ${ \sim } 4$ hours what takes ${ \sim } 1$ hour with 720 distributed cores. Distributed GPU training would further speed up training for large population sizes.
52
+
53
+ # 3.2 NOVELTY SEARCH
54
+
55
+ One benefit of training deep neural networks with GAs is it enables us to immediately take advantage of algorithms previously developed in the neuroevolution community. As a demonstration, we experiment with novelty search (NS) Lehman and Stanley (2011b), which was designed for deceptive domains in which reward-based optimization mechanisms converge to local optima. NS avoids these local optima by ignoring the reward function during evolution and instead rewarding agents for performing behaviors that have never been performed before (i.e. that are novel). Surprisingly, it can often outperform algorithms that utilize the reward signal, a result demonstrated on maze navigation and simulated biped locomotion tasks Lehman and Stanley (2011b). Here we apply NS to see how it performs when combined with DNNs on a deceptive image-based RL problem (that we call the Image Hard Maze). We refer to the GA that optimizes for novelty as GA-NS.
56
+
57
+ NS requires a behavior characteristic (BC) that describes the behavior of a policy $B C ( \pi )$ and a behavioral distance function between the BCs of any two policies: $\mathrm { l i s t } ( B C ( \pi _ { i } ) , B C ( \pi _ { j } ) )$ , both of which are domain-specific. After each generation, members of the population have a probability $p$ (here, 0.01) of having their BC stored in an archive. The novelty of a policy is defined as the average distance to the $k$ (here, 25) nearest neighbors (sorted by behavioral distance) in the population or archive. Novel individuals are thus determined based on their behavioral distance to current or previously seen individuals. The GA otherwise proceeds as normal, substituting novelty for fitness (reward). For reporting and plotting purposes only, we identify the individual with the highest reward per generation. The algorithm is presented in SI Algorithm 2.
58
+
59
+ # 4 EXPERIMENTS
60
+
61
+ Our experiments focus on the performance of the GA on the same challenging problems that have validated the effectiveness of state-of-the-art deep RL algorithms and ES Salimans et al. (2017). They include learning to play Atari directly from pixels Mnih et al. (2015); Schulman et al. (2017); Mnih et al. (2016); Bellemare et al. (2013) and a continuous control problem involving a simulated humanoid robot learning to walk Brockman et al. (2016); Schulman et al. (2017); Salimans et al. (2017); Todorov et al. (2012). We also tested on an Atari-scale maze domain that has a clear local optimum (Image Hard Maze) to study how well these algorithms avoid deception Lehman and Stanley (2011b).
62
+
63
+ For Atari and Image Hard Maze experiments, we record the best agent found in each of multiple, independent, randomly initialized GA runs: 5 for Atari, 10 for the Image Hard Maze. Because Atari is stochastic, the final score for each run takes the highest-scoring elite across generations, and reports the mean score it achieves on 200 independent evaluations. The final score for the domain is then the median of final run scores. Humanoid Locomotion details are in SI. Sec 7.6.
64
+
65
+ # 4.1 ATARI
66
+
67
+ Training deep neural networks to play Atari – mapping directly from pixels to actions – was a celebrated feat that arguably launched the deep RL era and expanded our understanding of the difficulty of RL domains that machine learning could tackle Mnih et al. (2015). Here we test how the performance of DNNs evolved by a simple GA compare to DNNs trained by the major families of deep RL algorithms and ES. We model our experiments on those from the ES paper by Salimans et al. (2017) because it inspired our study. Due to limited computational resources, our initial and main study compares results on 13 Atari games. Some were chosen because they are games on which ES performs well (Frostbite, Gravitar, Kangaroo, Venture, Zaxxon) or poorly (Amidar, Enduro, Skiing, Seaquest) and the remaining games were chosen from the ALE Bellemare et al. (2013) set in alphabetical order (Assault, Asterix, Asteroids, Atlantis). We later expanded our study to the full set of 57 Atari games from recent milestone papers Hessel et al. (2017); Horgan et al. (2018) and our conclusions were qualitatively unchanged (SI Sec. 7.8). To facilitate comparisons with results reported in Salimans et al. (2017), we keep the number of game frames agents experience over the course of a GA run constant (at one billion frames). The frame limit results in a differing number of generations per independent GA run (SI Sec. Table 3), as policies of different quality in different runs may see more frames in some games (e.g. if the agent lives longer).
68
+
69
+ During training, each agent is evaluated on a full episode (capped at 20k frames), which can include multiple lives, and fitness is the sum of episode rewards, i.e. the final Atari game score. The following are identical to DQN Mnih et al. (2015): (1) data preprocessing, (2) network architecture, and (3) the stochastic environment that starts each episode with up to 30 random, initial no-op operations. We use the larger DQN architecture from Mnih et al. (2015) consisting of 3 convolutional layers with 32, 64, and 64 channels followed by a hidden layer with 512 units. The convolutional layers use $8 \times 8$ , $4 \times 4$ , and $3 \times 3$ filters with strides of 4, 2, and 1, respectively. All hidden layers were followed by a rectifier nonlinearity (ReLU). The network contains over 4M parameters; interestingly, many in the past assumed that a simple GA would fail at such scales. All results are from our single-machine CPU $^ +$ GPU GA implementation.
70
+
71
+ Fair comparisons between algorithms is difficult, as evaluation procedures are non-uniform and algorithms realize different trade-offs between computation, wall-clock speed, and sample efficiency. Another consideration is whether agents are evaluated on random starts (a random number of no-op actions), which is the regime they are trained on, or on starts randomly sampled from human play, which tests for generalization Nair et al. (2015). Because we do not have a database of human starts to sample from, our agents are evaluated with random starts. Where possible, we compare our results to those for other algorithms on random starts. That is true for DQN and ES, but not for A3C, where we had to include results on human starts.
72
+
73
+ We also attempt to control for the number of frames seen during training, but because DQN is far slower to run, we present results from the literature that train on fewer frames (200M, which requires 7-10 days of computation vs. hours of computation needed for ES and the GA to train on 1B frames). There are many variants of DQN that we could compare to, including the Rainbow Hessel et al. (2017) algorithm that combines many different recent improvements to DQN Van Hasselt et al. (2016); Wang et al. (2015); Schaul et al. (2015); Sutton and Barto (1998); Bellemare et al. (2017); Fortunato et al. (2017). However, we choose to compare the GA to the original, vanilla DQN algorithm, partly because we also introduce a vanilla GA, without the many modifications and improvements that have been previously developed Haupt and Haupt (2004).
74
+
75
+ In what will likely be a surprise to many, the simple GA is able to train deep neural networks to play many Atari games roughly as well as DQN, A3C, and ES (Table 1). Among the first set of 13 games we tried, DQN, ES and the GA produced the best score on 3 games, while A3C produced the best score on 4. On Skiing, the GA produced a score higher than any other algorithm published to date. On some games, the GA performance advantage over DQN, A3C, and ES is considerable (e.g. Frostbite, Venture, Skiing). Videos of policies evolved by the GA can be viewed here: anonymous. In a head-to-head comparisons, the GA performs better than ES, A3C, and DQN on 6 games each out of 13 (Tables 1 & 6).
76
+
77
+ The GA also performs worse on many games, continuing a theme in deep RL where different families of algorithms perform differently across different domains Salimans et al. (2017). However, all such comparisons are preliminary because more computational resources are needed to gather sufficient sample sizes to see if the algorithms are significantly different per game; instead the key takeaway is that they all tend to perform roughly similarly in that each does well on different games.
78
+
79
+ Because performance did not plateau in the GA runs, we test whether the GA improves further given additional computation. We thus run the GA six times longer (6B frames) and in all games, its score
80
+
81
+ <table><tr><td></td><td>DQN</td><td>ES</td><td>A3C</td><td>RS 1B</td><td>GA 1B</td><td>GA 6B</td></tr><tr><td>Frames Time</td><td>200M ~7-10d</td><td>1B ~1h</td><td>1B ~4d</td><td>~ 1h or 4h</td><td>~ 1h or 4h</td><td>~ 6h or 24h</td></tr><tr><td>Forward Passes</td><td>450M</td><td>250M</td><td>250M</td><td>250M</td><td>250M</td><td>1.5B</td></tr><tr><td>Backward Passes</td><td>400M</td><td>0</td><td>250M</td><td>0</td><td>0</td><td>0</td></tr><tr><td>Operations</td><td>1.25B U</td><td>250MU</td><td>1B U</td><td>250MU</td><td>250MU</td><td>1.5B U</td></tr><tr><td>amidar</td><td>978</td><td>112</td><td>264</td><td>143</td><td>263</td><td>377</td></tr><tr><td>assault</td><td>4,280</td><td>1,674</td><td>5,475</td><td>649</td><td>714</td><td>814</td></tr><tr><td>asterix</td><td>4,359</td><td>1,440</td><td>22,140</td><td>1,197</td><td>1,850</td><td>2,255</td></tr><tr><td>asteroids</td><td>1,365</td><td>1,562</td><td>4,475</td><td>1,307</td><td>1,661</td><td>2,700</td></tr><tr><td>atlantis</td><td>279,987</td><td>1,267,410</td><td>911,091</td><td>26,371</td><td>76,273</td><td>129,167</td></tr><tr><td>enduro</td><td>729</td><td>95</td><td>-82</td><td>36</td><td>60</td><td>80</td></tr><tr><td>frostbite</td><td>797</td><td>370</td><td>191</td><td>1,164</td><td>4,536</td><td>6,220</td></tr><tr><td>gravitar</td><td>473</td><td>805</td><td>304</td><td>431</td><td>476</td><td>764</td></tr><tr><td>kangaroo</td><td>7,259</td><td>11,200</td><td>94</td><td>1,099</td><td>3,790</td><td>11,254</td></tr><tr><td>seaquest</td><td>5,861</td><td>1,390</td><td>2,355</td><td>503</td><td>798</td><td>850</td></tr><tr><td>skiing</td><td>-13,062</td><td>-15,443</td><td>-10,911</td><td>-7,679</td><td>-6,502</td><td>-5,541</td></tr><tr><td>venture</td><td>163</td><td>760</td><td>23</td><td>488</td><td>969</td><td>1,422</td></tr><tr><td>zaxxon</td><td>5,363</td><td>6,380</td><td>24,622</td><td>2,538</td><td>6,180</td><td>7,864</td></tr></table>
82
+
83
+ Table 1: On Atari a simple genetic algorithm is competitive with Q-learning (DQN), policy gradients (A3C), and evolution strategies (ES). Shown are game scores (higher is better). Comparing performance between algorithms is inherently challenging (see main text), but we attempt to facilitate comparisons by showing estimates for the amount of computation (operations, the sum of forward and backward neural network passes), data efficiency (the number of game frames from training episodes), and how long in wall-clock time the algorithm takes to run. The ES, DQN, A3C, and GA (1B) perform best on 3, 3, 4, and 3 games, respectively. Thus, overall, each algorithm is best on a different subset of games, and all are in that sense competitive alternatives. The GA produced state-of-the-art results on Skiing. In a much larger set of games, these results qualitatively hold and, surprisingly, the GA can sometimes even outperform highly-sophisticated algorithms produced after years of intense research into improving DQN, such as Rainbow and Ape-X (SI Sec. 7.8). Interestingly, random search often finds policies superior to those of DQN, A3C, and ES (see text for discussion). Note the dramatic differences in the speeds of the algorithm, which are much faster for the GA and ES, and data efficiency, which favors DQN. The scores for DQN are from Hessel et al. (2017) while those for A3C and ES are from Salimans et al. (2017). For A3C, DQN, and ES, we cannot provide error bars because they were not reported in the original literature; GA and random search error bars are visualized in (SI Fig. 2). The wall-clock times are approximate because they depend on a variety of hard-to-control-for factors. We found the GA runs slightly faster than ES on average. GA 6B scores are bolded if best, but do not prevent bolding in other columns.
84
+
85
+ improves (Table 1). With these post-6B-frame scores, the GA outperforms A3C, ES, and DQN on 7, 8, 7 of the 13 games in head-to-head comparisons, respectively (SI Table 6). In most games, the GA’s performance still has not converged at 6B frames (SI Fig. 2), leaving open the question of to how well the GA will ultimately perform when run even longer. To our knowledge, this $^ { 4 \mathbf { M } + }$ parameter neural network is the largest neural network ever evolved with a simple GA.
86
+
87
+ In the expanded game set, all of the results described above qualitatively hold. On some games the GA also outperforms Rainbow Hessel et al. (2017) and Ape-X Horgan et al. (2018), two recent, powerful DQN enhancements produced after years of research by a large community into improving DQN (SI Sec. 7.8). The GA yields state-of the-art results on 6 games, including both sparse- and dense-reward games.
88
+
89
+ One remarkable fact is how quickly the GA finds high-performing individuals. Because we employ a large population size (1K), each run lasts relatively few generations (min 348, max 1,834, SI Table 3). In many games, the GA finds a solution better than DQN in only one or tens of generations! Specifically, the median GA performance is higher than the final DQN performance in 1, 1, 3, 5, 11, and 29 generations for Skiing, Venture, Frostbite, Asteroids, Gravitar, and Zaxxon, respectively. Similar results hold for ES, where 1, 2, 3, 7, 12, and 25 GA generations were needed to outperform
90
+
91
+ ES on Skiing, Frostbite, Amidar, Asterix, Asteroids, and Venture, respectively. The number of generations required to beat A3C were 1, 1, 1, 1, 1, 2, and 52 for Enduro, Frostbite, Kangaroo, Skiing, Venture, Gravitar, and Amidar, respectively.
92
+
93
+ Each generation, the GA tends to make small-magnitude changes (controlled by $\sigma$ ) to the parameter vector (see Methods). That the GA outperforms DQN, A3C, and ES in so few generations – especially when it does so in the first generation (which is before a round of selection) – suggests that many high-quality policies exist near the origin (to be precise, in or near the region in which the random initialization function generates policies). That raises the question: is the GA doing anything more than random search?
94
+
95
+ To answer this question, we evaluate many policies randomly generated by the GA’s initialization function $\phi$ and report the best score. We gave random search approximately the same amount of frames and computation as the GA and compared their performance (Table 1). In every game, the GA outperformed random search, and did so significantly on 9/13 games (Fig. 2, $p < 0 . 0 5$ , this and all future $p$ values are via a Wilcoxon rank-sum test). The improved performance suggests the GA is performing healthy optimization over generations.
96
+
97
+ Surprisingly, given how celebrated and impressive DQN, ES and A3C are, out of 13 games random search actually outperforms DQN on 3 (Frostbite, Skiing, & Venture), ES on 3 (Amidar, Frostbite, & Skiing), and A3C on 6 (Enduro, Frostbite, Gravitar, Kangaroo, Skiing, & Venture). Interestingly, some of these policies produced by random search are not trivial, degenerate policies. Instead, they appear quite sophisticated. Consider the following example from the game Frostbite, which requires an agent to perform a long sequence of jumps up and down rows of icebergs moving in different directions (while avoiding enemies and optionally collecting food) to build an igloo brick by brick (SI Fig. 3). Only after the igloo is built can the agent enter the igloo to receive a large payoff. Over its first two lives, a policy found by random search completes a series of 17 actions, jumping down 4 rows of icebergs moving in different directions (while avoiding enemies) and back up again three times to construct an igloo. Then, only once the igloo is built, the agent immediately moves towards it and enters it, at which point it gets a large reward. It then repeats the entire process on a harder level, this time also gathering food and thus earning bonus points (video: anonymous). That policy resulted in a very high score of 3,620 in less than 1 hour of random search, vs. an average score of 797 produced by DQN after 7-10 days of optimization. One may think that random search found a lucky open loop sequence of actions overfit to that particular stochastic environment. Remarkably, we found that this policy actually generalizes to other initial conditions too, achieving a median score of 3,170 (with $9 5 \%$ bootstrapped median confidence intervals of $2 , 5 8 0 \AA - 3 , 1 7 0 )$ on 200 different test environments (each with up to 30 random initial no-ops, a standard testing procedure Hessel et al. (2017); Mnih et al. (2015)).
98
+
99
+ These examples and the success of RS versus DQN, A3C, and ES suggest that many Atari games that seem hard based on the low performance of leading deep RL algorithms may not be as hard as we think, and instead that these algorithms for some reason are performing poorly on tasks that are actually quite easy. These results further suggest that sometimes the best search strategy is not to follow the gradient, but instead to conduct a dense search in a local neighborhood and select the best point found, a subject we return to in the discussion (Sec. 5).
100
+
101
+ # 4.2 IMAGE HARD MAZE
102
+
103
+ We also conducted an experiment to demonstrate a benefit of GAs working at DNN scales, which is that algorithms that were developed to improve GAs can be immediately taken off the shelf to improve DNN training. The example algorithm we chose is novelty search (NS), a popular evolutionary method for RL exploration Lehman and Stanley (2011b). We found that the GA plus NS can solve a high-dimensional robot control problem on which reward-maximizing algorithms (e.g. DQN, A3C, ES, and the GA) fail (SI Sec. 7.5).
104
+
105
+ # 4.3 HUMANOID LOCOMOTION
106
+
107
+ The GA was also able to solve the challenging continuous control benchmark of Humanoid Locomotion Brockman et al. (2016), which has validated modern, powerful algorithms such as A3C, TRPO, and ES. While the GA did produce robots that could walk well, it took ${ \sim } 1 5$ times longer to
108
+
109
+ perform slightly worse than ES (SI Sec. 7.6), which is surprising because GAs have previously performed well on robot locomotion tasks Clune et al. (2011); Huizinga et al. (2016). Future research is required to understand why.
110
+
111
+ # 5 DISCUSSION
112
+
113
+ The surprising success of the GA and RS in domains thought to require at least some degree of gradient estimation suggests some heretofore under-appreciated aspects of high-dimensional search spaces. They imply that densely sampling in a region around the origin is sufficient in some cases to find far better solutions than those found by state-of-the-art, gradient-based methods even with far more computation or wall-clock time, suggesting that gradients do not point to these solutions, or that other optimization issues interfere with finding them, such as saddle points or noisy gradient estimates. The GA results further suggest that sampling in the region around good solutions is often sufficient to find even better solutions, and that a sequence of such discoveries is possible in many challenging domains. That result in turn implies that the distribution of solutions of increasing quality is unexpectedly dense, and that you do not need to follow a gradient to find them.
114
+
115
+ Another, non-mutually exclusive hypothesis, is that GAs (and ES) have improved performance due to temporally extended exploration Osband et al. (2016), meaning they explore consistently because all actions in an episode are a function of the same set of mutated parameters, which improves exploration Plappert et al. (2017). This helps exploration for two reasons: (1) an agent takes the same action (or has the same distribution over actions) each time it visits the same state, which makes it easier to learn whether the policy in that state is advantageous, and (2) the agent is also more likely to have correlated actions across states (e.g. always go up) because mutations to its internal representations can affect the actions taken in many states similarly.
116
+
117
+ Perhaps more interesting is the result that sometimes it is actually worse to follow the gradient than sample locally in the parameter space for better solutions. This scenario probably does not hold in all domains, or even in all the regions of a domain where it sometimes holds, but that it holds at all expands our conceptual understanding of the viability of different kinds of search operators. A reason GA might outperform gradient-based methods is if local optima are present, as it can jump over them in the parameter space, whereas a gradient method cannot (without additional optimization tricks such as momentum, although we note that ES utilized the modern ADAM optimizer in these experiments Kingma and Ba (2014), which includes momentum). One unknown question is whether GA-style local, gradient-free search is better early on in the search process, but switching to a gradient-based search later allows further progress that would be impossible, or prohibitively computationally expensive, for a GA to make. Another unknown question is the promise of simultaneously hybridizing GA methods with modern algorithms for deep RL, such as Q-learning, policy gradients, or evolution strategies.
118
+
119
+ We still know very little about the ultimate promise of GAs versus competing algorithms for training deep neural networks on reinforcement learning problems. Additionally, here we used an extremely simple GA, but many techniques have been invented to improve GA performance Eiben et al. (2003); Haupt and Haupt (2004), including crossover Holland (1992); Deb and Myburgh (2016), indirect encoding Stanley (2007); Stanley et al. (2009); Clune et al. (2011), and encouraging quality diversity Mouret and Clune (2015); Pugh et al. (2016), just to name a few. Moreover, many techniques have been invented that dramatically improve the training of DNNs with backpropagation, such as residual networks He et al. (2015), SELU or RELU activation functions Krizhevsky et al. (2012); Klambauer et al. (2017), LSTMs or GRUs Hochreiter and Schmidhuber (1997); Cho et al. (2014), regularization Hoerl and Kennard (1970), dropout Srivastava et al. (2014), and annealing learning rate schedules Robbins and Monro (1951). We hypothesize that many of these techniques will also improve neuroevolution for large DNNs.
120
+
121
+ Some of these enhancements may improve the GA performance on Humanoid Locomotion. For example, indirect encoding, which allows genomic parameters to affect multiple weights in the final neural network (in a way similar to convolution’s tied weights, but with far more flexibility), has been shown to dramatically improve performance and data efficiency when evolving robot gaits Clune et al. (2011). Those results were found with the HyperNEAT algorithm Stanley et al. (2009), which has an indirect encoding that abstracts the power of developmental biology Stanley (2007), and is a particularly promising direction for Humanoid Locomotion and Atari we are investigating.
122
+
123
+ It will further be interesting to learn on which domains Deep GA tends to perform well or poorly and understand why. Also, GAs could help in other non-differentiable domains, such as architecture search Liu et al. (2017); Miikkulainen et al. (2017) and for training limited precision (e.g. binary) neural networks.
124
+
125
+ # 6 CONCLUSION
126
+
127
+ Our work introduces a Deep GA that competitively trains deep neural networks for challenging RL tasks, and an encoding technique that enables efficient distributed training and a state-of-the-art compact network encoding. We found that the GA is fast, enabling training Atari in ${ \sim } 4 \mathrm { h }$ on a single workstation or ${ \sim } 1 \mathrm { h }$ distributed on 720 CPUs. We documented that GAs are surprisingly competitive with popular algorithms for deep reinforcement learning problems, such as DQN, A3C, and ES, especially in the challenging Atari domain. We also showed that interesting algorithms developed in the neuroevolution community can now immediately be tested with deep neural networks, by showing that a Deep GA-powered novelty search can solve a deceptive Atari-scale game. It will be interesting to see future research investigate the potential and limits of GAs, especially when combined with other techniques known to improve GA performance. More generally, our results continue the story – started by backprop and extended with ES – that old, simple algorithms plus modern amounts of computation can perform amazingly well. That raises the question of what other classic algorithms should be revisited.
128
+
129
+ # REFERENCES
130
+
131
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In NIPS, pages 1097–1105, 2012.
132
+ Frank Seide, Gang Li, and Dong Yu. Conversational speech transcription using context-dependent deep neural networks. In Interspeech 2011. International Speech Communication Association, August 2011.
133
+ Christopher JCH Watkins and Peter Dayan. Q-learning. Machine learning, 8(3-4):279–292, 1992.
134
+ 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.
135
+ Frank Sehnke, Christian Osendorfer, Thomas Ruckstieß, Alex Graves, Jan Peters, and J ¨ urgen ¨ Schmidhuber. Parameter-exploring policy gradients. Neural Networks, 23(4):551–559, 2010.
136
+ Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In ICML, pages 1928–1937, 2016.
137
+ Tim Salimans, Jonathan Ho, Xi Chen, and Ilya Sutskever. Evolution strategies as a scalable alternative to reinforcement learning. arXiv preprint arXiv:1703.03864, 2017.
138
+ Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
139
+ Daan Wierstra, Tom Schaul, Jan Peters, and Juergen Schmidhuber. Natural evolution strategies. In Evolutionary Computation, 2008. CEC 2008.(IEEE World Congress on Computational Intelligence). IEEE Congress on, pages 3381–3387. IEEE, 2008.
140
+ Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. J. Artif. Intell. Res.(JAIR), 47:253–279, 2013.
141
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. OpenAI gym, 2016.
142
+ 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, pages 5026–5033. IEEE, 2012.
143
+ John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In ICML, pages 1889–1897, 2015.
144
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
145
+ Razvan Pascanu, Yann N Dauphin, Surya Ganguli, and Yoshua Bengio. On the saddle point problem for non-convex optimization. arXiv preprint arXiv:1405.4604, 2014.
146
+ Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction, volume 1. MIT press Cambridge, 1998.
147
+ 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.
148
+ David B Fogel and Lauren C Stayton. On the effectiveness of crossover in simulated evolutionary optimization. BioSystems, 32(3):171–182, 1994.
149
+ Randy L Haupt and Sue Ellen Haupt. Practical genetic algorithms. John Wiley & Sons, 2004.
150
+ Jeff Clune, Kenneth O. Stanley, Robert T. Pennock, and Charles Ofria. On the performance of indirect encoding across the continuum of regularity. IEEE Transactions on Evolutionary Computation, 2011.
151
+ Jean-Baptiste Mouret and Stephane Doncieux. Overcoming the bootstrap problem in evolutionary robotics using behavioral diversity. In Proceedings of the IEEE Congress on Evolutionary Computation (CEC-2009), pages 1161–1168. IEEE, 2009.
152
+ Joel Lehman and Kenneth O. Stanley. Evolving a diversity of virtual creatures through novelty search and local competition. In GECCO, pages 211–218, Dublin, Ireland, 12-16 July 2011a. ACM. ISBN 978-1-4503-0557-0. doi: 10.1145/2001576.2001606.
153
+ Kenneth O. Stanley, David B. D’Ambrosio, and Jason Gauci. A hypercube-based indirect encoding for evolving large-scale neural networks. Artificial Life, 15(2):185–212, 2009.
154
+ Jean-Baptiste Mouret and Jeff Clune. Illuminating search spaces by mapping elites. ArXiv e-prints, abs/1504.04909, 2015. URL anonymous.
155
+ John H Holland. Genetic algorithms. Scientific american, 267(1):66–73, 1992.
156
+ Agoston E Eiben, James E Smith, et al. Introduction to evolutionary computing, volume 53. Springer, 2003.
157
+ Joel Lehman and Kenneth O. Stanley. Abandoning objectives: Evolution through the search for novelty alone. Evolutionary Computation, 19(2):189–223, 2011b.
158
+ Dan Horgan, John Quan, David Budden, Gabriel Barth-Maron, Matteo Hessel, Hado van Hasselt, and David Silver. Distributed prioritized experience replay. arXiv preprint arXiv:1803.00933, 2018.
159
+ Arun Nair, Praveen Srinivasan, Sam Blackwell, Cagdas Alcicek, Rory Fearon, Alessandro De Maria, Vedavyas Panneershelvam, Mustafa Suleyman, Charles Beattie, Stig Petersen, et al. Massively parallel methods for deep reinforcement learning. arXiv preprint arXiv:1507.04296, 2015.
160
+ Hado Van Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double qlearning. In AAAI, pages 2094–2100, 2016.
161
+ Ziyu Wang, Tom Schaul, Matteo Hessel, Hado Van Hasselt, Marc Lanctot, and Nando De Freitas. Dueling network architectures for deep reinforcement learning. arXiv preprint arXiv:1511.06581, 2015.
162
+ Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. Prioritized experience replay. arXiv preprint arXiv:1511.05952, 2015.
163
+ Marc G Bellemare, Will Dabney, and Remi Munos. A distributional perspective on reinforcement ´ learning. arXiv preprint arXiv:1707.06887, 2017.
164
+ Meire Fortunato, Mohammad Gheshlaghi Azar, Bilal Piot, Jacob Menick, Ian Osband, Alex Graves, Vlad Mnih, Remi Munos, Demis Hassabis, Olivier Pietquin, et al. Noisy networks for exploration. arXiv preprint arXiv:1706.10295, 2017.
165
+ Joost Huizinga, Jean-Baptiste Mouret, and Jeff Clune. Does aligning phenotypic and genotypic modularity improve the evolution of neural networks? In GECCO, pages 125–132. ACM, 2016.
166
+ Ian Osband, Charles Blundell, Alexander Pritzel, and Benjamin Van Roy. Deep exploration via bootstrapped dqn. In NIPS, pages 4026–4034, 2016.
167
+ Matthias Plappert, Rein Houthooft, Prafulla Dhariwal, Szymon Sidor, Richard Y Chen, Xi Chen, Tamim Asfour, Pieter Abbeel, and Marcin Andrychowicz. Parameter space noise for exploration. arXiv preprint arXiv:1706.01905, 2017.
168
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
169
+ Kalyanmoy Deb and Christie Myburgh. Breaking the billion-variable barrier in real-world optimization using a customized evolutionary algorithm. In GECCO, pages 653–660. ACM, 2016.
170
+ Kenneth O. Stanley. Compositional pattern producing networks: A novel abstraction of development. Genetic Programming and Evolvable Machines Special Issue on Developmental Systems, 8(2):131–162, 2007.
171
+ Justin K Pugh, Lisa B. Soros, and Kenneth O. Stanley. Quality diversity: A new frontier for evolutionary computation. 3(40), 2016. ISSN 2296-9144. URL anonymous.
172
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. arXiv preprint arXiv:1512.03385, 2015.
173
+ Gunter Klambauer, Thomas Unterthiner, Andreas Mayr, and Sepp Hochreiter. Self-normalizing ¨ neural networks. arXiv preprint arXiv:1706.02515, 2017.
174
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
175
+ Kyunghyun Cho, Bart Van Merrienboer, Dzmitry Bahdanau, and Yoshua Bengio. On the properties ¨ of neural machine translation: Encoder-decoder approaches. arXiv preprint arXiv:1409.1259, 2014.
176
+ Arthur E Hoerl and Robert W Kennard. Ridge regression: Biased estimation for nonorthogonal problems. Technometrics, 12(1):55–67, 1970.
177
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. The Journal of Machine Learning Research, 15(1):1929–1958, 2014.
178
+ Herbert Robbins and Sutton Monro. A stochastic approximation method. The annals of mathematical statistics, pages 400–407, 1951.
179
+ Hanxiao Liu, Karen Simonyan, Oriol Vinyals, Chrisantha Fernando, and Koray Kavukcuoglu. Hierarchical representations for efficient architecture search. arXiv preprint arXiv:1711.00436, 2017.
180
+ Risto Miikkulainen, Jason Liang, Elliot Meyerson, Aditya Rawal, Dan Fink, Olivier Francon, Bala Raju, Arshak Navruzyan, Nigel Duffy, and Babak Hodjat. Evolving deep neural networks. arXiv preprint arXiv:1703.00548, 2017.
181
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In NIPS, pages 2234–2242, 2016.
182
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. ICML, pages 448–456. JMLR.org, 2015.
183
+ Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In ICAI, pages 249–256, 2010.
184
+ Joel Lehman, Jay Chen, Jeff Clune, and Kenneth O. Stanley. ES is more than just a traditional finite-difference approximator. arXiv preprint arXiv:1712.06568, 2017.
185
+ Edoardo Conti, Vashisht Madhavan, Felipe Petroski Such, Joel Lehman, Kenneth O. Stanley, and Jeff Clune. Improving exploration in evolution strategies for deep reinforcement learning via a population of novelty-seeking agents. arXiv preprint arXiv:1712.06560, 2017.
186
+ 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 NIPS, pages 5285–5294, 2017.
187
+ A. Cully, J. Clune, D. Tarapore, and J.-B. Mouret. Robots that can adapt like animals. Nature, 521: 503–507, 2015. doi: 10.1038/nature14422.
188
+ T. Salimans, J. Ho, X. Chen, S. Sidor, and I. Sutskever. Evolution Strategies as a Scalable Alternative to Reinforcement Learning. ArXiv e-prints, 1703.03864, March 2017.
189
+
190
+ # 7 SUPPLEMENTARY INFORMATION
191
+
192
+ # 7.1 WHY THE GA IS FASTER THAN ES
193
+
194
+ The GA is faster than ES for two main reasons: (1) for every generation, ES must calculate how to update its neural network parameter vector $\theta$ . It does so via a weighted average across many (10,000 in Salimans et al. (2017)) pseudo-offspring (random $\theta$ perturbations) weighted by their fitness. This averaging operation is slow for large neural networks and large numbers of pseudooffspring (the latter is required for healthy optimization), and is not required for the Deep GA. (2) ES requires virtual batch normalization to generate diverse policies amongst the pseudo-offspring, which is necessary for accurate finite difference approximation Salimans et al. (2016). Virtual batch normalization requires additional forward passes for a reference batch–a random set of observations chosen at the start of training–to compute layer normalization statistics that are then used in the same manner as batch normalization Ioffe and Szegedy (2015). We found that the random GA parameter perturbations generate sufficiently diverse policies without virtual batch normalization and thus avoid these additional forward passes through the network.
195
+
196
+ # Algorithm 1 Simple Genetic Algorithm
197
+
198
+ <table><tr><td>Input: mutation function , population size N, number of selected individuals T, policy initial- ization routineΦ, fitness function F. for g=1, 2...,G generations do fori= 1,..,N-1 in next generation&#x27;s population do if g=1 then Pg=1 = (N(0,I)) {initialize random DNN} else k =uniformRandom(1,T) {select parent} P = ψ(Pg-1) {mutate parent}</td></tr></table>
199
+
200
+ # 7.2 HYPERPARAMETERS
201
+
202
+ We use Xavier initialization Glorot and Bengio (2010) as our policy initialization function $\phi$ where all bias weights are set to zero, and connection weights are drawn from a standard normal distribution with variance $1 / N _ { i n }$ , where $N _ { i n }$ is the number of incoming connections to a neuron.
203
+
204
+ # 7.3 ADDITIONAL INFORMATION ABOUT THE DEEP GA COMPACT ENCODING METHOD
205
+
206
+ The compact encoding technique is based on the principle that the seeds need only be long enough to generate a unique mutation vector per offspring per parent. If any given parent $\theta ^ { n - 1 }$ produces at most $x$ offspring, then $\tau _ { n }$ in Eq. 1 can be as small as a $l o g _ { 2 } ( x )$ -bit number. $\tau _ { 0 }$ is a special case that needs one unique seed for each of the $\textit { N } \theta$ vectors in generation 0, and can thus be encoded with $l o g _ { 2 } ( N )$ bits. The reason the seed bit-length can be vastly smaller than the search space size is because not every point in the search space is a possible offspring of $\theta ^ { n }$ , and we only need to be able generate offspring randomly (we do not need to be able to reach any point in the search space
207
+
208
+ # Algorithm 2 Novelty Search (GA-NS)
209
+
210
+ Input: mutation function $\psi$ , population size $N$ , number of selected individuals $T$ , policy initialization routine $\phi$ , empty archive $\mathcal { A }$ , archive insertion probability $p$ , a novelty function $\eta$ , a behavior characteristic function $B C$ .
211
+
212
+ for $g = 1 , 2 . . . , G$ generations do for $i = 2 , . . . , N$ in next generation’s population do if $g = 1$ then $\mathcal { P } _ { i } ^ { g = 1 } = \phi ( \mathcal { N } ( 0 , I ) )$ {initialize random DNN} else $k =$ uniformRandom $( 1 , T )$ {select parent} $\mathcal { P } _ { i } ^ { g } = \psi ( \mathcal { P } _ { k } ^ { g - 1 } )$ {mutate parent} end if $B C _ { i } ^ { g } = B C ( \mathcal { P } _ { i } ^ { g } )$ end for Copy $\mathcal { P } _ { 1 } ^ { g } \mathcal { P } _ { 1 } ^ { g - 1 }$ ; $B C _ { 1 } ^ { g } B C _ { 1 } ^ { g - 1 }$ for $i = 1 , . . . , N$ in next generation’s population do Evaluate $F _ { i } = \eta ( B C _ { i } ^ { \check { g } } , ( A \cup B C ^ { \hat { g } } ) \overset { \cdot } { - } \{ B C _ { i } ^ { g } \} )$ if $i > 1$ then Add $B C _ { i } ^ { g }$ to $\mathcal { A }$ with probability $p$ end if end for Sort $\mathcal { P } _ { i } ^ { g }$ with descending order by $F _ { i }$
213
+ end for
214
+ Return: Elite
215
+
216
+ <table><tr><td>Hyperparameter</td><td>Humanoid Locomotion</td><td>Image Hard Maze</td><td>Atari</td></tr><tr><td>Population Size (N)</td><td>12,500+1</td><td>20,000+1</td><td>1,000+1</td></tr><tr><td>Mutation Power (σ)</td><td>0.00224</td><td>0.005</td><td>0.002</td></tr><tr><td>Truncation Size (T)</td><td>625</td><td>61</td><td>20</td></tr><tr><td>Numberof Trials</td><td>5</td><td>1</td><td>1</td></tr><tr><td>Archive Probability</td><td></td><td>0.01</td><td></td></tr></table>
217
+
218
+ Table 2: Hyperparameters. Population sizes are incremented to account for elites $( + 1 )$ . Many of the unusual numbers were found via preliminary hyperparameter searches in other domains.
219
+
220
+ in one random step). However, because we perform $n$ random mutations to produce $\theta ^ { n }$ , the process can reach many points in the search space.
221
+
222
+ However, to truly be able to reach every point in the search space we need our set of mutation vectors to span the search space, meaning we need the seed to be at least $l o g _ { 2 } ( | \theta | )$ bits. To do so we can use a function $\mathcal { H } ( \theta , \tau )$ that maps a given $( \theta , \tau _ { n } )$ -pair to a new seed and applies it as such:
223
+
224
+ $$
225
+ \psi ( \theta ^ { n - 1 } , \tau _ { n } ) = \theta ^ { n - 1 } + \varepsilon ( \mathcal { H } ( \theta ^ { n - 1 } , \tau _ { n } ) )
226
+ $$
227
+
228
+ Note that in this case there are two notions of seeds. The encoding is a series of small $\tau$ seeds, but each new seed $\tau$ is generated from the parent $\theta$ and the previous seed.
229
+
230
+ # 7.4 ADDITIONAL EXPERIMENTAL DETAILS FOR THE IMAGE HARD MAZE
231
+
232
+ For temporal context, the current frame and previous three frames are all input at each timestep, following Mnih et al. (2015). The outputs remain the same as in the original Hard Maze problem formulation in Lehman and Stanley (2011b). Unlike the Atari domain, the Image Hard Maze environment is deterministic and does not need multiple evaluations of the same policy.
233
+
234
+ Following Lehman and Stanley (2011b), the BC is the $( x , y )$ position of the robot at the end of the episode (400 timesteps), and the behavioral distance function is the squared Euclidean distance between these final $( x , y )$ positions. The simulator ignores forward or backward motion that would result in the robot penetrating walls, preventing a robot from sliding along a wall, although rotational motor commands still have their usual effect in such situations.
235
+
236
+ Table 3: The number of generations at which the GA reached 6B frames.
237
+
238
+ <table><tr><td>Game</td><td>Minimum Generations</td><td>Median Generations</td><td>Maximum Generations</td></tr><tr><td>amidar</td><td>1325</td><td>1364</td><td>1541</td></tr><tr><td>assault</td><td>501</td><td>707</td><td>1056</td></tr><tr><td>asterix</td><td>494</td><td>522</td><td>667</td></tr><tr><td>asteroids</td><td>1096</td><td>1209</td><td>1261</td></tr><tr><td>atlantis</td><td>507</td><td>560</td><td>580</td></tr><tr><td>enduro</td><td>348</td><td>348</td><td>348</td></tr><tr><td>frostbite</td><td>889</td><td>1016</td><td>1154</td></tr><tr><td>gravitar</td><td>1706</td><td>1755</td><td>1834</td></tr><tr><td>kangaroo</td><td>688</td><td>787</td><td>862</td></tr><tr><td>seaquest</td><td>660</td><td>678</td><td>714</td></tr><tr><td>skiing</td><td>933</td><td>1237</td><td>1281</td></tr><tr><td>venture</td><td>527</td><td>606</td><td>680</td></tr><tr><td>zaxxon</td><td>765</td><td>810</td><td>823</td></tr></table>
239
+
240
+ ![](images/a56d95e0275e5c1b47fdd67edb3b345a940983fb21d02c733d99249be35790ff.jpg)
241
+ Figure 1: Visual representation of the Deep GA encoding method. From a randomly initialized parameter vector $\theta ^ { 0 ^ { \circ } }$ (produced by an initialization function $\phi$ seeded by $\tau _ { 0 }$ ), the mutation function $\psi$ (seeded by $\tau _ { 1 }$ ) applies a mutation that results in $\theta ^ { 1 }$ . The final parameter vector $\theta ^ { g }$ is the result of a series of such mutations. Recreating $\theta ^ { g }$ can be done by applying the mutation steps in the same order. Thus, knowing the series of seeds $\tau _ { 0 } . . . \tau _ { g }$ that produced this series of mutations is enough information to reconstruct $\theta ^ { g }$ (the initialization and mutation functions are deterministic). Since each $\tau$ is small (here, 28 bits long), and the number of generations is low (order hundreds or thousands), a large neural network parameter vector can be stored compactly.
242
+
243
+ # 7.5 IMAGE HARD MAZE
244
+
245
+ This experiment seeks to demonstrate a benefit of GAs working at DNN scales, which is that algorithms that were developed to improve GAs can be immediately taken off the shelf to improve DNN training. The example algorithm is novelty search (NS), which is a popular evolutionary method for exploration in RL Lehman and Stanley (2011b).
246
+
247
+ NS was originally motivated by the Hard Maze domain Lehman and Stanley (2011b), which is a staple in the neuroevolution community. It demonstrates the problem of local optima (aka deception) in reinforcement learning. In it, a robot receives more reward the closer it gets to the goal as the crow flies. The problem is deceptive because greedily getting closer to the goal leads an agent to permanently get stuck in one of the map’s deceptive traps (Fig. 5, Left). Optimization algorithms that do not conduct sufficient exploration suffer this fate. NS solves this problem because it ignores the reward and encourages agents to visit new places Lehman and Stanley (2011b).
248
+
249
+ ![](images/dbbbc8bd3317c2d600134b8d9fbcd0b843f20e36b4c8d8b85777f2a839b39bd4.jpg)
250
+ Figure 2: GA and random search performance across generations on Atari 2600 games. The performance of the GA and random search compared to DQN, A3C, and ES depends on the game. We plot final scores (as dashed lines) for DQN, A3C, and ES because we do not have their performance values across training and because they trained on different numbers of game frames (SI Table 1). For GA and RS, we report the median and $9 5 \%$ bootstrapped confidence intervals of the median across 5 experiments of the current elite per run, where the score for each elite is a mean of 30 independent episodes.
251
+
252
+ The original version of this problem involves only a few inputs (radar sensors to sense walls) and two continuous outputs for speed (forward or backward) and rotation, making it solvable by small neural networks (tens of connections). Because here we want to demonstrate the benefits of NS at the scale of deep neural networks, we introduce a new version of the domain called Image Hard Maze. Like many Atari games, it shows a bird’s-eye view of the world to the agent in the form of an $8 4 \times 8 4$ pixel image (Fig. 5, Left). This change makes the problem easier in some ways (e.g. now it is fully observable), but harder in others because it is much higher-dimensional: the neural network must learn to process this pixel input and take actions. SI Sec. 7.4 has additional experimental details.
253
+
254
+ We confirm that the results that held for small neural networks on the original, radar-based version of this task also hold for the high-dimensional, visual version of this task with deep neural networks. With a $^ { 4 \mathbf { M } + }$ parameter network processing pixels, the GA-based novelty search (GA-NS) is able to solve the task by finding the goal (Fig. 5). The GA optimizes for reward only and, as expected, gets stuck in the local optima of Trap 2 (SI Fig. 4) and thus fails to solve the problem (Fig. 5), significantly underperforming GA-NS $( p \ < 0 . 0 0 1 )$ . Our results confirm that we are able to use exploration methods such as novelty search to solve this sort of deception, even in high-dimensional problems such as those involving learning directly from pixels. This is the largest neural network optimized by novelty search to date by three orders of magnitude. In a paper published concurrently with ours, Conti et al. (2017) demonstrate a similar finding, by hybridizing novelty search with ES to create NS-ES, and show that it too can help deep neural networks avoid deception in challenging RL benchmark domains.
255
+
256
+ ![](images/72ceb5e75affe0ceed3ce26d7760a85ab830a29d14c13709e8104189146d346f.jpg)
257
+ Figure 3: Example of high-performing individual on Frostbite found through random search. See main text for a description of the behavior of this policy. Its final score is 3,620 in this episode, which is far higher than the scores produced by DQN, A3C and ES, although not as high as the score found by the GA (Table 1).
258
+
259
+ As expected, ES also fails to solve the task because it focuses solely on maximizing reward (Fig. 5 & SI Fig. 4). We also test Q-learning (DQN) and policy gradients on this problem. We did not have source code for A3C, but were able to obtain source code for A2C, which has similar performance Wu et al. (2017): the only difference is that it is synchronous instead of asynchronous. For these experiments we modified the rewards of the domain to step-by-step rewards (the negative change in distance to goal since the last time-step), but for plotting purposes, we record the final distance to the goal. Having per-step rewards is standard for these algorithms and provides more information, but does not remove the deception. Because DQN requires discrete outputs, for it we discretize each of the two continuous outputs into to five equally sized bins. To enable all possible output combinations, it learns $5 ^ { 2 } = 2 5$ Q-values.
260
+
261
+ Also as expected, DQN and A2C fail to solve this problem (Fig. 5, SI Fig. 4). Their default exploration mechanisms are not enough to find the global optimum given the deceptive reward function in this domain. DQN is drawn into the expected Trap 2. For unclear reasons, even though A2C visits Trap 2 often early in training, it converges on getting stuck in a different part of the maze. Of course, exploration techniques could be added to these controls to potentially make them perform as well as GA-NS. Here we only sought to show that the Deep GA allows algorithms developed for small-scale neural networks can be harnessed on hard, high-dimensional problems that require DNNs.
262
+
263
+ In future work, it will be interesting to combine NS with a Deep GA on more domains, including Atari and robotics domains. More importantly, our demonstration suggests that other algorithms that enhance GAs can now be combined with DNNs. Perhaps most promising are those that combine a notion of diversity (e.g. novelty) and quality (i.e. being high performing), seeking to collect a set of high-performing, yet interestingly different policies Mouret and Clune (2015); Lehman and Stanley (2011a); Cully et al. (2015); Pugh et al. (2016). The results also motivate future research into combining deep RL algorithms (e.g. DQN, A3C) with novelty search and quality diversity algorithms.
264
+
265
+ # 7.6 HUMANOID LOCOMOTION
266
+
267
+ We tested the GA on a challenging continuous control problem, specifically humanoid locomotion. We test with the MuJoCo Humanoid-v1 environment in OpenAI Gym Todorov et al. (2012); Brockman et al. (2016), which involves a simulated humanoid robot learning to walk. Solving this problem has validated modern, powerful algorithms such as A3C Mnih et al. (2016), TRPO Schulman et al. (2015), and ES Salimans et al. (2017).
268
+
269
+ This problem involves mapping a vector of 376 scalars that describe the state of the humanoid (e.g. its position, velocity, angle) to 17 joint torques. The robot receives a scalar reward that is a combination of four components each timestep. It gets positive reward for standing and its velocity in the positive $x$ direction, and negative reward the more energy it expends and for how hard it impacts the ground. These four terms are summed over every timestep in an episode to calculate the total reward.
270
+
271
+ To stabilize training, we normalize each dimension of the input by subtracting its mean and dividing by its standard deviation, which are computed from executing 10,000 random policies in the environment. We also applied annealing to the mutation power $\sigma$ , decreasing it to 0.001 after 1,000 generations, which resulted in a small performance boost at the end of training. The full set of hyperparameters are listed in SI Table 2.
272
+
273
+ For these experiments we ran 5 independent, randomly initialized, runs and report the median of those runs. During the elite selection routine we did not reevaluate offspring 30 times like on the Atari experiments. That is because we ran these experiments before the Atari experiments, and we improved our evaluation methods after these experiments were completed. We did not have the computational resources to re-run these experiments with the changed protocol, but we do not believe this change would qualitatively alter our results. We also used the normalized columns initialization routine of Salimans et al. (2017) instead of Xavier initialization, but we found them to perform qualitatively similarly. When determining the fitness of each agent we evaluate the mean over 5 independent episodes. After each generation, for plotting purposes only, we evaluate the elite 30 times.
274
+
275
+ The architecture has two 256-unit hidden layers with tanh activation functions. This architecture is the one in the configuration file included in the source code released by Salimans et al. (2017). The architecture described in their paper is similar, but smaller, having 64 neurons per layer Salimans et al. (2017). Although relatively shallow by deep learning standards, and much smaller than the Atari DNNs, this architecture still contains ${ \sim } 1 6 7 \mathrm { k }$ parameters, which is orders of magnitude greater than the largest neural networks evolved for robotics tasks that we are aware of, which contained 1,560 Huizinga et al. (2016) and before that 800 parameters Clune et al. (2011). Many assumed evolution would fail at larger scales (e.g. networks with hundreds of thousands or millions of weights, as in this paper).
276
+
277
+ Previous work has called the Humanoid-v1 problem solved with a score of ${ \sim } 6 { , } 0 0 0$ Salimans et al. (2017). The GA achieves a median above that level after $\sim 1 { , } 5 0 0$ generations. However, it requires far more computation than ES to do so (ES requires ${ \sim } 1 0 0$ generations for median performance to surpass the 6,000 threshold). It is not clear why the GA requires so much more computation, especially given how quickly the GA found high-performing policies in the Atari domain. It is also surprising that the GA does not excel at this domain, given that GAs have performed well in the past on robot control tasks Clune et al. (2011). While the GA needs far more computation in this domain, it is interesting nevertheless that it does eventually solve it by producing an agent that can walk and score over 6,000. Considering its very fast discovery of high-performing solutions in Atari, clearly the GA’s advantage versus other methods depends on the domain, and understanding this dependence is an important target for future research.
278
+
279
+ # 7.7 THE MEANING OF “FRAMES”
280
+
281
+ Many papers, including ours, report the number of “frames” used during training. However, it is a bit unclear in the literature what is meant exactly by this term. We hope to introduce some terminology that can lend clarity to this confusing issue, which will improve reproducibility and our ability to compare algorithms fairly. Imagine if the Atari-emulator emitted 4B frames during training. We suggest calling these “game frames.” One could sub-sample every 4th frame (indeed, due to “frame skip”, most Atari papers do exactly this, and repeat the previous action for each skipped frame), resulting in 1B frames. We suggest calling these 1B frames “training frames”, as these are the frames the algorithm is trained on. In our paper we report the game frames used by each algorithm. Via personal communication with scientists at OpenAI and DeepMind, we confirmed that we are accurately reporting the number of frames (and that they are game frames, not training frames) used by DQN, A3C, and ES in Mnih et al. (2015), Mnih et al. (2016), and Salimans et al. (2017), respectively.
282
+
283
+ Table 4: Head-to-head comparison between algorithms on the 13 Atari games. Each value represents how many games for which the algorithm listed at the top of a column produces a higher score than the algorithm listed to the left of that row (e.g. GA 6B beats DQN on 7 games).
284
+
285
+ <table><tr><td></td><td>DQN</td><td>ES</td><td>A3C</td><td>RS 1B</td><td>GA 1B</td><td>GA 6B</td></tr><tr><td>DQN</td><td></td><td>6</td><td>6</td><td>3</td><td>6</td><td>7</td></tr><tr><td>ES</td><td>7</td><td></td><td>7</td><td>3</td><td>6</td><td>8</td></tr><tr><td>A3C</td><td>7</td><td>6</td><td></td><td>6</td><td>6</td><td>7</td></tr><tr><td>RS1B</td><td>10</td><td>10</td><td>7</td><td></td><td>13</td><td>13</td></tr><tr><td>GA 1B</td><td>7</td><td>7</td><td>7</td><td>0</td><td></td><td>13</td></tr><tr><td>GA 6B</td><td>6</td><td>5</td><td>6</td><td>0</td><td>0</td><td></td></tr></table>
286
+
287
+ There is one additional clarification. In all of the papers just mentioned and for the GA in this paper, the input to the network for Atari is the current framet and three previous frames. These three previous frames are from the training frame set, meaning that if $t$ counts each game frame then the input to the network is the following: game framet, frame $\mathrm { : _ { t - 4 } }$ , framet-8, and framet-12.
288
+
289
+ # 7.8 EXPERIMENTS ON AN EXPANDED SET OF ATARI GAMES AND COMPARISONS AGAINST MODERN, POWERFUL DQN VARIANTS (RAINBOW AND APE-X)
290
+
291
+ To test whether our results hold on a larger set of Atari games, we extended our experiments to the full 57-game set of Atari games used in two recent, famous papers that described enhancements to DQN, each of which improved the state of the art when published: Rainbow Hessel et al. (2017) and an algorithm that came out after our paper was published on arXiv, Ape-X Horgan et al. (2018). Two of the games did not run due to a bug in OpenAI’s Gym Brockman et al. (2016), leaving us with 55 total games. This set is a superset of the games from Mnih et al. (2015). We also added performance comparisons to two strong, recent DQN variants. For these experiments, the score within each run was a median over many (200) evaluations of the policy, instead of the mean (as done for our original 13 games), which we switched to because it is more robust to outliers: doing so lowers the scores somewhat because extreme outliers tend to be very high scores. The results can be seen in Table 5 and head-to-head tallies are in Table 6.
292
+
293
+ On this much larger set of games, the overall qualitative conclusions of our paper remain unchanged: the simple GA is roughly even with simple RL algorithms such as A3C and DQN, and ES, in that all of these algorithms can learn to play many Atari games well, and each is best on a subset of the games. The GA, which most assumed would not work at all at optimizing large, deep, multimillion parameter neural networks, especially in comparison to DQN and A3C, achieves superior performance to DQN and A3C on $43 \%$ (22 of 51, tying on 1) and $49 \%$ (27 of 55) games, respectively. Additionally, the GA achieves state of the art results on 6 games (bowling, centipede, private eye, skiing, solaris). The GA also also exhibits super-human performance on $43 \%$ of games (and is the only algorithm we are aware of with super-human performance on bowling). Each game is idiosyncratic, and could be considered a separate domain. Because the GA is roughly as good as some of the most famous Deep RL algorithms (DQN, A3C, and ES), and far better on some games, it is a valuable additional tool to have in our toolbox. When compared against Rainbow Hessel et al. (2017), which combines many of the best innovations built on top of DQN over years by a large research community, the GA still performs better on some games (it wins 11 of 52, ties on 2, and loses on 39: Table 6). The same is true when comparing against the Ape-X algorithm Horgan et al. (2018), which is a very recent, powerful version of prioritized DQN Schaul et al. (2015) (prioritized DQN is already an important improvement over the simple DQN) with a large number of distributed data-gathering agents each running epsilon-greedy exploration with different epsilons: the large amount of data generated and the different epsilons help with exploration and learning. Ape-X still underperforms the GA on 7 games. As discussed at more length in the main text, the Deep GA thus provides an interesting alternative algorithm to have added to the toolbox for deep RL problems: It may be practically helpful on any given domain, raises interesting new research questions into why it succeeds where other algorithms fail (and vice versa), and because we tested such a simple GA it is still unknown how its performance will compare to other algorithms once enhancements known to improve GA performance Fogel and Stayton (1994); Haupt and Haupt (2004); Clune et al. (2011); Mouret and Doncieux (2009); Lehman and Stanley (2011a); Stanley et al. (2009); Mouret and Clune (2015) are added to it.
294
+
295
+ ![](images/4d051f661d113ec8a50c9e06b73639939df85d888c5b426feb3de650d75d2d1b.jpg)
296
+ Figure 4: How different algorithms explore the deceptive Image Hard Maze over time. Traditional reward-maximization algorithms do not exhibit sufficient exploration to avoid the local optimum (of going up into Trap 2, as shown in Fig. 5). In contrast, a GA optimizing for novelty only (GA-NS) explores the entire environment and ultimately finds the goal. For the evolutionary algorithms (GA-NS, GA, ES), blue crosses represent the population (pseudo-offspring for ES), red crosses represent the top $T$ GA offspring, orange dots represent the final positions of GA elites and the current mean ES policy, and the black crosses are entries in the GA-NS archive. All 3 evolutionary algorithms had the same number of evaluations, but ES and the GA have many overlapping points because they revisit locations due to poor exploration, giving the illusion of fewer evaluations. For DQN and A2C, we plot the end-of-episode position of the agent for each of the 20K episodes prior to the checkpoint listed above the plot. It is surprising that ES significantly underperforms the GA $( p < 0 . 0 0 1 )$ . In 8 of 10 runs it gets stuck near Trap 1, not because of deception, but instead seemingly because it cannot reliably learn to pass through a small bottleneck corridor. This phenomenon has never been observed with population-based GAs on the Hard Maze, suggesting the ES (at least with these hyperparameters) is qualitatively different than GAs in this regard Lehman et al. (2017). We believe this difference occurs because ES optimizes for the average reward of the population sampled from a probability distribution. Even if the maximum fitness of agents sampled from that distribution is higher further along a corridor, ES will not move in that direction if the population average is lower (e.g. if other policies sampled from the distribution crash into the walls, or experience other low-reward fates) Lehman et al. (2017). Note, however, that even when ES moved through this bottleneck (2 out of 10 runs), because it is solely reward-driven, it got stuck in Trap 2.
297
+
298
+ ![](images/c1cd96e1474a082bcda7164c1782446b82bf9ac395dbf2a21a02b3452811bc64.jpg)
299
+ Figure 5: Image Hard Maze Domain and Results. Left: A small wheeled robot must navigate to the goal with this bird’s-eye view as pixel inputs. The robot starts in the bottom left corner facing right. Right: novelty search can train deep neural networks to avoid local optima that stymie other algorithms. The GA, which solely optimizes for reward and has no incentive to explore, gets stuck on the local optimum of Trap 2. The GA optimizing for novelty (GA-NS) is encouraged to ignore reward and explore the whole map, enabling it to eventually find the goal. ES performs even worse than the GA, as discussed in the main text. DQN and A2C also fail to solve this task. For ES, the performance of the mean $\theta$ policy each iteration is plotted. For GA and GA-NS, the performance of the highest-scoring individual per generation is plotted. Because DQN and A2C do not have the same number of evaluations per iteration as the evolutionary algorithms, we plot their final median reward as dashed lines. SI Fig. 4 shows the behavior of these algorithms during training.
300
+
301
+ Table 5: Extended Atari results. For SOTA counts, we include ties as a point in that column (e.g. Rainbow, ES, and the GA get a point for Pitfall). Games for which scores are not reported in other papers are left blank and do not factor into head-to-head tallies. 22
302
+
303
+ <table><tr><td></td><td>Human</td><td>DQN</td><td>Rainbow</td><td>Ape-X</td><td>A3C</td><td>ES</td><td>GA 6B</td></tr><tr><td>alien</td><td>6,875.0</td><td>1,620.0</td><td>9,491.7</td><td>40,804.9</td><td>518.4</td><td></td><td>1,990.0</td></tr><tr><td>amidar</td><td>1,676.0</td><td>978.0</td><td>5,131.2</td><td>8,659.2</td><td>263.9</td><td>112.0</td><td>370.0</td></tr><tr><td>assault</td><td>1,496.0</td><td>4,280.0</td><td>14,198.5</td><td>24,559.4</td><td>5,474.9</td><td>1,673.9</td><td>898.0</td></tr><tr><td>asterix</td><td>8,503.0</td><td>4,359.0</td><td>428,200.3</td><td>313,305.0</td><td>22,140.5</td><td>1,440.0</td><td>1,800.0</td></tr><tr><td>asteroids</td><td>13,157.0</td><td>1,364.5</td><td>2,712.8</td><td>155,495.1</td><td>4,474.5</td><td>1,562.0</td><td>1,940.0</td></tr><tr><td>atlantis</td><td>29,028.0</td><td>279,987.0</td><td>826,659.5</td><td>944,497.5</td><td>911,091.0</td><td>1,267,410.0</td><td>57,300.0</td></tr><tr><td>bank_heist</td><td>734.4</td><td>455.0</td><td>1,358.0</td><td>1,716.4</td><td>970.1</td><td>225.0</td><td>270.0</td></tr><tr><td>battle_zone</td><td>37,800.0</td><td>29,900.0</td><td>62,010.0</td><td>98,895.0</td><td>12,950.0</td><td>16,600.0</td><td>25,000.0</td></tr><tr><td>beam_rider</td><td>5,775.0</td><td>8,627.5</td><td>16,850.2</td><td>63,305.2</td><td>22,707.9</td><td>744.0</td><td>756.0</td></tr><tr><td>berzerk</td><td></td><td>585.6</td><td>2,545.6</td><td>57,196.7</td><td>817.9</td><td>686.0</td><td>1,440.0</td></tr><tr><td>bowling</td><td>154.8</td><td>50.4</td><td>30.0</td><td>17.6</td><td>35.1</td><td>30.0</td><td>197.0</td></tr><tr><td>boxing</td><td>4.3</td><td>88.0</td><td>99.6</td><td>100.0</td><td>59.8</td><td>49.8</td><td>64.0</td></tr><tr><td>breakout</td><td>31.8</td><td>385.5</td><td>417.5</td><td>800.9</td><td>681.9</td><td>9.5</td><td>10.0</td></tr><tr><td>centipede</td><td>11,963.0</td><td>4,657.7</td><td>8,167.3</td><td>12,974.0</td><td>3,755.8</td><td>7,783.9</td><td>14,122.0</td></tr><tr><td>chopper_command</td><td>9,882.0</td><td>6,126.0</td><td>16,654.0</td><td>721,851.0</td><td>7,021.0</td><td>3,710.0</td><td>3,500.0</td></tr><tr><td>crazy_climber</td><td>35,411.0</td><td>110,763.0</td><td>168,788.5</td><td>320,426.0</td><td>112,646.0</td><td>26,430.0</td><td>38,000.0</td></tr><tr><td>demon_attack</td><td>3,401.0</td><td>12,149.4</td><td>111,185.2</td><td>133,086.4</td><td>113,308.4</td><td>1,166.5</td><td>970.0</td></tr><tr><td>double_dunk</td><td>-15.5</td><td>-6.6</td><td>-0.3</td><td>23.5</td><td>-0.1</td><td>0.2</td><td>0.0</td></tr><tr><td>enduro</td><td>309.6</td><td>729.0</td><td>2,125.9</td><td>2,177.4</td><td>-82.5</td><td>95.0</td><td>51.0</td></tr><tr><td>fishing_derby</td><td>5.5</td><td>-4.9</td><td>31.3</td><td>44.4</td><td>18.8</td><td>49.0</td><td>-33.0</td></tr><tr><td>freeway</td><td>29.6</td><td>30.8</td><td>34.0</td><td>33.7</td><td>0.1</td><td>31.0</td><td>26.0</td></tr><tr><td>frostbite</td><td>4,335.0</td><td>797.4</td><td>9,590.5</td><td>9,328.6</td><td>190.5</td><td>370.0</td><td>4,460.0</td></tr><tr><td>gopher</td><td>2,321.0</td><td>8,777.4</td><td>70,354.6</td><td>120,500.9</td><td>10,022.8</td><td>582.0</td><td>1,200.0</td></tr><tr><td>gravitar</td><td>2,672.0</td><td>473.0</td><td>1,419.3</td><td>1,598.5</td><td>303.5</td><td>805.0</td><td>700.0</td></tr><tr><td>hero</td><td>25,763.0</td><td>20,437.8</td><td>55,887.4</td><td>31,655.9</td><td>32,464.1</td><td></td><td>18,220.0</td></tr><tr><td>ice_hockey</td><td>0.9</td><td>-1.9</td><td>1.1</td><td>33.0</td><td>-2.8</td><td>4.1</td><td>2.0</td></tr><tr><td>jamesbond</td><td>406.7</td><td></td><td></td><td>21,322.5</td><td>541.0</td><td></td><td>650.0</td></tr><tr><td>kangaroo</td><td>3,035.0</td><td>7,259.0</td><td>14,637.5</td><td>1,416.0</td><td>94.0</td><td>11,200.0</td><td>11,200.0</td></tr><tr><td>krull</td><td>2,395.0</td><td>8,422.3</td><td>8,741.5</td><td>11,741.4</td><td>5,560.0</td><td>8,647.2</td><td>10,889.0</td></tr><tr><td>kung_fu_master</td><td>22,736.0</td><td>26,059.0</td><td>52,181.0</td><td>97,829.5</td><td>28,819.0</td><td></td><td>62,000.0</td></tr><tr><td>montezuma_revenge</td><td>4,367.0</td><td>0.0</td><td>384.0</td><td>2,500.0</td><td>67.0</td><td>0.0</td><td>0.0</td></tr><tr><td>ms-pacman</td><td>15,693.0</td><td>3,085.6</td><td>5,380.4</td><td>11,255.2</td><td>653.7</td><td></td><td>3,410.0</td></tr><tr><td>name_this_game</td><td>4,076.0</td><td>8,207.8</td><td>13,136.0</td><td>25,783.3</td><td>10,476.1</td><td>4,503.0</td><td>7,210.0</td></tr><tr><td>phoenix</td><td></td><td>8,485.2</td><td>108,528.6</td><td>224,491.1</td><td>52,894.1</td><td>4,041.0</td><td>3,810.0</td></tr><tr><td>pitfall</td><td></td><td>-286.1</td><td>0.0</td><td>-0.6</td><td>-78.5</td><td>0.0</td><td>0.0</td></tr><tr><td>pong</td><td>9.3</td><td>19.5</td><td>20.3</td><td>20.9</td><td>5.6</td><td>21.0</td><td>-20.0</td></tr><tr><td>private_eye</td><td>69,571.0</td><td>146.7</td><td>4,234.0</td><td>49.8</td><td>206.9</td><td>100.0</td><td>15,200.0</td></tr><tr><td>qbert</td><td>13,455.0</td><td>13,117.3</td><td>33,817.5</td><td>302,391.3</td><td>15,148.8</td><td>147.5</td><td>5,125.0</td></tr><tr><td>riverraid</td><td>13,513.0</td><td></td><td></td><td>63,864.4</td><td>12,201.8</td><td>5,009.0</td><td>3,410.0</td></tr><tr><td>road_runner</td><td>7,845.0</td><td>39,544.0</td><td>62,041.0</td><td>222,234.5</td><td>34,216.0</td><td>16,590.0</td><td>15,900.0</td></tr><tr><td>robotank</td><td>11.9</td><td>63.9</td><td>61.4</td><td>73.8</td><td>32.8</td><td>11.9</td><td>16.0</td></tr><tr><td>seaquest</td><td>20,182.0</td><td>5,860.6</td><td>15,898.9</td><td>392,952.3</td><td>2,355.4</td><td>1,390.0</td><td>1,020.0</td></tr><tr><td>skiing</td><td></td><td>-13,062.3</td><td>-12,957.8</td><td>-10,789.9</td><td>-10,911.1</td><td>-15,442.5</td><td>-5,564.0</td></tr><tr><td>solaris</td><td></td><td>3,482.8</td><td>3,560.3</td><td>2,892.9</td><td>1,956.0</td><td>2,090.0</td><td>7,200.0</td></tr><tr><td>space_invaders</td><td>1,652.0</td><td>1,692.3</td><td>18,789.0</td><td>54,681.0</td><td>15,730.5</td><td>678.5</td><td>840.0</td></tr><tr><td>star_gunner</td><td>10,250.0</td><td>54,282.0</td><td>127,029.0</td><td>434,342.5</td><td>138,218.0</td><td>1,470.0</td><td>800.0</td></tr><tr><td>tennis</td><td>-8.9</td><td>12.2</td><td>0.0</td><td>23.9</td><td>-6.3</td><td>4.5</td><td>0.0</td></tr><tr><td>time_pilot</td><td>5,925.0</td><td>4,870.0</td><td>12,926.0</td><td>87,085.0</td><td>12,679.0</td><td>4,970.0</td><td>16,800.0 174.0</td></tr><tr><td>tutankham up_n_down</td><td>167.6</td><td>68.1</td><td>241.0</td><td>272.6</td><td>156.3</td><td>130.3</td></table>
304
+
305
+ Table 6: Head-to-head comparison between algorithms on Atari games. Values represent the number of wins, losses, and ties between algorithms (e.g. vs. DQN, the GA wins on 22 games, loses on 29, and ties on 1. As discussed in the main text, apples-to-apples comparisons are difficult to make, as different algorithms exhibit different tradeoffs in computation, wall-clock speed, and data efficiency.
306
+
307
+ <table><tr><td></td><td>Human</td><td>DQN</td><td>Rainbow</td><td>Ape-X</td><td>A3C</td><td>ES</td><td>GA 6B</td></tr><tr><td>Human DQN</td><td></td><td>22,24, 0</td><td>37,9,0 48,4,0</td><td>43,6,0</td><td>28,21,0</td><td>15,28,1 18,29,1</td><td>21,28,0 22,29,1</td></tr><tr><td>Rainbow</td><td></td><td></td><td></td><td>48,4,0 43,9,0</td><td>30,22,0 11,41, 0</td><td>7,39,2</td><td>11,39,2</td></tr><tr><td>Ape-X</td><td></td><td></td><td></td><td></td><td></td><td>7,43,0</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>3,52,0</td><td></td><td>7,48,0</td></tr><tr><td>A3C</td><td></td><td></td><td></td><td></td><td></td><td>18,32, 0</td><td>27,28,0</td></tr><tr><td>ES</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>GA 6B</td><td></td><td></td><td></td><td></td><td></td><td></td><td>28,19,3</td></tr></table>
md/train/Hyl5V0EYvB/Hyl5V0EYvB.md ADDED
@@ -0,0 +1,416 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TESTING ROBUSTNESS AGAINST UNFORESEEN ADVERSARIES
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Most existing defenses against adversarial attacks only consider robustness to $L _ { p }$ - bounded distortions. In reality, the specific attack is rarely known in advance and adversaries are free to modify images in ways which lie outside any fixed distortion model; for example, image rotations lie outside the set of $L _ { p }$ -bounded distortions. In this work, we advocate measuring robustness against a much broader range of unforeseen attacks, attacks whose precise form is unknown during defense design.
8
+
9
+ We propose several new attacks and a methodology for evaluating a defense against a diverse range of unforeseen distortions. First, we construct novel adversarial JPEG, Fog, Gabor, and Snow distortions to simulate more diverse adversaries. We then introduce UAR, a summary metric that measures the robustness of a defense against a given distortion. Using UAR to assess robustness against existing and novel attacks, we perform an extensive study of adversarial robustness. We find that evaluation against existing $L _ { p }$ attacks yields redundant information which does not generalize to other attacks; we instead recommend evaluating against our significantly more diverse set of attacks. We further find that adversarial training against either one or multiple distortions fails to confer robustness to attacks with other distortion types. These results underscore the need to evaluate and study robustness against unforeseen distortions.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Neural networks perform well on many benchmark tasks (He et al., 2016) yet can be fooled by adversarial examples (Goodfellow et al., 2014) or inputs designed to subvert a given model. Adversaries are usually assumed to be constrained by an $L _ { \infty }$ budget (Goodfellow et al., 2014; Madry et al., 2017; Xie et al., 2018), while other modifications such as adversarial geometric transformations, patches, and even 3D-printed objects have also been considered (Engstrom et al., 2017; Brown et al., 2017; Athalye et al., 2017). However, most work on adversarial robustness assumes that the adversary is fixed and known in advance. Defenses against adversarial attacks are often constructed in view of this specific assumption (Madry et al., 2017).
14
+
15
+ In practice, adversaries can modify and adapt their attacks so that they are unforeseen. In this work, we propose novel attacks which enable the diverse assessment of robustness to unforeseen attacks. Our attacks are varied ( 2) and qualitatively distinct from current attacks. We propose adversarial JPEG, Fog, Gabor, and Snow attacks (sample images in Figure 1).
16
+
17
+ We propose an unforeseen attack evaluation methodology (§3) that involves evaluating a defense against a diverse set of held-out distortions decoupled from the defense design. For a fixed, held-out distortion, we then evaluate the defense against the distortion for a calibrated range of distortion sizes whose strength is roughly comparable across distortions. For each fixed distortion, we summarize the robustness of a defense against that distortion relative to a model adversarially trained on that distortion, a measure we call UAR. We provide code and calibrations to easily evaluate a defense against our suite of attacks at https://github.com/iclr-2020-submission/ advex-uar.
18
+
19
+ By applying our method to 87 adversarially trained models and 8 different distortion types (§4), we find that existing defenses and evaluation practices have marked weaknesses. Our results show that existing defenses based on adversarial training do not generalize to unforeseen adversaries, even when restricted to the 8 distortions in Figure 1. This adds to the mounting evidence that achieving robustness against a single distortion type is insufficient to impart robustness to unforeseen attacks (Jacobsen et al., 2019; Jordan et al., 2019; Tramer & Boneh, 2019). \`
20
+
21
+ ![](images/ae27e0b408151854ee1ac8545b5497c78e3d2093b17b785048cead2dcca9a7af.jpg)
22
+ Figure 1: Attacked images (label “espresso maker”) against adversarially trained models with large $\varepsilon$ . Each of the adversarial images above are optimized to maximize the classification loss.
23
+
24
+ Turning to evaluation, our results demonstrate that accuracy against different $L _ { p }$ distortions is highly correlated relative to the other distortions we consider. This suggest that the common practice of evaluating only against $L _ { p }$ distortions to test a model’s adversarial robustness can give a misleading account. Our analysis demonstrates that our full suite of attacks adds substantive attack diversity and gives a more complete picture of a model’s robustness to unforeseen attacks.
25
+
26
+ A natural approach is to defend against multiple distortion types simultaneously in the hope that seeing a larger space of distortions provides greater transfer to unforeseen distortions. Unfortunately, we find that defending against even two different distortion types via joint adversarial training is difficult (§5). Specifically, joint adversarial training leads to overfitting at moderate distortion sizes.
27
+
28
+ In summary, we propose a metric UAR to assess robustness of defenses against unforeseen adversaries. We introduce a total of 4 novel attacks. We apply UAR to assess how robustness transfers to existing attacks and our novel attacks. Our results demonstrate that existing defense and evaluation methods do not generalize well to unforeseen attacks.
29
+
30
+ # 2 A SET OF DIVERSE AND NOVEL ADVERSARIAL ATTACKS
31
+
32
+ We consider distortions (attacks) applied to an image $x \in \mathbb { R } ^ { 3 \times 2 2 4 \times 2 2 4 }$ , represented as a vector of RGB values. Let $f : \mathbb { R } ^ { 3 \times 2 2 4 \times 2 2 4 } \stackrel { \bullet \star } { \to } \mathbb { R } ^ { 1 0 0 }$ ∈ be a model mapping images to logits1, and let $\ell ( f ( x ) , y )$ denote the cross-entropy loss. For an input $x$ with true label $y$ and a target class $y ^ { \prime } \ne y$ , our adversarial attacks attempt to find $x ^ { \prime }$ such that
33
+
34
+ 1. the attacked image $x ^ { \prime }$ is obtained by applying a constrained distortion to $x$ , and
35
+ 2. the loss $\ell ( f ( x ^ { \prime } ) , y ^ { \prime } )$ is minimized (targeted attack).
36
+
37
+ Adversarial training (Goodfellow et al., 2014) is a strong defense baseline against a fixed attack (Madry et al., 2017; Xie et al., 2018) which updates using an attacked image $x ^ { \prime }$ instead of the clean image $x$ at each training iteration.
38
+
39
+ We consider 8 attacks: $L _ { \infty }$ (Goodfellow et al., 2014), $L _ { 2 }$ (Szegedy et al., 2013; Carlini & Wagner, 2017), $L _ { 1 }$ (Chen et al., 2018), Elastic (Xiao et al., 2018), JPEG, Fog, Gabor, and Snow. We show sample attacked images in Figure 1 and the corresponding distortions in Figure 2. The JPEG, Fog,
40
+
41
+ ![](images/53126ea378587882c6a6dd9dde71609349f423ef460683bbbded70b29cec4e9c.jpg)
42
+ Figure 2: Scaled pixel-level differences between original and attacked images for each attack (label “espresso maker”). The $L _ { 1 }$ , $L _ { 2 }$ , and $L _ { \infty }$ norms of the difference are shown after the attack name. Our novel attacks display behavior which is qualitatively different from that of the $L _ { p }$ attacks. Attacked images are shown in Figure 1, and unscaled differences are shown in Figure 9, Appendix B.1.
43
+
44
+ Gabor, and Snow attacks are new to this paper, and the $L _ { 1 }$ attack uses the Frank-Wolfe algorithm to improve on previous $L _ { 1 }$ attacks. We now describe the attacks, whose distortion sizes are controlled by a parameter $\varepsilon$ . We clamp output pixel values to [0, 255].
45
+
46
+ Existing attacks. The $L _ { p }$ attacks with $p \in \{ 1 , 2 , \infty \}$ modify an image $x$ to an attacked image $\boldsymbol { x } ^ { \prime } = \boldsymbol { x } + \boldsymbol { \delta }$ . We optimize $\delta$ under the constraint $\| \delta \| _ { p } \leq \varepsilon$ , where $\| \cdot \| _ { p }$ is the $L _ { p }$ -norm on $\mathbb { R } ^ { 3 \times 2 2 4 \times 2 2 4 }$ .
47
+
48
+ The Elastic attack warps the image by allowing distortions $\begin{array} { r } { \begin{array} { r c l } { x ^ { \prime } } & { = } & { \mathsf { F l o w } ( x , V ) } \end{array} } \end{array}$ , where $V :$ $\{ 1 , . . . , 2 2 4 \} ^ { 2 } \mathbb { R } ^ { 2 }$ is a vector field on pixel space, and Flow sets the value of pixel $( i , j )$ to the bilinearly interpolated original value at $( i , j ) + V ( i , j )$ . We construct $V$ by smoothing a vector field $W$ by a Gaussian kernel (size $2 5 \times 2 5$ , std. dev. 3 for a $2 2 4 \times 2 2 4$ image) and optimize $W$ under $\| W ( i , j ) \| _ { \infty } \leq \varepsilon$ for all $i , j$ . This differs in details from Xiao et al. (2018) but is similar in spirit.
49
+
50
+ Novel attacks. As discussed in Shin & Song (2017) for defense, JPEG compression applies a lossy linear transformation JPEG based on the discrete cosine transform to image space, followed by quantization. The JPEG attack imposes the $L _ { \infty }$ -constraint $\| \mathsf { J P E G } ( x ) - \mathsf { J P E G } ( x ^ { \prime } ) \| _ { \infty } \leq \varepsilon$ on the attacked image $x ^ { \prime }$ . We optimize $z = \mathsf { J P E G } ( x ^ { \prime } )$ and apply a right inverse of JPEG to obtain $x ^ { \prime }$ .
51
+
52
+ Our novel Fog, Gabor, and Snow attacks are adversarial versions of non-adversarial distortions proposed in the literature. Fog and Snow introduce adversarially chosen partial occlusions of the image resembling the effect of mist and snowflakes, respectively; stochastic versions of Fog and Snow appeared in Hendrycks & Dietterich (2019). Gabor superimposes adversarially chosen additive Gabor noise (Lagae et al., 2009) onto the image; a stochastic version appeared in
53
+
54
+ ![](images/5ff0aa838ad34a5b5fa0dc3edbdb19d1c3dcbb0d69aba19d8de22b5bb872a93a.jpg)
55
+ Figure 3: Snow before and after optimization.
56
+
57
+ Co et al. (2019). These attacks work by optimizing a set of parameters controlling the distortion over an $L _ { \infty }$ -bounded set. Specifically, values for the diamond-square algorithm, sparse noise, and snowflake brightness (Figure 3) are chosen adversarially for Fog, Gabor, and Snow, respectively.
58
+
59
+ Optimization. To handle $L _ { \infty }$ and $L _ { 2 }$ constraints, we use randomly-initialized projected gradient descent (PGD), which optimizes the distortion $\delta$ by gradient descent and projection to the $L _ { \infty }$ and $L _ { 2 }$ balls (Madry et al., 2017). For $L _ { 1 }$ constraints, this projection is more difficult, and previous $L _ { 1 }$ attacks resort to heuristics (Chen et al., 2018; Tramer & Boneh, 2019). We use the randomly- \` initialized Frank-Wolfe algorithm (Frank & Wolfe, 1956), which replaces projection by a simpler optimization of a linear function at each step (pseudocode in Appendix B.2).
60
+
61
+ ![](images/916798a6d45f2f7ac8d133393ba07b2aeabd5c72794268ae84bc26c050a0be67.jpg)
62
+ Figure 4: Accuracies of $L _ { 2 }$ and Elastic attacks at different distortion sizes against a ResNet-50 model adversarially trained against $L _ { 2 }$ at $\varepsilon = 9 6 0 0$ on ImageNet-100. At small distortion sizes, the model appears to defend well against Elastic, but large distortion sizes reveal a lack of transfer.
63
+
64
+ # 3 MOTIVATION AND DESCRIPTION OF OUR METHODOLOGY
65
+
66
+ We now propose a method to assess robustness against unforeseen distortions, which relies on evaluating a defense against a diverse set of attacks that were not used when designing the defense. Our method must address the following issues:
67
+
68
+ • The range of distortion sizes must be wide enough to avoid the misleading behavior in which robustness appears to transfer at low distortion sizes but not at high distortion sizes (Figure 4); • The set of attacks considered must be sufficiently diverse.
69
+
70
+ We first provide a method to calibrate distortion sizes and then use it to define a summary metric that assesses the robustness of a defense against a specific unforeseen attack. Using this metric, we are able to assess diversity and recommend a set of attacks to evaluate against.
71
+
72
+ Calibrate distortion size using adversarial training. As shown in Figure 4, the correlation between adversarial robustness against different distortion types may look different for different ranges of distortion sizes. It is therefore critical to evaluate on a wide enough range of distortion size $\varepsilon$ . We choose the minimum and maximum distortion sizes $\varepsilon$ using the following principles; sample images at $\varepsilon _ { \mathrm { { m i n } } }$ and $\varepsilon _ { \mathrm { m a x } }$ are shown in Figure 5b.
73
+
74
+ 1. The minimum distortion size $\varepsilon _ { \mathrm { { m i n } } }$ is the largest $\varepsilon$ for which the adversarial validation accuracy against an adversarially trained model is comparable to that of a model trained and evaluated on unattacked data (for ImageNet-100, within 3 of 87).
75
+ 2. The maximum distortion size $\varepsilon _ { \mathrm { m a x } }$ is the smallest $\varepsilon$ which either (a) yields images which confuse humans when applied against adversarially trained models or (b) reduces accuracy of adversarially trained models (ATA below) to below 25.
76
+
77
+ In practice, we select $\varepsilon _ { \mathrm { { m i n } } }$ and $\varepsilon _ { \mathrm { m a x } }$ according to these criteria from a sequence of $\varepsilon$ which is geometrically increasing with ratio 2. We choose to evaluate against adversarially trained models because attacking against strong defenses is necessary to produce strong visual distortions (Figure 5a). We introduce the constraint that humans recognize attacked images at $\varepsilon _ { \mathrm { m a x } }$ because we find cases for $L _ { 1 }$ , Fog, and Snow where adversarially trained models maintain non-zero accuracy for distortion sizes producing images incomprehensible to humans. An example for Snow is shown in Figure 5b.
78
+
79
+ UAR: an adversarial robustness metric. We measure a model’s robustness against a specific distortion type by comparing it to adversarially trained models, which represent an approximate ceiling on performance with prior knowledge of the distortion type. For distortion type $A$ and size $\varepsilon$ , let the Adversarial Training Accuracy $\mathsf { A T A } ( A , \varepsilon )$ be the best adversarial accuracy on the test set that can be achieved by adversarially training a specific architecture (ResNet-50 for ImageNet100, ResNet-56 for CIFAR-10) against $A$ .2 Even when evaluating a defense using an architecture
80
+
81
+ (a) The $L _ { \infty }$ attack at $\varepsilon = 3 2$ applied to undefended model and models adversarially trained against $L _ { \infty }$ at different distortion sizes. Attacking models trained against larger $\varepsilon$ produces greater visual distortion.
82
+
83
+ ![](images/2c560ffed0c3962581881e9bc255b46c65314acabce0aa4fd9c400a3e18ca1c3.jpg)
84
+ (b) The JPEG, Gabor, and Snow attacks applied to adversarially trained models at $\varepsilon _ { \mathrm { { m i n } } }$ and $\varepsilon _ { \mathrm { m a x } }$ . Distortions are almost imperceptible at $\varepsilon _ { \mathrm { { m i n } } }$ , but make the image barely recognizable by humans at $\varepsilon _ { \mathrm { m a x } }$ .
85
+
86
+ Figure 5: Varying distortion size against adversarially trained models reveals full attack strength.
87
+
88
+ other than ResNet-50 or ResNet-56, we recommend using the ATA values computed with these architectures to allow for uniform comparisons.
89
+
90
+ Given a set of distortion sizes $\{ \varepsilon _ { 1 } , \ldots , \varepsilon _ { n } \}$ , we propose the summary metric UAR (Unforeseen Attack Robustness) normalizing the accuracy of a model $M$ against adversarial training accuracy:
91
+
92
+ $$
93
+ \mathsf { U A R } ( A , M ) : = 1 0 0 \cdot \left( \frac { 1 } { n } \sum _ { k = 1 } ^ { n } \mathsf { A c c } ( A , \varepsilon _ { k } , M ) \right) \Bigg / \left( \frac { 1 } { n } \sum _ { k = 1 } ^ { n } \mathsf { A T A } ( A , \varepsilon _ { k } ) \right) .
94
+ $$
95
+
96
+ Here $\mathsf { A c c } ( A , \varepsilon , M )$ is the accuracy of $M$ against distortions of type $A$ and magnitude $\varepsilon$ . We expect most UAR scores to be lower than 100 against held-out distortion types, as an UAR score greater than 100 means that a defense is outperforming an adversarially trained model on that distortion. The normalizing factor in (1) is required to keep UAR scores roughly comparable between distortions, as different distortions can have different strengths as measured by ATA at the chosen distortion sizes.
97
+
98
+ Having too many or too few $\varepsilon _ { k }$ values in a certain range may cause an attack to appear artificially strong or weak because the functional relation between distortion size and attack strength (measured by ATA) varies between attacks. To make UAR roughly comparable between distortions, we evaluate at $\varepsilon$ increasing geometrically from $\varepsilon _ { \mathrm { { m i n } } }$ to $\varepsilon _ { \mathrm { m a x } }$ by factors of 2 and take the subset of $\varepsilon$ whose ATA values have minimum $\ell _ { 1 }$ -distance to the ATA values of the $L _ { \infty }$ attack at geometrically increasing $\varepsilon$ .
99
+
100
+ For example, when calibrating Elastic in Table 1, we start with $\varepsilon _ { \mathrm { m i n } } = 0 . 2 5$ and $\varepsilon _ { \operatorname* { m a x } } = 1 6$ based on our earlier criteria. We then compute the ATAs at the 7 geometrically increasing $\varepsilon$ values $\varepsilon \in$ $\{ 0 . 2 5 , 0 . 5 , 1 , 2 , 4 , 8 , 1 6 \}$ . We consider size-6 subsets of those ATA values, view them as vectors of length 6 in decreasing order, and compute the $\ell _ { 1 }$ -distance between these vectors and the vector for $L _ { \infty }$ shown in the first row of Table 1. Finally, we select the $\varepsilon$ values for Elastic in Table 1 as those corresponding to the size-6 subset with minimum $\ell _ { 1 }$ -distance to the vector for $L _ { \infty }$ .
101
+
102
+ For our 8 distortion types, we provide reference values of $\mathsf { A T A } ( A , \varepsilon )$ on this calibrated range of 6 distortion sizes on ImageNet-100 (Table 1, $\ S 4 )$ ) and CIFAR-10 (Table 3, Appendix C.3.2). This allows UAR computation for a new defense using 6 adversarial evaluations and no adversarial training, reducing computational cost from $^ { 1 9 2 + }$ to 6 NVIDIA V100 GPU-hours on ImageNet-100.
103
+
104
+ Evaluate against diverse distortion types. Since robustness against different distortion types may have low or no correlation (Figure 6b), measuring performance on different distortions is important to avoid overfitting to a specific type, especially when a defense is constructed with it in mind (as with adversarial training). Our results in $\ S 4$ demonstrate that choosing appropriate distortion types to evaluate against requires some care, as distortions such as $L _ { 1 }$ , $L _ { 2 }$ , and $L _ { \infty }$ that may seem different can actually have highly correlated scores against defenses (see Figure 6). We instead recommend evaluation against our more diverse attacks, taking the $L _ { \infty }$ , $L _ { 1 }$ , Elastic, Fog, and Snow attacks as a starting point.
105
+
106
+ Table 1: Calibrated distortion sizes and ATA values for different distortion types on ImageNet-100. ATA values for CIFAR-10 are shown in Table 3 (Appendix C.3.2).
107
+
108
+ <table><tr><td>Attack ε1</td><td></td><td>ε2</td><td>ε3</td><td>ε4</td><td>£5</td><td>6</td><td>ATA1</td><td>ATA2</td><td>ATA3</td><td>ATA4</td><td>ATA5</td><td>ATA6</td></tr><tr><td>L</td><td>1</td><td>2</td><td>4</td><td>8</td><td>16</td><td>32</td><td>84.6</td><td>82.1</td><td>76.2</td><td>66.9</td><td>40.1</td><td>12.9</td></tr><tr><td>L2</td><td>150</td><td>300</td><td>600</td><td>1200</td><td>2400</td><td>4800</td><td>85.0</td><td>83.5</td><td>79.6</td><td>72.6</td><td>59.1</td><td>19.9</td></tr><tr><td>L1</td><td>9562.5</td><td>19125</td><td>76500 1530001</td><td></td><td>306000 612000</td><td></td><td>84.4</td><td>82.7</td><td>76.3</td><td>68.9</td><td>56.4</td><td>36.1</td></tr><tr><td>Elastic</td><td>0.250</td><td>0.500</td><td>2</td><td>4</td><td>8</td><td>16</td><td>85.9</td><td>83.2</td><td>78.1</td><td>75.6</td><td>57.0</td><td>22.5</td></tr><tr><td>JPEG</td><td>0.062</td><td>0.125</td><td>0.250</td><td>0.500</td><td>1</td><td>2</td><td>85.0</td><td>83.2</td><td>79.3</td><td>72.8</td><td>34.8</td><td>1.1</td></tr><tr><td>Fog</td><td>128</td><td>256</td><td>512</td><td>2048</td><td>4096</td><td>8192</td><td>85.8</td><td>83.8</td><td>79.0</td><td>68.4</td><td>67.9</td><td>64.7</td></tr><tr><td>Snow</td><td>0.062</td><td>0.125</td><td>0.250</td><td>2</td><td>4</td><td>8</td><td>84.0</td><td>81.1</td><td>77.7</td><td>65.6</td><td>59.5</td><td>41.2</td></tr><tr><td>Gabor</td><td>6.250</td><td>12.500 25</td><td></td><td>400</td><td>800</td><td>1600</td><td>84.0</td><td>79.8</td><td>79.8</td><td>66.2</td><td>44.7</td><td>14.6</td></tr></table>
109
+
110
+ # 4 UAR REVEALS THE NEED TO EVALUATE AGAINST MORE DIVERSE ATTACKS
111
+
112
+ We apply our methodology to the 8 attacks in $\ S 2$ using models adversarially trained against these attacks. Our results reveal that evaluating against the commonly used $L _ { p }$ -attacks gives highly correlated information which does not generalize to other unforeseen attacks. Instead, they suggest that evaluating on diverse attacks is necessary and identify a set of 5 attacks with low pairwise robustness transfer which we suggest as a starting point when assessing robustness to unforeseen adversaries.
113
+
114
+ Dataset and model. We use two datasets: CIFAR-10 and ImageNet-100, the 100-class subset of ImageNet-1K (Deng et al., 2009) containing every $1 0 ^ { \mathrm { t h } }$ class by WordNet ID order. We use ResNet56 for CIFAR-10 and ResNet-50 as implemented in torchvision for ImageNet-100 (He et al., 2016). We give training hyperparameters in Appendix A.
115
+
116
+ Adversarial training and evaluation procedure. We construct hardened models using adversarial training (Madry et al., 2017). To train against attack $A$ , for each mini-batch of training images, we select a uniform random (incorrect) target class for each image. For maximum distortion size $\varepsilon$ , we apply the targeted attack $A$ to the current model with distortion size $\varepsilon ^ { \prime } \sim \mathrm { U n i f o r m } ( 0 , \varepsilon )$ and update the model with a step of stochastic gradient descent using only the resulting adversarial images (no clean images). The random size scaling improves performance especially against smaller distortions. We use 10 optimization steps for all attacks during training except for Elastic, where we use 30 steps due to its more difficult optimization problem. When PGD is used, we use step size $\varepsilon / \sqrt { \mathrm { s t e p s } }$ , the optimal scaling for non-smooth convex functions (Nemirovski & Yudin, 1978; 1983).
117
+
118
+ We adversarially train 87 models against the 8 attacks from $\ S 2$ at the distortion sizes described in $\ S 3$ and evaluate them on the ImageNet-100 and CIFAR-10 validation sets against 200-step targeted attacks with uniform random (incorrect) target class. This uses more steps for evaluation than train
119
+
120
+ ![](images/0c5e02ee09998407bebd70a1c73ef4f1cba18d475d47a5d603828630625d98cf.jpg)
121
+
122
+ (a) UAR scores for adv. trained defenses (rows) against attacks (columns) on ImageNet-100. See Figure 12 for more $\varepsilon$ values and Appendix C.3.2 for CIFAR-10 results.
123
+
124
+ ![](images/4791a8dc6b07f45f5b9a2342974dc3da6bc806f48fe6fcd91da43e96f702927a.jpg)
125
+
126
+ (b) Correlations between UAR scores in Figure 6a for each attack (rows and columns). Correlation was computed over adversarial defenses in Figure 6a trained without knowledge of the attacks (6 total per pair).
127
+
128
+ Figure 6: UAR scores demonstrate the need to evaluate against diverse attacks.
129
+
130
+ ing per best practices (Carlini et al., 2019). We use UAR to analyze the results in the remainder of this section, directing the reader to Figures 10 and 11 (Appendix C.2) for exhaustive results and to Appendix D for checks for robustness to random seed and number of attack steps.
131
+
132
+ Existing defense and evaluation methods do not generalize to unforeseen attacks. The many low off-diagonal UAR scores in Figure 6a make clear that while adversarial training is a strong baseline against a fixed distortion, it only rarely confers robustness to unforeseen distortions. Notably, we were not able to achieve a high UAR against Fog except by directly adversarially training against it. Despite the general lack of transfer in Figure 6a, the fairly strong transfer between the $L _ { p }$ -attacks is consistent with recent progress in simultaneous robustness to them (Croce & Hein, 2019).
133
+
134
+ Figure 6b shows correlations between UAR scores of pairs of attacks $A$ and $A ^ { \prime }$ against defenses adversarially trained without knowledge3 of $A$ or $A ^ { \prime }$ . The results demonstrate that defenses trained without knowledge of $L _ { p }$ -attacks have highly correlated UAR scores against the different $L _ { p }$ attacks, but this correlation does not extend to their evaluations against other attacks. This suggests that $L _ { p }$ - evaluations offer limited diversity and may not generalize to other unforeseen attacks.
135
+
136
+ The $L _ { \infty }$ , $L _ { 1 }$ , Elastic, Fog, and Snow attacks offer greater diversity. Our results on $L _ { p }$ -evaluation suggest that more diverse attack evaluation is necessary for generalization to unforeseen attacks. As the unexpected correlation between UAR scores against the pairs (Fog, Gabor) and $\left( \mathrm { J P E G } , L _ { 1 } \right)$ in Figure 6b demonstrates, even attacks with very different distortions may have correlated behaviors. Considering all attacks in Figure 6 together results in signficantly more diversity, which we suggest for evaluation against unforeseen attacks. We suggest the 5 attacks $( L _ { \infty } , L _ { 1 }$ , Elastic, Fog, and Snow) with low UAR against each other and low correlation between UAR scores as a good starting point.
137
+
138
+ # 5 JOINT ADVERSARIAL TRAINING: DEFENDING AGAINST TWO DISTORTIONS
139
+
140
+ A natural idea to improve robustness against unforeseen adversaries is to adversarially train the same model against two different types of distortions simultaneously, with the idea that this will cover a larger portion of the space of distortions. We refer to this as joint adversarial training (Jordan et al., 2019; Tramer & Boneh, 2019). For two attacks \` $A$ and $A ^ { \prime }$ , at each training step, we compute the attacked image under both $A$ and $A ^ { \prime }$ and backpropagate with respect to gradients induced by the image with greater loss. This corresponds to the “max” loss described in Tramer & Boneh (2019).\` We jointly train models for $( L _ { \infty } , L _ { 2 } )$ , $( L _ { \infty } , L _ { 1 } )$ , and $( L _ { \infty }$ , Elastic) using the same setup as before
141
+
142
+ ![](images/625170de299531c3cd1b867a34d1444b71f72f927a58c03e996320eda7d22cf6.jpg)
143
+ Figure 7: UAR scores for jointly adv. trained defenses (rows) against distortion types (columns).
144
+
145
+ Transfer for jointly trained models. Figure 7 reports UAR scores for jointly trained models using ResNet-50 on ImageNet-100; full evaluation accuracies are in Figure 19 (Appendix E). Comparing to Figure 6a and Figure 12 (Appendix E), we see that, relative to training against only $L _ { 2 }$ , joint training against $( L _ { \infty } , L _ { 2 } )$ slightly improves robustness against $L _ { 1 }$ without harming robustness against other attacks. In contrast, training against $( L _ { \infty } , L _ { 1 } )$ is worse than either training against $L _ { 1 }$ or $L _ { \infty }$ separately (except at small $\varepsilon$ for $L _ { 1 }$ ). Training against $( L _ { \infty }$ , Elastic) also performs poorly.
146
+
147
+ Joint training and overfitting. Jointly trained models achieve high training accuracy but poor validation accuracy (Figure 8) that fluctuates substantially for different random seeds (Table 4, Appendix E.2). Figure 8 shows the overfitting behavior for $L _ { \infty }$ , Elastic): $L _ { \infty }$ validation accuracy decreases significantly during training while training accuracy increases. This contrasts with standard adversarial training (Figure 8), where validation accuracy levels off as training accuracy increases.
148
+
149
+ ![](images/58b2deb77fae4ade71fabd80f52f452df16aecef04abe171002af23557964b2e.jpg)
150
+ Figure 8: Left: train and validation curves for joint training against $L _ { \infty }$ , $\varepsilon = 8$ and Elastic, $\varepsilon = 4$ , Right: train and val curves for standard adversarial training for $L _ { \infty }$ , $\varepsilon = 8$ . The joint validation accuracy of $L _ { \infty }$ decreases as training progresses, indicating overfitting.
151
+
152
+ Overfitting primarily occurs when training against large distortions. We successfully trained against the $( L _ { \infty } , L _ { 1 } )$ and $( L _ { \infty }$ , Elastic) pairs for small distortion sizes with accuracies comparable to but slightly lower than observed in Figure 11 for training against each attack individually (Figure 18, Appendix E). This agrees with behavior reported by Tramer & Boneh (2019) on CIFAR-10. Our \` intuition is that harder training tasks (more diverse distortion types, larger $\varepsilon$ ) make overfitting more likely. We briefly investigate the relation between overfitting and model capacity in Appendix E.3; validation accuracy appears slightly increased for ResNet-101, but overfitting remains.
153
+
154
+ # 6 DISCUSSION AND RELATED WORK
155
+
156
+ We have seen that robustness to one attack provides limited information about robustness to other attacks, and moreover that adversarial training provides limited robustness to unforeseen attacks. These results suggest a need to modify or move beyond adversarial training. While joint adversarial training is one possible alternative, our results show it often leads to overfitting. Even ignoring this, it is not clear that joint training would confer robustness to attacks outside of those trained against.
157
+
158
+ Evaluating robustness has proven difficult, necessitating detailed study of best practices even for a single fixed attack (Papernot et al., 2017; Athalye et al., 2018). We build on these best practices by showing how to choose and calibrate a diverse set of unforeseen attacks. Our work is a supplement to existing practices, not a replacement–we strongly recommend following the guidelines in Papernot et al. (2017) and Athalye et al. (2018) in addition to our recommendations.
159
+
160
+ Some caution is necessary when interpreting specific numeric results in our paper. Many previous implementations of adversarial training fell prone to gradient masking (Papernot et al., 2017; Engstrom et al., 2018), with apparently successful training occurring only recently (Madry et al., 2017; Xie et al., 2018). While evaluating with moderately many PGD steps (200) helps guard against this, (Qian & Wegman, 2019) shows that an $L _ { \infty }$ -trained model that appeared robust against $L _ { 2 }$ actually had substantially less robustness when evaluating with $1 0 ^ { 6 }$ PGD steps. If this effect is pervasive, then there may be even less transfer between attacks than our current results suggest.
161
+
162
+ For evaluating against a fixed attack, DeepFool Moosavi-Dezfooli et al. (2015) and CLEVER Weng et al. (2018) can be seen as existing alternatives to UAR. They work by estimating “empirical robustness”, which is the expected minimum $\varepsilon$ needed to successfully attack an image. However, these apply only to attacks which optimize over an $L _ { p }$ -ball of radius $\varepsilon$ , and CLEVER can be susceptible to gradient masking Goodfellow (2018). In addition, empirical robustness is equivalent to linearly averaging accuracy over $\varepsilon$ , which has smaller dynamic range than the geometric average in UAR.
163
+
164
+ Our results add to a growing line of evidence that evaluating against a single known attack type provides a misleading picture of the robustness of a model (Sharma & Chen, 2017; Engstrom et al., 2017; Jordan et al., 2019; Tramer & Boneh, 2019; Jacobsen et al., 2019). Going one step further, \` we believe that robustness itself provides only a narrow window into model behavior; in addition to robustness, we should seek to build a diverse toolbox for understanding machine learning models, including visualization (Olah et al., 2018; Zhang & Zhu, 2019), disentanglement of relevant features (Geirhos et al., 2018), and measurement of extrapolation to different datasets (Torralba & Efros, 2011) or the long tail of natural but unusual inputs (Hendrycks et al., 2019). Together, these windows into model behavior can give us a clearer picture of how to make models reliable in the real world.
165
+
166
+ # REFERENCES
167
+
168
+ Anish Athalye, Logan Engstrom, Andrew Ilyas, and Kevin Kwok. Synthesizing robust adversarial examples. CoRR, abs/1707.07397, 2017. URL http://arxiv.org/abs/1707.07397.
169
+
170
+ Anish Athalye, Nicholas Carlini, and David Wagner. Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples. arXiv preprint arXiv:1802.00420, 2018.
171
+
172
+ Tom B. Brown, Dandelion Mane, Aurko Roy, Mart ´ ´ın Abadi, and Justin Gilmer. Adversarial patch. CoRR, abs/1712.09665, 2017. URL http://arxiv.org/abs/1712.09665.
173
+
174
+ Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In 2017 IEEE Symposium on Security and Privacy (SP), pp. 39–57. IEEE, 2017.
175
+
176
+ Nicholas Carlini, Anish Athalye, Nicolas Papernot, Wieland Brendel, Jonas Rauber, Dimitris Tsipras, Ian J. Goodfellow, Aleksander Madry, and Alexey Kurakin. On evaluating adversarial robustness. CoRR, abs/1902.06705, 2019. URL http://arxiv.org/abs/1902.06705.
177
+
178
+ Pin-Yu Chen, Yash Sharma, Huan Zhang, Jinfeng Yi, and Cho-Jui Hsieh. EAD: Elastic-net attacks to deep neural networks via adversarial examples. In Thirty-second AAAI conference on artificial intelligence, 2018.
179
+
180
+ Kenneth T. Co, Luis Munoz-Gonz ˜ alez, and Emil C. Lupu. Sensitivity of deep convolutional net- ´ works to Gabor noise. CoRR, abs/1906.03455, 2019. URL http://arxiv.org/abs/ 1906.03455.
181
+
182
+ Francesco Croce and Matthias Hein. Provable robustness against all adversarial $l _ { p }$ -perturbations for $p \geq 1$ . CoRR, abs/1905.11213, 2019. URL http://arxiv.org/abs/1905.11213.
183
+
184
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. ImageNet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248–255. IEEE, 2009.
185
+
186
+ Logan Engstrom, Brandon Tran, Dimitris Tsipras, Ludwig Schmidt, and Aleksander Madry. A rotation and a translation suffice: Fooling CNNs with simple transformations. arXiv preprint arXiv:1712.02779, 2017.
187
+
188
+ Logan Engstrom, Andrew Ilyas, and Anish Athalye. Evaluating and understanding the robustness of adversarial logit pairing. arXiv preprint arXiv:1807.10272, 2018.
189
+
190
+ Nic Ford, Justin Gilmer, Nicolas Carlini, and Dogus Cubuk. Adversarial examples are a natural consequence of test error in noise. arXiv preprint arXiv:1901.10513, 2019.
191
+
192
+ Marguerite Frank and Philip Wolfe. An algorithm for quadratic programming. Naval research logistics quarterly, 3(1-2):95–110, 1956.
193
+
194
+ 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. CoRR, abs/1811.12231, 2018. URL http://arxiv.org/ abs/1811.12231.
195
+
196
+ Ian Goodfellow. Gradient masking causes CLEVER to overestimate adversarial perturbation size. arXiv preprint arXiv:1804.07870, 2018.
197
+
198
+ Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
199
+
200
+ Priya Goyal, Piotr Dollar, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, An- ´ drew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch SGD: Training ImageNet in 1 hour. arXiv preprint arXiv:1706.02677, 2017.
201
+
202
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In European conference on computer vision, pp. 630–645. Springer, 2016.
203
+
204
+ Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In International Conference on Learning Representations, 2019.
205
+
206
+ Dan Hendrycks, Kevin Zhao, Steven Basart, Jacob Steinhardt, and Dawn Song. Natural adversarial examples. arXiv preprint arXiv:1907.07174, 2019.
207
+
208
+ Jrn-Henrik Jacobsen, Jens Behrmannn, Nicholas Carlini, Florian Tramr, and Nicolas Papernot. Exploiting excessive invariance caused by norm-bounded adversarial robustness, 2019.
209
+
210
+ Matt Jordan, Naren Manoj, Surbhi Goel, and Alexandros G. Dimakis. Quantifying perceptual distortion of adversarial examples. arXiv e-prints, art. arXiv:1902.08265, Feb 2019.
211
+
212
+ Ares Lagae, Sylvain Lefebvre, George Drettakis, and Philip Dutre. Procedural noise using sparse ´ Gabor convolution. ACM Trans. Graph., 28(3):54:1–54:10, July 2009. ISSN 0730-0301. doi: 10. 1145/1531326.1531360. URL http://doi.acm.org/10.1145/1531326.1531360.
213
+
214
+ Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. arXiv preprint arXiv:1706.06083, 2017.
215
+
216
+ Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, and Pascal Frossard. DeepFool: a simple and accurate method to fool deep neural networks. arXiv preprint arXiv:1511.04599, 2015.
217
+
218
+ Arkadi Nemirovski and D Yudin. On Cezari’s convergence of the steepest descent method for approximating saddle point of convex-concave functions. In Soviet Math. Dokl, volume 19, pp. 258–269, 1978.
219
+
220
+ Arkadi Nemirovski and D Yudin. Problem Complexity and Method Efficiency in Optimization. Intersci. Ser. Discrete Math. Wiley, New York, 1983.
221
+
222
+ Chris Olah, Arvind Satyanarayan, Ian Johnson, Shan Carter, Ludwig Schubert, Katherine Ye, and Alexander Mordvintsev. The building blocks of interpretability. Distill, 2018. doi: 10.23915/ distill.00010. https://distill.pub/2018/building-blocks.
223
+
224
+ Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z Berkay Celik, and Ananthram Swami. Practical black-box attacks against machine learning. In Proceedings of the 2017 ACM on Asia conference on computer and communications security, pp. 506–519. ACM, 2017.
225
+
226
+ Haifeng Qian and Mark N. Wegman. $L _ { 2 }$ -nonexpansive neural networks. In International Conference on Learning Representations (ICLR), 2019. URL https://openreview.net/forum? id $=$ ByxGSsR9FQ.
227
+
228
+ Yash Sharma and Pin-Yu Chen. Attacking the Madry defense model with $L _ { 1 }$ -based adversarial examples. arXiv e-prints, art. arXiv:1710.10733, Oct 2017.
229
+
230
+ Richard Shin and Dawn Song. JPEG-resistant adversarial images. In NIPS 2017 Workshop on Machine Learning and Computer Security, 2017.
231
+
232
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013.
233
+
234
+ Antonio Torralba and Alexei A. Efros. Unbiased look at dataset bias. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2011.
235
+
236
+ Florian Tramer and Dan Boneh. Adversarial training and robustness for multiple perturbations. \` arXiv e-prints, art. arXiv:1904.13000, Apr 2019.
237
+
238
+ Igor Vasiljevic, Ayan Chakrabarti, and Gregory Shakhnarovich. Examining the impact of blur on recognition by convolutional networks. CoRR, abs/1611.05760, 2016. URL http://arxiv. org/abs/1611.05760.
239
+
240
+ 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. arXiv preprint arXiv:1801.10578, 2018.
241
+
242
+ Chaowei Xiao, Jun-Yan Zhu, Bo Li, Warren He, Mingyan Liu, and Dawn Song. Spatially transformed adversarial examples. arXiv preprint arXiv:1801.02612, 2018.
243
+
244
+ Cihang Xie, Yuxin Wu, Laurens van der Maaten, Alan Yuille, and Kaiming He. Feature denoising for improving adversarial robustness. arXiv preprint arXiv:1812.03411, 2018.
245
+
246
+ Tianyuan Zhang and Zhanxing Zhu. Interpreting adversarially trained convolutional neural networks. In International Conference on Machine Learning (ICML), 2019.
247
+
248
+ # A TRAINING HYPERPARAMETERS
249
+
250
+ For ImageNet-100, we trained on machines with 8 NVIDIA V100 GPUs using standard data augmentation He et al. (2016). Following best practices for multi-GPU training Goyal et al. (2017), we ran synchronized SGD for 90 epochs with batch size $3 2 \times 8$ and a learning rate schedule with 5 “warm-up” epochs and a decay at epochs 30, 60, and 80 by a factor of 10. Initial learning rate after warm-up was 0.1, momentum was 0.9, and weight decay was $1 0 ^ { - 4 }$ . For CIFAR-10, we trained on a single NVIDIA V100 GPU for 200 epochs with batch size 32, initial learning rate 0.1, momentum 0.9, and weight decay $1 0 ^ { - 4 }$ . We decayed the learning rate at epochs 100 and 150.
251
+
252
+ # B FURTHER ATTACK DETAILS
253
+
254
+ # B.1 FURTHER EXAMPLES OF ATTACKS
255
+
256
+ We show the images corresponding to the ones in Figure 2, with the exception that they are not scaled. The non-scaled images are shown in Figure 9.
257
+
258
+ # B.2 $L _ { 1 }$ ATTACK
259
+
260
+ We chose to use the Frank-Wolfe algorithm for optimizing the $L _ { 1 }$ attack, as Projected Gradient Descent would require projecting onto a truncated $L _ { 1 }$ ball, which is a complicated operation. In contrast, Frank-Wolfe only requires optimizing linear functions $g ^ { \top } x$ over a truncated $L _ { 1 }$ ball; this can be done by sorting coordinates by the magnitude of $g$ and moving the top $k$ coordinates to the boundary of their range (with $k$ chosen by binary search). This is detailed in Algorithm 1.
261
+
262
+ # C FULL EVALUATION RESULTS
263
+
264
+ # C.1 $L _ { 1 }$ -JPEG AND $L _ { 2 }$ -JPEG ATTACKS
265
+
266
+ We will present results with two additional versions of the JPEG attack which impose $L _ { 1 }$ or $L _ { 2 }$ constraints on the attack in JPEG-space instead of the $L _ { \infty }$ constraint discussed in Section 2. To avoid confusion, in this appendix, we denote the original JPEG attack by $L _ { \infty }$ -JPEG and these variants by $L _ { 1 }$ -JPEG and $L _ { 2 }$ -JPEG, respectively. Comparing the $L _ { 1 }$ -JPEG and $L _ { 2 }$ -JPEG attacks in Figure 10,
267
+
268
+ ![](images/4ac5967c0d22dc79a6ede0c106dbea07c0ee35bc92400d42a1b2854bac17752a.jpg)
269
+ Figure 9: Differences of the attacked images and original image for different attacks (label “espresso maker”). The $L _ { 1 }$ , $L _ { 2 }$ , and $L _ { \infty }$ norms of the difference are shown in parentheses. As shown, our novel attacks display qualitatively different behavior and do not fall under the $L _ { p }$ threat model. These differences are not scaled and are normalized so that no difference corresponds to white.
270
+
271
+ 1: Input: function $f$ , initial input $x \in [ 0 , 1 ] ^ { d }$ , $L _ { 1 }$ radius $\rho$ , number of steps $T$ .
272
+ 2: Output: approximate maximizer $\bar { x }$ of $f$ over the truncated $L _ { 1 }$ ball $\mathring { B _ { 1 } } ( \rho ; x ) \cap [ 0 , 1 ] ^ { d }$ centered
273
+ at $x$ .
274
+ 3:
275
+ 4: $x ^ { ( 0 ) } \gets \mathrm { R a n d o m I n i t } ( x )$ . Random initialization
276
+ 5: for $t = 1 , \dots , T$ do
277
+ 6: g f (x(t−1)) . Obtain gradient
278
+ 7: for $k = 1 , \ldots , d { \mathrm { } } $ do
279
+ 8: $s _ { k } \gets$ index of the coordinate of $g$ by with $k ^ { \mathrm { { t h } } }$ largest norm
280
+ 9: end for
281
+ 10: $S _ { k } \gets \{ s _ { 1 } , \ldots , s _ { k } \} .$
282
+ 11:
283
+ 12: for $i = 1 , \ldots , d$ do . Compute move to boundary of $[ 0 , 1 ]$ for each coordinate.
284
+ 13: if $g _ { i } > 0$ then
285
+ 14: $b _ { i } \gets 1 - x _ { i }$
286
+ 15: else
287
+ 16: $b _ { i } \gets - x _ { i }$
288
+ 17: end if
289
+ 18: end for
290
+ 19: $\begin{array} { r l } & { M _ { k } \gets \sum _ { i \in S _ { k } } | b _ { i } | } \\ & { k ^ { * } \gets \operatorname* { m a x } \{ k \mid M _ { k } \leq \rho \} } \end{array}$ . Compute $L _ { 1 }$ -perturbation of moving $k$ largest coordinates.
291
+ 20: $\triangleright$ Choose largest $k$ satisfying $L _ { 1 }$ constraint.
292
+ 21: for i = 1, . . . , d do $\triangleright$ Compute $\hat { x }$ maximizing $g ^ { \top } x$ over the $L _ { 1 }$ ball.
293
+ 22: if $i \in S _ { k ^ { * } }$ then
294
+ 23: xˆi ← xi + bi
295
+ 24: else if $i = s _ { k ^ { * } + 1 }$ then
296
+ 25: $\hat { x } _ { i } \gets x _ { i } + ( \rho - M _ { k ^ { * } } ) \operatorname { s i g n } ( g _ { i } )$
297
+ 26: else
298
+ 27: $\hat { x } _ { i } \gets x _ { i }$
299
+ 28: end if
300
+ 29: end for
301
+ 30: $\begin{array} { r } { x ^ { ( t ) } ( 1 - \frac { 1 } { t } ) x ^ { ( t - 1 ) } + \frac { 1 } { t } \hat { x } } \end{array}$ . Average $\hat { x }$ with previous iterates
302
+ 31: end for
303
+ 32: x¯ x(T)
304
+
305
+ Algorithm 1 Pseudocode for the Frank-Wolfe algorithm for the $L _ { 1 }$ attack.
306
+ Table 2: ATA values for $L _ { 1 }$ -JPEG and $L _ { 2 }$ -JPEG on ImageNet-100.
307
+
308
+ <table><tr><td>Attack</td><td>E1</td><td>E2</td><td>3</td><td>E4</td><td>5</td><td>6</td><td>ATA1</td><td>ATA2</td><td>ATA3</td><td>ATA4</td><td>ATA5</td><td>ATA6</td></tr><tr><td>L2-JPEG</td><td>8</td><td>16</td><td>32</td><td>64</td><td>128</td><td>256</td><td>84.8</td><td>82.5</td><td>78.9</td><td>72.3</td><td>47.5</td><td>3.4</td></tr><tr><td>L1-JPEG</td><td>256</td><td></td><td>10244096</td><td>16384</td><td>65536</td><td>131072</td><td>84.8</td><td>81.8</td><td>76.2</td><td>67.1</td><td>46.4</td><td>41.8</td></tr></table>
309
+
310
+ we find that they have extremely similar results, so we omit $L _ { 1 }$ -JPEG in the full analysis for brevity and visibility. Calibration values for these attacks are shown in Table 2.
311
+
312
+ # C.2 FULL EVALUATION RESULTS AND ANALYSIS FOR IMAGENET-100
313
+
314
+ We show the full results of all adversarial attacks against all adversarial defenses for ImageNet-100 in Figure 11. As described, the $L _ { p }$ attacks and defenses give highly correlated information on heldout defenses and attacks respectively. Thus, we recommend evaluating on a wide range of distortion types. Full UAR scores are also provided for ImageNet-100 in Figure 12.
315
+
316
+ We further show selected results in Figure 13. As shown, a wide range of $\varepsilon$ is required to see the full behavior.
317
+
318
+ ![](images/866c62ff7619934861f9400f7e14b3b781a41eb94b70cee2d5971c263865942b.jpg)
319
+ Figure 10: A comparison of $L _ { 1 }$ -JPEG and $L _ { 2 }$ -JPEG attacks.
320
+
321
+ ![](images/15ed640f6afd9cfaf42a569f89e9649ba332000d32eca1facb3c4af57d24a7cf.jpg)
322
+
323
+ ![](images/f208902da7d75877a22d62981b6b41193b92a5ec6dc3950879f712a5112d524c.jpg)
324
+ Figure 12: UAR scores (multiplied by 100) for adv. trained defenses (rows) against distortion types (columns) for ImageNet-100.
325
+
326
+ ![](images/8521503b091168c4a6dbf8cb92a07c7ed673d88fd7aacaa4ce1797d67781bbff.jpg)
327
+ Figure 13: Adversarial accuracies of attacks on adversarially trained models for different distortion sizes on ImageNet-100. For a given attack $\varepsilon$ , the best $\varepsilon ^ { \prime }$ to train against satisfies $\varepsilon ^ { \prime } > \varepsilon$ because the random scaling of $\varepsilon ^ { \prime }$ during adversarial training ensures that a typical distortion during adversarial training has size smaller than $\varepsilon ^ { \prime }$ .
328
+
329
+ # C.3 FULL EVALUATION RESULTS AND ANALYSIS FOR CIFAR-10
330
+
331
+ # C.3.1 FULL RESULTS FOR CIFAR10
332
+
333
+ We show the results of adversarial attacks and defenses for CIFAR-10 in Figure 14. We experienced difficulty training the $L _ { 2 }$ and $L _ { 1 }$ attacks at distortion sizes greater than those shown and have omitted those runs, which we believe may be related to the small size of CIFAR-10 images.
334
+
335
+ # C.3.2 ATA AND UAR FOR CIFAR-10
336
+
337
+ The $\varepsilon$ calibration procedure for CIFAR-10 was similar to that used for ImageNet-100. We started with the perceptually small $\varepsilon _ { \mathrm { { m i n } } }$ values in Table 3 and increased $\varepsilon$ geometrically with ratio 2 until adversarial accuracy of an adversarially trained model dropped below 40. Note that this threshold is higher for CIFAR-10 because there are fewer classes. The resulting ATA and UAR values for CIFAR10 are shown in Table 3 and Figure 15. We omitted calibration for the $L _ { 2 }$ -JPEG attack because we chose too small a range of $\varepsilon$ for our initial training experiments, and we plan to address this issue in the future.
338
+
339
+ Table 3: Calibrated distortion sizes and ATA values for ResNet-56 on CIFAR-10
340
+
341
+ <table><tr><td>Attack</td><td>1</td><td>£2</td><td>3</td><td>E4</td><td>ε5</td><td>6</td><td>ATA1</td><td>ATA2</td><td>ATA3</td><td>ATA4</td><td>ATA5</td><td>ATA6</td></tr><tr><td>L8</td><td>1</td><td>2</td><td>4</td><td>8</td><td>16</td><td>32</td><td>91.0</td><td>87.8</td><td>81.6</td><td>71.3</td><td>46.5</td><td>23.1</td></tr><tr><td>L2</td><td>40</td><td>80</td><td>160</td><td>320</td><td>640</td><td>2560</td><td>90.1</td><td>86.4</td><td>79.6</td><td>67.3</td><td>49.9</td><td>17.3</td></tr><tr><td>L1</td><td>195</td><td>390</td><td>780</td><td>1560</td><td></td><td>6240 24960</td><td>92.2</td><td>90.0</td><td>83.2</td><td>73.8</td><td>47.4</td><td>35.3</td></tr><tr><td>L-JPEG 0.03125 0.0625 0.125 0.25</td><td></td><td></td><td></td><td></td><td>0.5</td><td>1</td><td>89.7</td><td>87.0</td><td>83.1</td><td>78.6</td><td>69.7</td><td>35.4</td></tr><tr><td>L1-JPEG</td><td>2</td><td>8</td><td>64</td><td>256</td><td>512</td><td>1024</td><td>91.4</td><td>88.1</td><td>80.2</td><td>68.9</td><td>56.3</td><td>37.7</td></tr><tr><td>Elastic</td><td>0.125</td><td>0.25</td><td>0.5</td><td>1</td><td>2</td><td>8</td><td>87.4</td><td>81.3</td><td>72.1</td><td>58.2</td><td>45.4</td><td>27.8</td></tr></table>
342
+
343
+ # D ROBUSTNESS OF OUR RESULTS
344
+
345
+ # D.1 REPLICATION
346
+
347
+ We replicated our results for the first three rows of Figure 11 with different random seeds to see the variation in our results. As shown in Figure 16, deviations in results are minor.
348
+
349
+ # D.2 CONVERGENCE
350
+
351
+ We replicated the results in Figure 11 with 50 instead of 200 steps to see how the results changed based on the number of steps in the attack. As shown in Figure 17, the deviations are minor.
352
+
353
+ # E FURTHER RESULTS FOR JOINT TRAINING
354
+
355
+ # E.1 FULL EXPERIMENTAL RESULTS
356
+
357
+ We show the evaluation accuracies of jointly trained models in Figure 18.
358
+
359
+ We show all the attacks against the jointly adversarially trained defenses in Figure 19.
360
+
361
+ # E.2 DEPENDENCE ON RANDOM SEED
362
+
363
+ In Table 4, we study the dependence of joint adversarial training to random seed. We find that at large distortion sizes, joint training for certain pairs of distortions does not produce consistent results over different random initializations.
364
+
365
+ Table 4: Train and val accuracies for joint adversarial training at large distortion are dependent on seed. For train and val, $\varepsilon ^ { \prime }$ is chosen uniformly at random between 0 and $\varepsilon$ , and we used 10 steps for $L _ { \infty }$ and $L _ { 1 }$ and 30 steps for elastic. Single adversarial training baselines are also shown.
366
+
367
+ <table><tr><td>Training parameters (ResNet-50)</td><td>Loo train</td><td>other train</td><td>Loval</td><td>other val</td></tr><tr><td>Lε=8,Elasticε=4,Seed1</td><td>90</td><td>89</td><td>35</td><td>74</td></tr><tr><td>Lε=8,Elastic ε=4,Seed 2</td><td>89</td><td>90</td><td>47</td><td>44</td></tr><tr><td>Lε=8,Elastic ε=4,Seed 3</td><td>90</td><td>89</td><td>29</td><td>63</td></tr><tr><td>Loε=16,L1ε=612000,Seed1</td><td>86</td><td>87</td><td>22</td><td>16</td></tr><tr><td>Loε=16,L1ε=612000,Seed 2</td><td>88</td><td>87</td><td>16</td><td>24</td></tr><tr><td>Lε=8</td><td>81</td><td>1</td><td>74</td><td>1</td></tr><tr><td>L∞ε=16</td><td>68</td><td>1</td><td>63</td><td>1</td></tr><tr><td>Elastic ε=4</td><td>1</td><td>88</td><td>1</td><td>76</td></tr><tr><td>L1ε= 612000</td><td>1</td><td>75</td><td>1</td><td>59</td></tr></table>
368
+
369
+ Table 5: Training and validation numbers for ResNet-101 and ResNet-50 for joint training against $L _ { \infty }$ , $\varepsilon = 8$ and elastic, $\varepsilon = 4$ .
370
+
371
+ <table><tr><td>Trainingparameters</td><td>L train</td><td>other train</td><td>Looval</td><td>other val</td></tr><tr><td>Lε= 8,Elastic ε = 4,ResNet-50 Seed 1</td><td>90</td><td>89</td><td>35</td><td>74</td></tr><tr><td>Lε= 8,Elastic ε = 4,ResNet-50 Seed 2</td><td>89</td><td>90</td><td>47</td><td>44</td></tr><tr><td>Lε= 8,Elastic ε= 4 ResNet-101</td><td>90</td><td>91</td><td>49</td><td>46</td></tr></table>
372
+
373
+ # E.3 OVERFITTING AND MODEL CAPACITY
374
+
375
+ As a first test to understand the relationship between model capacity and overfitting, we trained ResNet-101 models using the same procedure as in Section 5. Briefly, overfitting still occurs, but ResNet-101 achieves a few percentage points higher than ResNet-50.
376
+
377
+ We show the training curves in Figure 20 and the training and validation numbers in Table 5.
378
+
379
+ # F COMPARING ADVERSARIAL DISTORTIONS AND COMMON CORRUPTIONS
380
+
381
+ “Common” visual corruptions such as (non-adversarial) fog, blur, or pixelation have emerged as another avenue for measuring the robustness of computer vision models (Vasiljevic et al., 2016; Hendrycks & Dietterich, 2019; Geirhos et al., 2018). Recent work suggests that robustness to such common corruptions is linked to adversarial robustness and proposes corruption robustness as an easily computed indicator of adversarial robustness (Ford et al., 2019). We consider this alternative to our methodology by testing corruption robustness of our models on the ImageNet-C benchmark.
382
+
383
+ Experimental setup. We evaluate on the 100-class subset of the corruption robustness benchmark ImageNet-C introduced in (Hendrycks & Dietterich, 2019) with the same classes as ImageNet-100, which we call ImageNet-C-100. It is the ImageNet-100 validation set with 19 common corruptions at 5 severities. We use the JPEG files available at https://github.com/hendrycks/ robustness. We show average accuracies by distortion type in Figure 21.
384
+
385
+ Adversarial training against small distortions increases corruption robustness. The first column of each block in Figure 21 shows that training against small adversarial distortions generally increases average accuracy compared to an undefended model. However, training against larger distortions often decreases average accuracy, largely due to the resulting decrease in clean accuracy.
386
+
387
+ Adversarial distortions and common corruptions can affect defenses differently. Our $L _ { p }$ -JPEG and elastic attacks are adversarial versions of the corresponding common corruptions. While training against adversarial JPEG at larger $\varepsilon$ improves robustness against adversarial JPEG attacks (Figure 12 in Appendix C.2), Figure 21 shows that robustness against common JPEG corruptions decreases as we adversarially train against JPEG at larger $\varepsilon$ , though it remains better than for normally trained models. Similarly, adversarial Elastic training at large $\varepsilon$ begins to hurt robustness to its common counterpart. This is likely because common corruptions are easier than adversarial distortions, hence the increased robustness does not make up for the decreased clean accuracy.
388
+
389
+ # G ATTACKS AGAINST UNDEFENDED MODELS
390
+
391
+ We show sample images of our attacks against undefended models trained in the normal way in Figure 22.
392
+
393
+ ![](images/b5b8f6b51871c6a0f11fb44cfefdc1dea2a5dd2db4a4d0c28fe23116677a6a26.jpg)
394
+
395
+ ![](images/0c4e73dc2723aa7c3ff293a9a09c0b880a5c6c3f7550840ab4050ca4c424aaac.jpg)
396
+ Figure 15: UAR scores on CIFAR-10. Displayed UAR scores are multiplied by 100 for clarity.
397
+
398
+ ![](images/65f7ff576df4174255ea289276b086b77df68cad821a354c04d96e086f25d260.jpg)
399
+ Figure 16: Replica of the first three block rows of Figure 11 with different random seeds. Deviations in results are minor.
400
+
401
+ ![](images/6d1496d4291d97b42becddbf4d3547aa618349688b1e535c348aeaebda6c32e3.jpg)
402
+
403
+ ![](images/ded149cae3872a9d542dd33f0b1c5c0b791035dd74d30e540c63c3cea29598ee.jpg)
404
+ Figure 18: Evaluation accuracies of jointly trained models. Attack and training $\varepsilon$ values are equal.
405
+
406
+ ![](images/40e99c031d044efe49fd15d28bbe5c484490bfc2d61019c7bed9bf530aa7f0cc.jpg)
407
+ Figure 19: All attacks (columns) vs. jointly adversarially trained defense (rows).
408
+
409
+ ![](images/a7e7161e19fc6c98cc3b875c7e4cf96613fdeb7b1a7e9ce0a6a179944c8a7ed9.jpg)
410
+ Figure 20: Train and validation curves for joint training against $L _ { \infty }$ , $\varepsilon = 4$ and elastic, $\varepsilon = 8$ using ResNet-101. As shown, the validation accuracies decrease as training progresses, indicating overfitting.
411
+
412
+ ![](images/aed8ae41d6c19ccf263818714ff2666fa1ad3c9fff93218a083dd2377626c5ac.jpg)
413
+ Figure 21: Accuracies of defenses (rows) on ImageNet-C-100 corruptions (columns).
414
+
415
+ ![](images/ba71eedb6d42fa3e008d3220da4fc4756004f0e059682f5d6fef415a5e30e90e.jpg)
416
+ Figure 22: Adversarial attacks at low distortion sizes $\varepsilon$ against an undefended model. The pair of (ε, accuracy) is shown after the attack name. Visual differences between the original and attacked images are imperceptible for $L _ { \infty }$ , $L _ { 2 }$ , and JPEG, minor for $L _ { 1 }$ , Elastic, and Gabor, and weatherrelated for Fog and Snow.
md/train/HyxzRsR9Y7/HyxzRsR9Y7.md ADDED
@@ -0,0 +1,417 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING SELF-IMITATING DIVERSE POLICIES
2
+
3
+ Tanmay Gangwani Dept. of Computer Science UIUC gangwan2@uiuc.edu
4
+
5
+ Qiang Liu
6
+ Dept. of Computer Science UT Austin
7
+ lqiang@cs.utexas.edu Jian Peng
8
+ Dept. of Computer Science UIUC
9
+ jianpeng@uiuc.edu
10
+
11
+ # ABSTRACT
12
+
13
+ The success of popular algorithms for deep reinforcement learning, such as policygradients and Q-learning, relies heavily on the availability of an informative reward signal at each timestep of the sequential decision-making process. When rewards are only sparsely available during an episode, or a rewarding feedback is provided only after episode termination, these algorithms perform sub-optimally due to the difficultly in credit assignment. Alternatively, trajectory-based policy optimization methods, such as cross-entropy method and evolution strategies, do not require per-timestep rewards, but have been found to suffer from high sample complexity by completing forgoing the temporal nature of the problem. Improving the efficiency of RL algorithms in real-world problems with sparse or episodic rewards is therefore a pressing need. In this work, we introduce a self-imitation learning algorithm that exploits and explores well in the sparse and episodic reward settings. We view each policy as a state-action visitation distribution and formulate policy optimization as a divergence minimization problem. We show that with Jensen-Shannon divergence, this divergence minimization problem can be reduced into a policy-gradient algorithm with shaped rewards learned from experience replays. Experimental results indicate that our algorithm works comparable to existing algorithms in environments with dense rewards, and significantly better in environments with sparse and episodic rewards. We then discuss limitations of self-imitation learning, and propose to solve them by using Stein variational policy gradient descent with the Jensen-Shannon kernel to learn multiple diverse policies. We demonstrate its effectiveness on a challenging variant of continuous-control MuJoCo locomotion tasks.
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ Deep reinforcement learning (RL) has demonstrated significant applicability and superior performance in many problems outside the reach of traditional algorithms, such as computer and board games (Mnih et al., 2015; Silver et al., 2016), continuous control (Lillicrap et al., 2015), and robotics (Levine et al., 2016). Using deep neural networks as functional approximators, many classical RL algorithms have been shown to be very effective in solving sequential decision problems. For example, a policy that selects actions under certain state observation can be parameterized by a deep neural network that takes the current state observation as input and gives an action or a distribution over actions as output. Value functions that take both state observation and action as inputs and predict expected future reward can also be parameterized as neural networks. In order to optimize such neural networks, policy gradient methods (Mnih et al., 2016; Schulman et al., 2015; 2017a) and Q-learning algorithms (Mnih et al., 2015) capture the temporal structure of the sequential decision problem and decompose it to a supervised learning problem, guided by the immediate and discounted future reward from rollout data.
18
+
19
+ Unfortunately, when the reward signal becomes sparse or delayed, these RL algorithms may suffer from inferior performance and inefficient sample complexity, mainly due to the scarcity of the immediate supervision when training happens in single-timestep manner. This is known as the temporal credit assignment problem (Sutton, 1984). For instance, consider the Atari Montezuma’s revenge game – a reward is received after collecting certain items or arriving at the final destination in the lowest level, while no reward is received as the agent is trying to reach these goals. The sparsity of the reward makes the neural network training very inefficient and also poses challenges in exploration. It is not hard to see that many of the real-world problems tend to be of the form where rewards are either only sparsely available during an episode, or the rewards are episodic, meaning that a non-zero reward is only provided at the end of the trajectory or episode.
20
+
21
+ In addition to policy-gradient and Q-learning, alternative algorithms, such as those for global- or stochastic-optimization, have recently been studied for policy search. These algorithms do not decompose trajectories into individual timesteps, but instead apply zeroth-order finite-difference gradient or gradient-free methods to learn policies based on the cumulative rewards of the entire trajectory. Usually, trajectory samples are first generated by running the current policy and then the distribution of policy parameters is updated according to the trajectory-returns. The cross-entropy method (CEM, Rubinstein & Kroese (2016)) and evolution strategies (Salimans et al., 2017) are two nominal examples. Although their sample efficiency is often not comparable to the policy gradient methods when dense rewards are available from the environment, they are more widely applicable in the sparse or episodic reward settings as they are agnostic to task horizon, and only the trajectorybased cumulative reward is needed.
22
+
23
+ Our contribution is the introduction of a new algorithm based on policy-gradients, with the objective of achieving better performance than existing RL algorithms in sparse and episodic reward settings. Using the equivalence between the policy function and its state-action visitation distribution, we formulate policy optimization as a divergence minimization problem between the current policy’s visitation and the distribution induced by a set of experience replay trajectories with high returns. We show that with the Jensen-Shannon divergence $( D _ { J S } )$ , this divergence minimization problem can be reduced into a policy-gradient algorithm with shaped, dense rewards learned from these experience replays. This algorithm can be seen as self-imitation learning, in which the expert trajectories in the experience replays are self-generated by the agent during the course of learning, rather than using some external demonstrations. We combine the divergence minimization objective with the standard RL objective, and empirically show that the shaped, dense rewards significantly help in sparse and episodic settings by improving credit assignment. Following that, we qualitatively analyze the shortcomings of the self-imitation algorithm. Our second contribution is the application of Stein variational policy gradient (SVPG) with the Jensen-Shannon kernel to simultaneously learn multiple diverse policies. We demonstrate the benefits of this addition to the self-imitation framework by considering difficult exploration tasks with sparse and deceptive rewards.
24
+
25
+ Related Works. Divergence minimization has been used in various policy learning algorithms. Relative Entropy Policy Search (REPS) (Peters et al., 2010) restricts the loss of information between policy updates by constraining the KL-divergence between the state-action distribution of old and new policy. Policy search can also be formulated as an EM problem, leading to several interesting algorithms, such as RWR (Peters & Schaal, 2007) and PoWER (Kober & Peters, 2009). Here the M-step minimizes a KL-divergence between trajectory distributions, leading to an update rule which resembles return-weighted imitation learning. Please refer to Deisenroth et al. (2013) for a comprehensive exposition. MATL (Wulfmeier et al., 2017) uses adversarial training to bring state occupancy from a real and simulated agent close to each other for efficient transfer learning. In Guided Policy Search (GPS, Levine & Koltun (2013)), a parameterized policy is trained by constraining the divergence between the current policy and a controller learnt via trajectory optimization.
26
+
27
+ Learning from Demonstrations (LfD). The objective in LfD, or imitation learning, is to train a control policy to produce a trajectory distribution similar to the demonstrator. Approaches for self-driving cars (Bojarski et al., 2016) and drone manipulation (Ross et al., 2013) have used human-expert data, along with Behavioral Cloning algorithm to learn good control policies. Deep Q-learning has been combined with human demonstrations to achieve performance gains in Atari (Hester et al., 2017) and robotics tasks (Vecer ˇ ´ık et al., 2017; Nair et al., 2017). Human data has also been used in the maximum entropy IRL framework to learn cost functions under which the demonstrations are optimal (Finn et al., 2016). Ho & Ermon (2016) use the same framework to derive an imitation-learning algorithm (GAIL) which is motivated by minimizing the divergence between agent’s rollouts and external expert demonstrations. Besides humans, other sources of expert supervision include planningbased approaches such as iLQR (Levine et al., 2016) and MCTS (Silver et al., 2016). Our algorithm departs from prior work in forgoing external supervision, and instead using the past experiences of the learner itself as demonstration data.
28
+
29
+ Exploration and Diversity in RL. Count-based exploration methods utilize state-action visitation counts $N ( s , a )$ , and award a bonus to rarely visited states (Strehl & Littman, 2008). In large statespaces, approximation techniques (Tang et al., 2017), and estimation of pseudo-counts by learning density models (Bellemare et al., 2016; Fu et al., 2017) has been researched. Intrinsic motivation has been shown to aid exploration, for instance by using information gain (Houthooft et al., 2016) or prediction error (Stadie et al., 2015) as a bonus. Hindsight Experience Replay (Andrychowicz et al., 2017) adds additional goals (and corresponding rewards) to a Q-learning algorithm. We also obtain additional rewards, but from a discriminator trained on past agent experiences, to accelerate a policy-gradient algorithm. Prior work has looked at training a diverse ensemble of agents with good exploratory skills (Liu et al., 2017; Conti et al., 2017; Florensa et al., 2017). To enjoy the benefits of diversity, we incorporate a modification of SVPG (Liu et al., 2017) in our final algorithm.
30
+
31
+ In very recent work, Oh et al. (2018) propose exploiting past good trajectories to drive exploration. Their algorithm buffers $( s , a )$ and the corresponding return for each transition in rolled trajectories, and reuses them for training if the stored return value is higher than the current state-value estimate. Our approach presents a different objective for self-imitation based on divergence-minimization. With this view, we learn shaped, dense rewards which are then used for policy optimization. We further improve the algorithm with SVPG. Reusing high-reward trajectories has also been explored for program synthesis and semantic parsing tasks (Liang et al., 2016; 2018; Abolafia et al., 2018).
32
+
33
+ # 2 MAIN METHODS
34
+
35
+ We start with a brief introduction to RL in Section 2.1, and then introduce our main algorithm of self-imitating learning in Section 2.2. Section 2.3 further extends our main method to learn multiple diverse policies using Stein variational policy gradient with Jensen-Shannon kernel.
36
+
37
+ # 2.1 REINFORCEMENT LEARNING BACKGROUND
38
+
39
+ A typical RL setting involves an environment modeled as a Markov Decision Process with an unknown system dynamics model $p ( s _ { t + 1 } | s _ { t } , a _ { t } )$ and an initial state distribution $p _ { 0 } ( s _ { 0 } )$ . An agent interacts sequentially with the environment in discrete time-steps using a policy $\pi$ which maps the an observation $s _ { t } \in S$ to either a single action $a _ { t }$ (deterministic policy), or a distribution over the action space $\mathcal { A }$ (stochastic policy). We consider the scenario of stochastic policies over high-dimensional, continuous state and action spaces. The agent receives a per-step reward $r _ { t } ( s _ { t } , a _ { t } ) ~ \in ~ \mathcal { R }$ , and the RL objective involves maximization of the expected discounted sum of rewards, $\eta ( \pi _ { \theta } ) ~ =$ $\begin{array} { r } { \mathbb { E } _ { p _ { 0 } , p , \pi } \big [ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r ( s _ { t } , a _ { t } ) \big ] } \end{array}$ , where $\gamma \in \mathsf { \Gamma } ( 0 , 1 ]$ is the discount factor. The action-value function is $Q ^ { \pi } ( s _ { t } , a _ { t } ) = \mathbb { E } _ { p _ { 0 } , p , \pi } \big [ \sum _ { t ^ { \prime } = t } ^ { \infty } \gamma ^ { t ^ { \prime } - t } r ( s _ { t ^ { \prime } } , a _ { t ^ { \prime } } ) \big ]$ . We define the unnormalized $\gamma$ -discounted state0 visitation distribution for a policy $\pi$ by $\begin{array} { r } { \rho _ { \pi } \widetilde { \mathbf { \Gamma } } ( s ) ^ { - } = \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } P ( s _ { t } = s | \pi ) } \end{array}$ , where $P ( s _ { t } = s | \pi )$ is the probability of being in state at time , when following policy $\pi$ and starting state $s _ { 0 } \sim p _ { 0 }$ . The expected policy return $\eta ( \pi _ { \theta } )$ can then be written as $\mathbb { E } _ { \rho _ { \pi } ( s , a ) } [ r ( s , a ) ]$ , where $\rho _ { \pi } ( s , a ) = \rho _ { \pi } ( s ) \pi ( a | s )$ is the state-action visitation distribution. Using the policy gradient theorem (Sutton et al., 2000), we can get the direction of ascent $\nabla _ { \boldsymbol { \theta } } \eta ( \pi _ { \boldsymbol { \theta } } ) = \mathbb { E } _ { \rho _ { \pi } ( s , a ) } \mathbf { \bar { [ } } \nabla _ { \boldsymbol { \theta } } \log \pi _ { \boldsymbol { \theta } } ( a | s ) Q ^ { \pi } ( s , a ) \mathbf { \bar { ] } }$ .
40
+
41
+ # 2.2 POLICY OPTIMIZATION AS DIVERGENCE MINIMIZATION WITH SELF-IMITATION
42
+
43
+ Although the policy $\pi ( a | s )$ is given as a conditional distribution, its behavior is better characterized by the corresponding state-action visitation distribution $\rho _ { \pi } ( s , a )$ , which wraps the MDP dynamics and fully decides the expected return via $\eta ( \pi ) = \mathbb { E } _ { \rho _ { \pi } } [ \dot { r } ( s , a ) ]$ . Therefore, distance metrics on a policy $\pi$ should be defined with respect to the visitation distribution $\rho _ { \pi }$ , and the policy search should be viewed as finding policies with good visitation distributions $\rho _ { \pi }$ that yield high reward. Suppose we have access to a good policy $\pi ^ { * }$ , then it is natural to consider finding a $\pi$ such that its visitation distribution $\rho _ { \pi }$ matches $\rho _ { \pi ^ { * } }$ . To do so, we can define a divergence measure $D ( \rho _ { \pi } , \rho _ { \pi ^ { * } } )$ that captures the similarity between two distributions, and minimize this divergence for policy improvement.
44
+
45
+ Assume there exists an expert policy $\pi _ { E }$ , such that policy optimization can be framed as minimizing the divergence $\mathrm { m i n } _ { \pi } D ( \bar { \rho _ { \pi } } , \bar { \rho _ { \pi _ { E } } } )$ , that is, finding a policy $\pi$ to imitate $\pi _ { E }$ . In practice, however, we do not have access to any real guiding expert policy. Instead, we can maintain a selected subset $\mathcal { M } _ { E }$ of highly-rewarded trajectories from the previous rollouts of policy $\pi$ , and optimize the policy $\pi$ to minimize the divergence between $\rho _ { \pi }$ and the empirical state-action pair distribution $\{ ( s _ { i } , \bar { a } _ { i } ) \bar \} _ { \mathcal { M } _ { E } }$ :
46
+
47
+ $$
48
+ \operatorname* { m i n } _ { \pi } D ( \rho _ { \pi } , \{ ( s _ { i } , a _ { i } ) \} _ { \mathcal { M } _ { E } } ) .
49
+ $$
50
+
51
+ Since it is not always possible to explicitly formulate $\rho _ { \pi }$ even with the exact functional form of $\pi$ , we generate rollouts from $\pi$ in the environment and obtain an empirical distribution of $\rho _ { \pi }$ . To measure the divergence between two empirical distributions, we use the Jensen-Shannon divergence, with the following variational form (up to a constant shift) as exploited in GANs (Goodfellow et al., 2014):
52
+
53
+ $$
54
+ D _ { J S } ( \rho _ { \pi } , \rho _ { \pi _ { E } } ) = \operatorname* { m a x } _ { d ( s , a ) , d _ { E } ( s , a ) } \widetilde { \mathbb { E } } _ { \rho _ { \pi } } [ \log \frac { d ( s , a ) } { d ( s , a ) + d _ { E } ( s , a ) } ] + \widetilde { \mathbb { E } } _ { \rho _ { \pi _ { E } } } [ \log \frac { d _ { E } ( s , a ) } { d ( s , a ) + d _ { E } ( s , a ) } ] ,
55
+ $$
56
+
57
+ where $d ( s , a )$ and $d _ { E } ( s , a )$ are empirical density estimators of $\rho _ { \pi }$ and $\rho _ { \pi _ { E } }$ , respectively. Under certain assumptions, we can obtain an approximate gradient of $D _ { J S }$ w.r.t the policy parameters, thus enabling us to optimize the policy.
58
+
59
+ Gradient Approximation: Let $\rho _ { \pi } ( s , a )$ and $\rho _ { \pi _ { E } } ( s , a )$ be the state-action visitation distributions induced by two policies $\pi$ and $\pi _ { E }$ respectively. Let $d _ { \pi }$ and $d _ { \pi _ { E } }$ be the surrogates to $\rho _ { \pi }$ and $\rho _ { \pi _ { E } }$ , respectively, obtained by solving Equation 2. Then, if the policy $\pi$ is parameterized by $\theta$ , the gradient of $D _ { J S } ( \rho _ { \pi } , \rho _ { \pi _ { E } } )$ with respect to policy parameters (θ) can be approximated as:
60
+
61
+ $$
62
+ \begin{array} { r l } & { \nabla _ { \theta } D _ { J S } \bigl ( \rho _ { \pi } , \rho _ { \pi _ { E } } \bigr ) \approx \widetilde { \mathbb { E } } _ { \rho _ { \pi } ( s , a ) } \bigl [ \nabla _ { \theta } \log \pi _ { \theta } ( a | s ) \widetilde Q ^ { \pi } ( s , a ) \bigr ] , } \\ & { \mathrm { w h e r e } \widetilde Q ^ { \pi } ( s _ { t } , a _ { t } ) = \widetilde { \mathbb { E } } _ { \rho _ { \pi } ( s , a ) } \bigl [ \displaystyle \sum _ { t ^ { \prime } = t } ^ { \infty } \gamma ^ { t ^ { \prime } - t } \log \frac { d _ { \pi } \bigl ( s _ { t ^ { \prime } } , a _ { t ^ { \prime } } \bigr ) } { d _ { \pi } \bigl ( s _ { t ^ { \prime } } , a _ { t ^ { \prime } } \bigr ) + d _ { \pi _ { E } } \bigl ( s _ { t ^ { \prime } } , a _ { t ^ { \prime } } \bigr ) } \bigr ] . } \end{array}
63
+ $$
64
+
65
+ The derivation of the approximation and the underlying assumptions are in Appendix 5.1. Next, we introduce a simple and inexpensive approach to construct the replay memory $\mathcal { M } _ { E }$ using highreturn past experiences during training. In this way, $\rho _ { \pi _ { E } }$ can be seen as a mixture of deterministic policies, each representing a delta point mass distribution in the trajectory space or a finite discrete visitation distribution of state-action pairs. At each iteration, we apply the current policy $\pi _ { \theta }$ to sample $b$ trajectories $\{ \tau \} _ { 1 } ^ { b }$ . We hope to include in $\mathcal { M } _ { E }$ , the top- $k$ trajectories (or trajectories with returns above a threshold) generated thus far during the training process. For this, we use a priorityqueue list for $\mathcal { M } _ { E }$ which keeps the trajectories sorted according to the total trajectory reward. The reward for each newly sampled trajectory in $\{ \tau \} _ { 1 } ^ { b }$ is compared with the current threshold of the priority-queue, updating $\mathcal { M } _ { E }$ accordingly. The frequency of updates is impacted by the exploration capabilities of the agent and the stochasticity in the environment. We find that simply sampling noisy actions from Gaussian policies is sufficient for several locomotion tasks (Section 3). To handle more challenging environments, in the next sub-section, we augment our policy optimization procedure to explicitly enhance exploration and produce an ensemble of diverse policies.
66
+
67
+ In the usual imitation learning framework, expert demonstrations of trajectories—from external sources—are available as the empirical distribution of $\rho _ { \pi _ { E } }$ of an expert policy $\pi _ { E }$ . In our approach, since the agent learns by treating its own good past experiences as the expert, we can view the algorithm as self-imitation learning from experience replay. As noted in Equation 3, the gradient estimator of $D _ { J S }$ has a form similar to policy gradients, but for replacing the true reward function with per-timestep reward defined as $\log \bar { ( } d _ { \pi } ( \bar { s } , \bar { a } ) / ( d _ { \pi } ( s , a ) + d _ { \pi _ { E } } ( \bar { s } , a ) ) \bar { ) }$ ). Therefore, it is possible to interpolate the gradient of $D _ { J S }$ and the standard policy gradient. We would highlight the benefit of this interpolation soon. The net gradient on the policy parameters is:
68
+
69
+ $$
70
+ \nabla _ { \theta } \eta ( \pi _ { \theta } ) = ( 1 - \nu ) \mathbb { E } _ { \rho _ { \pi } ( s , a ) } \bigl [ \nabla _ { \theta } \log \pi _ { \theta } ( a | s ) Q ^ { r } ( s , a ) \bigr ] - \nu \nabla _ { \theta } D _ { J S } ( \rho _ { \pi } , \rho _ { \pi _ { E } } ) ,
71
+ $$
72
+
73
+ where $Q ^ { r }$ is the $Q$ function with true rewards, and $\pi _ { E }$ is the mixture policy represented by the samples in $\mathcal { M } _ { E }$ . Let $r ^ { \phi } ( s , a ) = d _ { \pi } ( s , a ) / [ d _ { \pi } ( s , a ) + d _ { \pi _ { E } } ( s , a ) ]$ . $r ^ { \phi } ( s , \grave { a } )$ can be computed using parameterized networks for densities $d _ { \pi }$ and $d _ { \pi _ { E } }$ , which are trained by solving the $D _ { J S }$ optimization (Eq 2) using the current policy rollouts and $\mathcal { M } _ { E }$ , where $\phi$ includes the parameters for $d _ { \pi }$ and $d _ { \pi _ { E } }$ . Using Equation 3, the interpolated gradient can be further simplified to:
74
+
75
+ $$
76
+ \nabla _ { \theta } \eta ( \pi _ { \theta } ) = \mathbb { E } _ { \rho _ { \pi } ( s , a ) } \Bigl [ \nabla _ { \theta } \log \pi _ { \theta } ( a | s ) \bigl [ ( 1 - \nu ) Q ^ { r } ( s , a ) + \nu Q ^ { r ^ { \phi } } ( s , a ) \bigr ] \Bigr ] ,
77
+ $$
78
+
79
+ where $\begin{array} { r } { Q ^ { r ^ { \phi } } ( s _ { t } , a _ { t } ) ~ = ~ - \mathbb { E } _ { p _ { 0 } , p , \pi } \big [ \sum _ { t ^ { \prime } = t } ^ { \infty } \gamma ^ { t ^ { \prime } - t } \log r ^ { \phi } \big ( s _ { t ^ { \prime } } , a _ { t ^ { \prime } } \big ) \big ] } \end{array}$ is the $Q$ function calculated using $- \log r ^ { \phi } ( s , a )$ as the reward. This reward is high in the regions of the $s \times { \mathcal A }$ space frequented more by the expert than the learner, and low in regions visited more by the learner than the expert. The effective $Q$ in Equation 5 is therefore an interpolation between $Q ^ { r }$ obtained with true environment rewards, and $\overline { { Q ^ { r ^ { \phi } } } }$ obtained with rewards which are implicitly shaped to guide the learner towards expert behavior. In environments with sparse or deceptive rewards, where the signal from $Q ^ { r }$ is weak or sub-optimal, a higher weight on $Q ^ { r ^ { \phi } }$ enables successful learning by imitation. We show this empirically in our experiments. We further find that even in cases with dense environment rewards, the two gradient components can be successfully combined for policy optimization. The complete algorithm for self-imitation is outlined in Appendix 5.2 (Algorithm 1).
80
+
81
+ Limitations of self-imitation. We now elucidate some shortcomings of the self-imitation approach. Since the replay memory $\mathcal { M } _ { E }$ is only constructed from the past training rollouts, the quality of the trajectories in $\mathcal { M } _ { E }$ is hinged on good exploration by the agent. Consider a maze environment where the robot is only rewarded when it arrives at a goal $\mathcal { G }$ placed in a far-off corner. Unless the robot reaches $\mathcal { G }$ once, the trajectories in $\mathcal { M } _ { E }$ always have a total reward of zero, and the learning signal from $Q ^ { r ^ { \phi } }$ is not useful. Secondly, self-imitation can lead to sub-optimal policies when there are local minima in the policy optimization landscape; for example, assume the maze has a second goal $\mathcal { G } ^ { \prime }$ in the opposite direction of $\mathcal { G }$ , but with a much smaller reward. With simple exploration, the agent may fill $\mathcal { M } _ { E }$ with below-par trajectories leading to $\mathcal { G } ^ { \prime }$ , and the reinforcement from $Q ^ { r ^ { \phi } }$ would drive it further to $\mathcal { G } ^ { \prime }$ . Thirdly, stochasticity in the environment may make it difficult to recover the optimal policy just by imitating the past top- $k$ rollouts. For instance, in a 2-armed bandit problem with reward distributions Bernoulli (p) and Bernoulli $\left( \mathfrak { p } { + } \epsilon \right)$ , rollouts from both the arms get conflated in $\mathcal { M } _ { E }$ during training with high probability, making it hard to imitate the action of picking the arm with the higher expected reward.
82
+
83
+ We propose to overcome these pitfalls by training an ensemble of self-imitating agents, which are explicitly encouraged to visit different, non-overlapping regions of the state-space. This helps to discover useful rewards in sparse settings, avoids deceptive reward traps, and in environments with reward-stochasticity like the 2-armed bandit, increases the probability of the optimal policy being present in the final trained ensemble. We detail the enhancements next.
84
+
85
+ # 2.3 IMPROVING EXPLORATION WITH STEIN VARIATIONAL GRADIENT
86
+
87
+ One approach to achieve better exploration in challenging cases like above is to simultaneously learn multiple diverse policies and enforce them to explore different parts of the high dimensional space. This can be achieved based on the recent work by Liu et al. (2017) on Stein variational policy gradient (SVPG). The idea of SVPG is to find an optimal distribution $q ( \theta )$ over the policy parameters $\theta$ which maximizes the expected policy returns, along with an entropy regularization that enforces diversity on the parameter space, i.e.
88
+
89
+ $$
90
+ \operatorname* { m a x } _ { \boldsymbol { q } } \mathbb { E } _ { \boldsymbol { \theta } \sim \boldsymbol { q } } [ \eta ( \boldsymbol { \theta } ) ] + \alpha H ( \boldsymbol { q } ) .
91
+ $$
92
+
93
+ Without a parametric assumption on $q$ , this problem admits a challenging functional optimization problem. Stein variational gradient descent (SVGD, Liu & Wang (2016)) provides an efficient solution for solving this problem, by approximating $q$ with a delta measure $\textstyle q = \sum _ { i = 1 } ^ { n } \delta _ { \theta _ { i } } / n$ , where $\{ \theta _ { i } \} _ { i = 1 } ^ { n }$ is an ensemble of policies, and iteratively update $\{ \theta _ { i } \}$ with
94
+
95
+ $$
96
+ \theta _ { i } \gets \theta _ { i } + \epsilon \Delta \theta _ { i } , \qquad \Delta \theta _ { i } = \frac { 1 } { n } \sum _ { j = 1 } ^ { n } \left[ \nabla _ { \theta _ { j } } \eta ( \pi _ { \theta _ { j } } ) k ( \theta _ { j } , \theta _ { i } ) + \alpha \nabla _ { \theta _ { j } } k ( \theta _ { j } , \theta _ { i } ) \right]
97
+ $$
98
+
99
+ where $k ( \theta _ { j } , \theta _ { i } )$ is a positive definite kernel function. The first term in $\Delta \theta _ { i }$ moves the policy to regions with high expected return (exploitation), while the second term creates a repulsion pressure between policies in the ensemble and encourages diversity (exploration). The choice of kernel is critical. Liu et al. (2017) used a simple Gaussian RBF kernel $k ( \theta _ { j } , \theta _ { i } ) = \mathrm { e x p } ( - \| \theta _ { j } - \theta _ { i } \| _ { 2 } ^ { 2 } / h )$ , with the bandwidth $h$ dynamically adapted. This, however, assumes a flat Euclidean distance between $\theta _ { j }$ and $\theta _ { i }$ , ignoring the structure of the entities defined by them, which are probability distributions. A statistical distance, such as $D _ { J S }$ , serves as a better metric for comparing policies (Amari, 1998; Kakade, 2002). Motivated by this, we propose to improve SVPG using JS kernel $k ( \theta _ { j } , \theta _ { i } ) = \exp ( - D _ { J S } ( \rho _ { \pi _ { \theta _ { j } } } , \rho _ { \pi _ { \theta _ { i } } } ) / T )$ , where $\rho _ { \pi _ { \theta } } ( s , a )$ is the state-action visitation distribution obtained by running policy $\pi _ { \theta }$ , and $T$ is the temperature. The second exploration term in SVPG involves the gradient of the kernel w.r.t policy parameters. With the JS kernel, this requires estimating gradient of $D _ { J S }$ , which as shown in Equation 3, can be obtained using policy gradients with an appropriately trained reward function.
100
+
101
+ ![](images/36f62d09707a929edda1bf8ea9a568fab6c2e02a8aa88f4234aa94f9763d9d59.jpg)
102
+ Figure 1: Learning curves for PPO and Self-Imitation on tasks with episodic rewards. Mean and standarddeviation over 5 random seeds is plotted.
103
+
104
+ Our full algorithm is summarized in Appendix 5.3 (Algorithm 2). In each iteration, we apply the SVPG gradient to each of the policies, where the $\nabla _ { \boldsymbol { \theta } } \eta ( \pi _ { \boldsymbol { \theta } } )$ in Equation 6 is the interpolated gradient from self-imitation (Equation 5). We also utilize state-value function networks as baselines to reduce the variance in sampled policy-gradients.
105
+
106
+ # 3 EXPERIMENTS
107
+
108
+ Our goal in this section is to answer the following questions: 1) How does self-imitation fare against standard policy gradients under various reward distributions from the environment, namely episodic, noisy and dense? 2) How far does the SVPG exploration go in overcoming the limitations of selfimitation, such as susceptibility to local-minimas?
109
+
110
+ We benchmark high-dimensional, continuous-control locomotion tasks based on the MuJoCo physics simulator by extending the OpenAI Baselines (Dhariwal et al., 2017) framework. Our control policies $( \theta _ { i } )$ are modeled as unimodal Gaussians. All feed-forward networks have two layers of 64 hidden units each with tanh non-linearity. For policy-gradient, we use the clipped-surrogate based PPO algorithm (Schulman et al., 2017b). Further implementation details are in the Appendix.
111
+
112
+ <table><tr><td></td><td colspan="4">Episodic rewards</td><td colspan="2">Noisy rewards Each rt suppressed w/ 90%prob.(pm =0.9)</td><td colspan="2">Noisy rewards Each rt suppressed w/ 50% prob.(pm = 0.5)</td><td colspan="2">Dense rewards (Gym default)</td></tr><tr><td></td><td>v=0.8 (SI)</td><td>v=0 (PPO)</td><td>CEM</td><td>ES</td><td>v=0.8 (SI)</td><td>v=0 (PPO)</td><td>v=0.8 (SI)</td><td>v=0 (PPO)</td><td>v=0.8 (SI)</td><td>v=0 (PPO)</td></tr><tr><td>Walker</td><td>2996</td><td>252</td><td>205</td><td>~1200</td><td>2276</td><td>2047</td><td>3049</td><td>3364</td><td>3263</td><td>3401</td></tr><tr><td>Humanoid</td><td>3602</td><td>532</td><td>426</td><td>-</td><td>4136</td><td>1159</td><td>4296</td><td>3145</td><td>3339</td><td>4149</td></tr><tr><td>H-Standup (×104)</td><td>18.1</td><td>4.4</td><td>9.6</td><td>=</td><td>14.3</td><td>11.4</td><td>16.3</td><td>9.8</td><td>17.2</td><td>10</td></tr><tr><td>Hopper</td><td>2618</td><td>354</td><td>97</td><td>~1900</td><td>2381</td><td>2264</td><td>2137</td><td>2132</td><td>2700</td><td>2252</td></tr><tr><td>Swimmer</td><td>173</td><td>21</td><td>17</td><td>=</td><td>52</td><td>37</td><td>127</td><td>56</td><td>106</td><td>68</td></tr><tr><td>Invd.Pendulum</td><td>8668</td><td>344</td><td>86</td><td>~9000</td><td>8744</td><td>8826</td><td>8926</td><td>8968</td><td>8989</td><td>8694</td></tr></table>
113
+
114
+ Table 1: Performance of PPO and Self-Imitation (SI) on tasks with episodic rewards, noisy rewards with masking probability $p _ { m }$ , and dense rewards. All runs use 5M timesteps of interaction with the environment. ES performance at 5M timesteps is taken from (Salimans et al., 2017). Missing entry denotes that we were unable to obtain the 5M timestep performance from the paper.
115
+
116
+ # 3.1 SELF-IMITATION WITH DIFFERENT REWARD DISTRIBUTIONS
117
+
118
+ We evaluate the performance of self-imitation with a single agent in this sub-section; combination with SVPG exploration for multiple agents is discussed in the next. We consider the locomotion tasks in OpenAI Gym under 3 separate reward distributions: Dense refers to the default reward function in Gym, which provides a reward for each simulation timestep. In episodic reward setting, rather than providing $r ( s _ { t } , a _ { t } )$ at each timestep of an episode, we provide $\textstyle \sum _ { t } r ( s _ { t } , a _ { t } )$ at the last timestep of the episode, and zero reward at other timesteps. This is the case for many practical settings where the reward function is hard to design, but scoring each trajectory, possibly by a human (Christiano et al., 2017), is feasible. In noisy reward setting, we probabilistically mask out each out each per-timestep reward $r ( a _ { t } , s _ { t } )$ in an episode. Reward masking is done independently for every new episode, and therefore, the agent receives non-zero feedback at different—albeit only few—timesteps in different episodes. The probability of masking-out or suppressing the rewards is denoted by $p _ { m }$ .
119
+
120
+ ![](images/92ef6ae6acfacf385c7df0e742166104c8fde3cefbb366fbc5a4abf01af9a6ae.jpg)
121
+ Figure 2: SI-independent and SI-interact-JS agents on Maze environment.
122
+
123
+ In Figure 1, we plot the learning curves on three tasks with episodic rewards. Recall that $\nu$ is the hyper-parameter controlling the weight distribution between gradients with environment rewards and the gradients with shaped reward from $r ^ { \phi }$ (Equation 5). The baseline PPO agents use $\nu = 0$ , meaning that the entire learning signal comes from the environment. We compare them with selfimitating (SI) agents using a constant value $\nu = 0 . 8$ . The capacity of $\mathcal { M } _ { E }$ is fixed at 10 trajectories. We didn’t observe our method to be particularly sensitive to the choice of $\nu$ and the capacity value. For instance, $\nu = 1$ works equally well. Further ablation on these two hyper-parameters can be found in the Appendix.
124
+
125
+ In Figure 1, we see that the PPO agents are unable to make any tangible progress on these tasks with episodic rewards, possibly due to difficulty in credit assignment – the lumped rewards at the end of the episode can’t be properly attributed to the individual state-action pairs during the episode. In case of Self-Imitation, the algorithm has access to the shaped rewards for each timestep, derived from the high-return trajectories in $\mathcal { M } _ { E }$ . This makes credit-assignment easier, leading to successful learning even for very high-dimensional control tasks such as Humanoid.
126
+
127
+ Table 1 summarizes the final performance, averaged over 5 runs with random seeds, under the various reward settings. For the noisy rewards, we compare performance with two different reward masking values - suppressing each reward $r ( s _ { t } , a _ { t } )$ with $90 \%$ probability $\gamma _ { m } = 0 . 9$ ), and with $50 \%$ probability $( p _ { m } = 0 . 5 )$ . The density of rewards increases across the reward settings from left to right in Table 1. We find that SI agents $\mathit { \Omega } _ { \nu } = 0 . 8 $ ) achieve higher average score than the baseline PPO agents $( \nu = 0$ ) in majority of the tasks for all the settings. This indicates that not only does self-imitation vastly help when the environment rewards are scant, it can readily be incorporated with the standard policy gradients via interpolation, for successful learning across reward settings. For completion, we include performance of CEM and ES since these algorithms depend only on the total trajectory rewards and don’t exploit the temporal structure. CEM perform poorly in most of the cases. ES, while being able to solve the tasks, is sample-inefficient. We include ES performance from Salimans et al. (2017) after 5M timesteps of training for a fair comparison with our algorithm.
128
+
129
+ # 3.2 CHARACTERIZING ENSEMBLE OF DIVERSE SELF-IMITATING POLICIES
130
+
131
+ We now conduct experiments to show how self-imitation can lead to sub-optimal policies in certain cases, and how the SVPG objective, which trains an ensemble with an explicit $D _ { J S }$ repulsion between policies, can improve performance.
132
+
133
+ 2D-Navigation. Consider a simple Maze environment where the start location of the agent (blue particle) is shown in the figure on the right, along with two regions – the red region is closer to agent’s starting location but has a per-timestep reward of only 1 point if the agent hovers over it; the green region is on the other side of the wall but has a per-timestep reward of 10 points. We run 8 independent, non-interacting, self-imitating (with $\nu = 0 . 8$ ) agents on this task. This ensemble is denoted as $S I -$ -independent. Figures 2a plots the state-visitation density for SI-independent after training, from which it is evident that the agents get trapped in the local minima. The red-region is relatively easily explored and trajectories leading to it fill the $\mathcal { M } _ { E }$ , causing sub-optimal imitation. We contrast this with an instantiation of our ful algorithm, which is referred to as SI-interact-JS. It is composed of 8 self-imitating agents which share information for gradient calculation with the SVPG objective (Equation 6). The temperature $T = 0 . 5$ is held constant, and the weight on exploration-facilitating repulsion term $( \alpha )$ is linearly decayed over time. Figure 2b depicts the state-visitation density for this ensemble. SI-interact-JS explores wider portions of the maze, with multiple agents reaching the green zone of high reward.
134
+
135
+ ![](images/1bad903a820dfd56c910e6fa5d898679f3ea5b74ef515e2de89aff99514e963f.jpg)
136
+
137
+ ![](images/3f4619250f4266dc2a65e2b1ac95b1bb81ebde7836253843a2723c3674b7705c.jpg)
138
+ Figure 3: Learning curves for various ensembles on sparse locomotion tasks. Mean and standard-deviation over 3 random seeds are plotted.
139
+
140
+ Figures 2c and 2d show the kernel matrices for the two ensembles after training. Cell $( i , j )$ in the matrix corresponds to the kernel value $k ( \theta _ { i } , \theta _ { j } ) = \exp ( - J S ( \rho _ { i } , \rho _ { j } ) / T )$ . For SI-independent, many darker cells indicate that policies are closer (low JS). For SI-interact-JS, which explicitly tries to decrease $k ( \theta _ { i } , \theta _ { j } )$ , the cells are noticeably lighter, indicating dissimilar policies (high JS). Behavior of PPO-independent $\overset { \cdot } { \boldsymbol \nu } = 0$ ) is similar to SI-independent $\mathit { \Delta } _ { \nu } = 0 . 8$ ) for the Maze task.
141
+
142
+ Locomotion. To explore the limitations of self-imitation in harder exploration problems in highdimensional, continuous state-action spaces, we modify 3 MuJoCo tasks as follows – SparseHalfCheetah, SparseHopper and SparseAnt yield a forward velocity reward only when the centerof-mass of the corresponding bot is beyond a certain threshold distance. At all timesteps, there is an energy penalty to move the joints, and a survival bonus for bots that can fall over causing premature episode termination (Hopper, Ant). Figure 3 plots the performance of PPO-independent, SI-independent, SI-interact-JS and SI-interact-RBF (which uses RBF-kernel from Liu et al. (2017) instead of the JS-kernel) on the tasks. Each of these 4 algorithms is an ensemble of 8 agents using the same amount of simulation timesteps. The results are averaged over 3 separate runs, where for each run, the best agent from the ensemble after training is selected.
143
+
144
+ The SI-independent agents rely solely on action-space noise from the Gaussian policy parameterization to find high-return trajectories which are added to $\mathcal { M } _ { E }$ as demonstrations. This is mostly inadequate or slow for sparse environments. Indeed, we find that all demonstrations in $\mathcal { M } _ { E }$ for SparseHopper are with the bot standing upright (or tilted) and gathering only the survival bonus, as action-space noise alone can’t discover hopping behavior. Similarly, for SparseHalfCheetah, $\mathcal { M } _ { E }$ has trajectories with the bot haphazardly moving back and forth. On the other hand, in SI-interactJS, the $D _ { J S }$ repulsion term encourages the agents to be diverse and explore the state-space much more effectively. This leads to faster discovery of quality trajectories, which then provide good reinforcement through self-imitation, leading to higher overall score. SI-interact-RBF doesn’t perform as well, suggesting that the JS-kernel is more formidable for exploration. PPO-independent gets stuck in the local optimum for SparseHopper and SparseHalfCheetah – the bots stand still after training, avoiding energy penalty. For SparseAnt, the bot can cross our preset distance threshold using only action-space noise, but learning is slow due to na¨ıve exploration.
145
+
146
+ # 4 CONCLUSION AND FUTURE WORK
147
+
148
+ We approached policy optimization for deep RL from the perspective of JS-divergence minimization between state-action distributions of a policy and its own past good rollouts. This leads to a self-imitation algorithm which improves upon standard policy-gradient methods via the addition of a simple gradient term obtained from implicitly shaped dense rewards. We observe substantial performance gains over the baseline for high-dimensional, continuous-control tasks with episodic and noisy rewards. Further, we discuss the potential limitations of the self-imitation approach, and propose ensemble training with the SVPG objective and JS-kernel as a solution. Through experimentation, we demonstrate the benefits of a self-imitating, diverse ensemble for efficient exploration and avoidance of local minima.
149
+
150
+ An interesting future work is improving our algorithm using the rich literature on exploration in RL. Since ours is a population-based exploration method, techniques for efficient single agent exploration can be readily combined with it. For instance, parameter-space noise or curiosity-driven exploration can be applied to each agent in the SI-interact-JS ensemble. Secondly, our algorithm for training diverse agents could be used more generally. In Appendix 5.6, we show preliminary results for two cases: a) hierarchical RL, where a diverse group of Swimmer bots is trained for downstream use in a complex Swimming $^ +$ Gathering task; b) RL without environment rewards, relying solely on diversity as the optimization objective. Further investigation is left for future work.
151
+
152
+ # REFERENCES
153
+
154
+ Daniel A Abolafia, Mohammad Norouzi, and Quoc V Le. Neural program synthesis with priority queue training. arXiv preprint arXiv:1801.03526, 2018.
155
+ Shun-Ichi Amari. Natural gradient works efficiently in learning. Neural computation, 10(2):251– 276, 1998.
156
+ Marcin Andrychowicz, Filip Wolski, Alex Ray, Jonas Schneider, Rachel Fong, Peter Welinder, Bob McGrew, Josh Tobin, OpenAI Pieter Abbeel, and Wojciech Zaremba. Hindsight experience replay. In Advances in Neural Information Processing Systems, pp. 5048–5058, 2017.
157
+ 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.
158
+ Mariusz Bojarski, Davide Del Testa, Daniel Dworakowski, Bernhard Firner, Beat Flepp, Prasoon Goyal, Lawrence D Jackel, Mathew Monfort, Urs Muller, Jiakai Zhang, et al. End to end learning for self-driving cars. arXiv preprint arXiv:1604.07316, 2016.
159
+ Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. In Advances in Neural Information Processing Systems, pp. 4302–4310, 2017.
160
+ Edoardo Conti, Vashisht Madhavan, Felipe Petroski Such, Joel Lehman, Kenneth O Stanley, and Jeff Clune. Improving exploration in evolution strategies for deep reinforcement learning via a population of novelty-seeking agents. arXiv preprint arXiv:1712.06560, 2017.
161
+ Marc Peter Deisenroth, Gerhard Neumann, Jan Peters, et al. A survey on policy search for robotics. Foundations and Trends $\textsuperscript { \textregistered }$ in Robotics, 2(1–2):1–142, 2013.
162
+ Prafulla Dhariwal, Christopher Hesse, Oleg Klimov, Alex Nichol, Matthias Plappert, Alec Radford, John Schulman, Szymon Sidor, and Yuhuai Wu. Openai baselines. https://github.com/ openai/baselines, 2017.
163
+ Yan Duan, Xi Chen, Rein Houthooft, John Schulman, and Pieter Abbeel. Benchmarking deep reinforcement learning for continuous control. In International Conference on Machine Learning, pp. 1329–1338, 2016.
164
+ 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.
165
+ Chelsea Finn, Sergey Levine, and Pieter Abbeel. Guided cost learning: Deep inverse optimal control via policy optimization. In International Conference on Machine Learning, pp. 49–58, 2016.
166
+ Carlos Florensa, Yan Duan, and Pieter Abbeel. Stochastic neural networks for hierarchical reinforcement learning. arXiv preprint arXiv:1704.03012, 2017.
167
+ Justin Fu, John Co-Reyes, and Sergey Levine. Ex2: Exploration with exemplar models for deep reinforcement learning. In Advances in Neural Information Processing Systems, pp. 2574–2584, 2017.
168
+
169
+ Scott Fujimoto, Herke van Hoof, and Dave Meger. Addressing function approximation error in actor-critic methods. arXiv preprint arXiv:1802.09477, 2018.
170
+
171
+ 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.
172
+
173
+ Todd Hester, Matej Vecerik, Olivier Pietquin, Marc Lanctot, Tom Schaul, Bilal Piot, Dan Horgan, John Quan, Andrew Sendonaris, Gabriel Dulac-Arnold, et al. Deep q-learning from demonstrations. arXiv preprint arXiv:1704.03732, 2017.
174
+
175
+ Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. In Advances in Neural Information Processing Systems, pp. 4565–4573, 2016.
176
+
177
+ 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.
178
+
179
+ Sham M Kakade. A natural policy gradient. In Advances in neural information processing systems, pp. 1531–1538, 2002.
180
+
181
+ Jens Kober and Jan R Peters. Policy search for motor primitives in robotics. In Advances in neural information processing systems, pp. 849–856, 2009.
182
+
183
+ Sergey Levine and Vladlen Koltun. Guided policy search. In International Conference on Machine Learning, pp. 1–9, 2013.
184
+
185
+ 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.
186
+
187
+ Chen Liang, Jonathan Berant, Quoc Le, Kenneth D Forbus, and Ni Lao. Neural symbolic machines: Learning semantic parsers on freebase with weak supervision. arXiv preprint arXiv:1611.00020, 2016.
188
+
189
+ Chen Liang, Mohammad Norouzi, Jonathan Berant, Quoc Le, and Ni Lao. Memory augmented policy optimization for program synthesis with generalization. arXiv preprint arXiv:1807.02322, 2018.
190
+
191
+ 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.
192
+
193
+ Qiang Liu and Dilin Wang. Stein variational gradient descent: A general purpose bayesian inference algorithm. In Advances In Neural Information Processing Systems, pp. 2378–2386, 2016.
194
+
195
+ Yang Liu, Prajit Ramachandran, Qiang Liu, and Jian Peng. Stein variational policy gradient. arXiv preprint arXiv:1704.02399, 2017.
196
+
197
+ 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.
198
+
199
+ 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.
200
+
201
+ Ashvin Nair, Bob McGrew, Marcin Andrychowicz, Wojciech Zaremba, and Pieter Abbeel. Overcoming exploration in reinforcement learning with demonstrations. arXiv preprint arXiv:1709.10089, 2017.
202
+
203
+ Junhyuk Oh, Yijie Guo, Satinder Singh, and Honglak Lee. Self-imitation learning. arXiv preprint arXiv:1806.05635, 2018.
204
+
205
+ Jan Peters and Stefan Schaal. Reinforcement learning by reward-weighted regression for operational space control. In Proceedings of the 24th international conference on Machine learning, pp. 745– 750. ACM, 2007.
206
+
207
+ Jan Peters, Katharina Mulling, and Yasemin Altun. Relative entropy policy search. In ¨ AAAI, pp. 1607–1612. Atlanta, 2010.
208
+
209
+ Stephane Ross, Narek Melik-Barkhudarov, Kumar Shaurya Shankar, Andreas Wendel, Debadeepta ´ Dey, J Andrew Bagnell, and Martial Hebert. Learning monocular reactive uav control in cluttered natural environments. In Robotics and Automation (ICRA), 2013 IEEE International Conference on, pp. 1765–1772. IEEE, 2013.
210
+
211
+ Reuven Y Rubinstein and Dirk P Kroese. Simulation and the Monte Carlo method, volume 10. John Wiley & Sons, 2016.
212
+
213
+ Tim Salimans, Jonathan Ho, Xi Chen, and Ilya Sutskever. Evolution strategies as a scalable alternative to reinforcement learning. arXiv preprint arXiv:1703.03864, 2017.
214
+
215
+ 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.
216
+
217
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017a.
218
+
219
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017b.
220
+
221
+ 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.
222
+
223
+ Bradly C Stadie, Sergey Levine, and Pieter Abbeel. Incentivizing exploration in reinforcement learning with deep predictive models. arXiv preprint arXiv:1507.00814, 2015.
224
+
225
+ Alexander L Strehl and Michael L Littman. An analysis of model-based interval estimation for markov decision processes. Journal of Computer and System Sciences, 74(8):1309–1331, 2008.
226
+
227
+ 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.
228
+
229
+ Richard Stuart Sutton. Temporal credit assignment in reinforcement learning. 1984.
230
+
231
+ 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. 2750– 2759, 2017.
232
+
233
+ Matej Vecer ˇ ´ık, Todd Hester, Jonathan Scholz, Fumin Wang, Olivier Pietquin, Bilal Piot, Nicolas Heess, Thomas Rothorl, Thomas Lampe, and Martin Riedmiller. Leveraging demonstra- ¨ tions for deep reinforcement learning on robotics problems with sparse rewards. arXiv preprint arXiv:1707.08817, 2017.
234
+
235
+ Markus Wulfmeier, Ingmar Posner, and Pieter Abbeel. Mutual alignment transfer learning. arXiv preprint arXiv:1707.07907, 2017.
236
+
237
+ # 5 APPENDIX
238
+
239
+ # 5.1 DERIVATION OF GRADIENT APPROXIMATION
240
+
241
+ Let $d _ { \pi } ^ { * } ( s , a )$ and $d _ { E } ^ { * } ( s , a )$ be the exact state-action densities for the current policy $\left( \pi _ { \boldsymbol { \theta } } \right)$ and the expert, respectively. Therefore, by definition, we have (up to a constant shift):
242
+
243
+ $$
244
+ D _ { J S } ( \rho _ { \pi _ { \theta } } , \rho _ { \pi _ { E } } ) = \widetilde { \mathbb { E } } _ { \rho _ { \pi _ { \theta } } } [ \log \frac { d _ { \pi } ^ { * } ( s , a ) } { d _ { \pi } ^ { * } ( s , a ) + d _ { E } ^ { * } ( s , a ) } ] + \widetilde { \mathbb { E } } _ { \rho _ { \pi _ { E } } } [ \log \frac { d _ { E } ^ { * } ( s , a ) } { d _ { \pi } ^ { * } ( s , a ) + d _ { E } ^ { * } ( s , a ) } ]
245
+ $$
246
+
247
+ Now, $d _ { \pi } ^ { * } ( s , a )$ is a local surrogate to $\rho _ { \pi _ { \theta } } ( s , a )$ . By approximating it to be constant in an $\epsilon -$ ball neighborhood around $\theta$ , we get the following after taking gradient of the above equation w.r.t $\theta$ :
248
+
249
+ $$
250
+ \begin{array} { r l } { \nabla _ { \theta } D _ { J S } ( \rho _ { \pi _ { \theta } } , \rho _ { \pi _ { E } } ) \approx \nabla _ { \theta } \widetilde { \mathbb { E } } _ { \rho _ { \pi _ { \theta } } } \underbrace { \left[ \log \frac { d _ { \pi } ^ { * } ( s , a ) } { d _ { \pi } ^ { * } ( s , a ) + d _ { E } ^ { * } ( s , a ) } \right] } _ { r ( s , a ) } + 0 } & { } \\ { = \widetilde { \mathbb { E } } _ { \rho _ { \pi _ { \theta } } ( s , a ) } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a | s ) \widetilde { Q } ^ { \pi } ( s , a ) \right] , } & { } \\ { \mathrm { w h e r e ~ } \widetilde { Q } ^ { \pi } ( s _ { t } , a _ { t } ) = \widetilde { \mathbb { E } } _ { \rho _ { \pi _ { \theta } } ( s , a ) } \big [ \displaystyle \sum _ { t ^ { \prime } = t } ^ { \infty } \gamma ^ { t ^ { \prime } - t } r ( s _ { t ^ { \prime } } , a _ { t ^ { \prime } } ) \big ] } & { \square } \end{array}
251
+ $$
252
+
253
+ The last step follows directly from the policy gradient theorem (Sutton et al., 2000). Since we do not have the exact densities $d _ { \pi } ^ { * } ( s , a )$ and $d _ { E } ^ { * } ( s , a )$ , we substitute them with the optimized density estimators $d _ { \pi } ( s , a )$ and $d _ { E } ( s , a )$ from the maximization in Equation 2 for computing $D _ { J S }$ . This gives us the gradient approximation mentioned in Section 2.2. A similar approximation is also used by Ho & Ermon (2016) for Generative Adversarial Imitation Learning (GAIL).
254
+
255
+ # 5.2 ALGORITHM FOR SELF-IMITATION
256
+
257
+ Notation: $\theta =$ Policy parameters $\phi =$ Discriminator parameters $r ( s , a ) =$ Environment reward
258
+
259
+ # Algorithm 1:
260
+
261
+ 1 $\theta , \phi \sim$ initial parameters
262
+ 2 $\mathcal { M } _ { E } $ empty replay memory
263
+
264
+ 3 for each iteration do
265
+
266
+ 4 Generate batch of trajectories $\{ \tau \} _ { 1 } ^ { b }$ with two rewards for each transition: $r _ { 1 } = r ( s , a )$ and
267
+ $r _ { 2 } = - \log r ^ { \phi } ( s , a )$
268
+ 5 Update $\mathcal { M } _ { E }$ using priory queue threshold
269
+ $/ \star$ Update policy $\theta \ { \bf \nabla } \star { \bf \nabla } /$
270
+ 6 for each minibatch do
271
+ 7 Calculate $g _ { 1 } = \nabla _ { \theta } \eta ^ { r _ { 1 } } ( \pi _ { \theta } )$ with PPO objective using $r _ { 1 }$ reward
272
+ 8 Calculate $g _ { 2 } = \nabla _ { \boldsymbol { \theta } } \eta ^ { r _ { 2 } } ( \pi _ { \boldsymbol { \theta } } )$ with PPO objective using $r _ { 2 }$ reward
273
+ 9 Update $\theta$ with $( 1 - \nu ) g _ { 1 } + \nu g _ { 2 }$ using ADAM
274
+ 10 end
275
+ $/ \star$ Update self-imitation discriminator $\phi \ { \star } /$
276
+ 11 for each epoch do
277
+ 12 $s _ { 1 } $ Sample mini-batch of (s,a) from $\mathcal { M } _ { E }$
278
+ 13 $s _ { 2 } $ Sample mini-batch of (s,a) from $\{ \tau \} _ { 1 } ^ { b }$
279
+ 14 Update $\phi$ with log-loss objective using $s _ { 1 } , s _ { 2 }$
280
+ 15 end
281
+ 16 end
282
+
283
+ # 5.3 ALGORITHM FOR SELF-IMITATING DIVERSE POLICIES
284
+
285
+ Notation:
286
+ $\theta _ { i } =$ Policy parameters for rank $i$
287
+ $\phi _ { i } =$ Self-imitation discriminator parameters for rank $i$ $\psi _ { i } = $ Empirical density network parameters for rank $i$
288
+
289
+ # Algorithm 2:
290
+
291
+ /\* This is run for every rank i ∈ 1 . . . n \*/
292
+ 1 $\theta _ { i } , \phi _ { i } , \psi _ { i } \sim$ some initial distributions
293
+ 2 $\mathcal { M } _ { E } $ empty replay memory local to rank $i$
294
+ 3 $k ( i , j ) 0 , \forall j \neq i$
295
+ 4 for each iteration do
296
+ 5 Generate batch of trajectories $\{ \tau _ { i } \} _ { 1 } ^ { b }$
297
+ 6 Update $\mathcal { M } _ { E }$ using priory queue threshold
298
+ $/ \star$ Update policy $\theta _ { i } \quad \star /$
299
+ 7 for each minibatch do
300
+ 8 Calculate $\nabla _ { \boldsymbol { \theta } _ { i } } \eta ( \pi _ { \boldsymbol { \theta } _ { i } } )$ using self-imitation (as in Algorithm 1)
301
+ 9 MPI send: $\nabla _ { \theta _ { i } } \eta ( \pi _ { \theta _ { i } } )$ to other ranks
302
+ 10 MPI recv: $\nabla _ { \boldsymbol { \theta } _ { j } } \eta ( \pi _ { \boldsymbol { \theta } _ { j } } )$ from other ranks
303
+ 11 Calculate $\nabla _ { \theta _ { i } } k ( i , j )$ using $\psi _ { i } , \psi _ { j }$
304
+ 12 Use $k ( i , j )$ and lines 8, 10, 11 in SVPG to get $\Delta \theta _ { i }$
305
+ 13 Update $\theta _ { i }$ with $\Delta \theta _ { i }$ using ADAM
306
+ 14 end
307
+ $/ \star$ Update self-imitation discriminator $\phi _ { i }$ \*/
308
+ 15 for each epoch do
309
+ 16 $s _ { 1 } $ Sample mini-batch of (s,a) from $\mathcal { M } _ { E }$
310
+ 17 $s _ { 2 } $ Sample mini-batch of (s,a) from $\{ \tau _ { i } \} _ { 1 } ^ { b }$
311
+ 18 Update $\phi _ { i }$ with log-loss objective using $s _ { 1 } , s _ { 2 }$
312
+ 19 end
313
+ $/ \star$ Update state-action visitation network $\psi _ { i }$ \*/
314
+ 20 MPI send: $\psi _ { i }$ to other ranks
315
+ 21 MPI send: $\{ \tau _ { i } \} _ { 1 } ^ { b }$ to other ranks
316
+ 22 MPI recv: $\psi _ { j }$ from other ranks
317
+ 23 MPI recv: $\{ \tau _ { j } \} _ { 1 } ^ { b }$ from other ranks
318
+ 24 Update $\psi _ { i }$ with log-loss objective using $\psi _ { j } , \{ \tau _ { i } \} _ { 1 } ^ { b } , \{ \tau _ { j } \} _ { 1 } ^ { b }$
319
+ 25 Update $k ( i , j )$
320
+ 26 end
321
+
322
+ # 5.4 ABLATION STUDIES
323
+
324
+ We show the sensitivity of self-imitation to $\nu$ and the capacity of $\mathcal { M } _ { E }$ , denoted by $C$ . The experiments in this subsection are done on Humanoid and Hopper tasks with episodic rewards. The tables show the average performance over 5 random seeds. For ablation on $\nu$ , $C$ is fixed at 10; for ablation on $C$ , $\nu$ is fixed at 0.8. With episodic rewards, a higher value of $\nu$ helps boost performance since the RL signal from the environment is weak. With $\nu = 0 . 8$ , there isn’t a single best choice for $C$ , though all values of $C$ give better results than baseline PPO $( \nu = 0$ ).
325
+
326
+ <table><tr><td></td><td>Humanoid</td><td>Hopper</td></tr><tr><td>v=0</td><td>532</td><td>354</td></tr><tr><td>v = 0.2</td><td>395</td><td>481</td></tr><tr><td>v = 0.5</td><td>810</td><td>645</td></tr><tr><td>v = 0.8</td><td>3602</td><td>2618</td></tr><tr><td>v=1</td><td>3891</td><td>2633</td></tr></table>
327
+
328
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Humanoid</td><td rowspan=1 colspan=1>Hopper</td></tr><tr><td rowspan=1 colspan=1>C=1</td><td rowspan=1 colspan=1>2861</td><td rowspan=1 colspan=1>1736</td></tr><tr><td rowspan=1 colspan=1>C=5</td><td rowspan=1 colspan=1>2946</td><td rowspan=1 colspan=1>2415</td></tr><tr><td rowspan=2 colspan=1>C=10C=25</td><td rowspan=1 colspan=1>3602</td><td rowspan=1 colspan=1>2618</td></tr><tr><td rowspan=1 colspan=1>2667</td><td rowspan=1 colspan=1>1624</td></tr><tr><td rowspan=1 colspan=1>C= 50</td><td rowspan=1 colspan=1>4159</td><td rowspan=1 colspan=1>2301</td></tr></table>
329
+
330
+ # 5.5 HYPERPARAMETERS
331
+
332
+ - Horizon $\mathrm { ( T ) = 1 0 0 0 }$ (locomotion), 250 (Maze), 5000 (Swimming+Gathering)
333
+ - Discount $( \gamma ) = 0 . 9 9$
334
+ - GAE parameter $( \lambda ) = 0 . 9 5$
335
+ - PPO internal epochs $= 5$
336
+ - PPO learning rate $= 1 \mathrm { e } { - 4 }$
337
+ - PPO mini-batch $= 6 4$
338
+
339
+ # 5.6 LEVERAGING DIVERSE POLICIES
340
+
341
+ The diversity-promoting $D _ { J S }$ repulsion can be used for various other purposes apart from aiding exploration in the sparse environments considered thus far. First, we consider the paradigm of hierarchical reinforcement learning wherein multiple sub-policies (or skills) are managed by a highlevel policy, which chooses the most apt sub-policy to execute at any given time. In Figure 4, we use the Swimmer environment from Gym and show that diverse skills (movements) can be acquired in a pre-training phase when $D _ { J S }$ repulsion is used. The skills can then be used in a difficult downstream task. During pre-training with SVPG, exploitation is done with policy-gradients calculated using the norm of the velocity as dense rewards, while the exploration term uses the JS-kernel. As before, we compare an ensemble of 8 interacting agents with 8 independent agents. Figures 4a and 4b depict the paths taken by the Swimmer after training with independent and interacting agents, respectively. The latter exhibit variety. Figure 4c is the downstream task of Swimming+Gathering (Duan et al., 2016) where the bot has to swim and collect the green dots, whilst avoiding the red ones. The utility of pre-training a diverse ensemble is shown in Figure 4d, which plots the performance on this task while training a higher-level categorical manager policy $( | \boldsymbol { A } | = 8 $ ).
342
+
343
+ Diversity can sometimes also help in learning a skill without any rewards from the environment, as observed by Eysenbach et al. (2018) in recent work. We consider a Hopper task with no rewards, but we do require weak supervision in form of the length of each trajectory $L$ . Using policy-gradient with $L$ as reward and $D _ { J S }$ repulsion, we see the emergence of hopping behavior within an ensemble of 8 interacting agents. Videos of the skills acquired can be found here 1.
344
+
345
+ ![](images/97185bf0815571e4a4ffe29d41aab32e22ecd9be75bf2d5a18f6043c336723c6.jpg)
346
+ Figure 4: Using diverse agents for hierarchical reinforcement learning. (a) Independent agents paths. (b) Interacting agents paths. (c) Swimming $^ +$ Gathering task. (d) Performance of manager policy with two different pre-trained ensembles as sub-policies.
347
+
348
+ # 5.7 PERFORMANCE ON MORE MUJOCO TASKS
349
+
350
+ <table><tr><td></td><td colspan="2">Episodic rewards</td><td colspan="2">Noisy rewards Each rt suppressed w/ 90% prob.(pm = 0.9)</td><td colspan="2">Noisy rewards Each rt suppressed w/ 50% prob. (pm = 0.5)</td><td colspan="2">Dense rewards (Gym default)</td></tr><tr><td></td><td>v=0.8 (SI)</td><td>v=0 (PPO)</td><td>v=0.8 (SI)</td><td>v=0 (PPO)</td><td>v=0.8 (SI)</td><td>v=0 (PPO)</td><td>v=0.8 (SI)</td><td>v=0 (PPO)</td></tr><tr><td>Half-Cheetah Reacher</td><td>3686</td><td>-1572</td><td>3378</td><td>1670</td><td>4574</td><td>2374</td><td>4878</td><td>2422</td></tr><tr><td></td><td>-12</td><td>-12</td><td>-12</td><td>-10</td><td>-6</td><td>-6</td><td>-5</td><td>-5</td></tr><tr><td>Inv.Pendulum</td><td>977</td><td>53</td><td>993</td><td>999</td><td>978</td><td>988</td><td>969</td><td>992</td></tr></table>
351
+
352
+ Table 2: Extension of Table 1 from Section 3. All runs use 5M timesteps of interaction with the environment.
353
+
354
+ # 5.8 ADDITIONAL DETAILS ON SVPG EXPLORATION WITH JS-KERNEL
355
+
356
+ # 5.8.1 SVPG FORMULATION
357
+
358
+ Let the policy parameters be parameterized by $\theta$ . To achieve diverse, high-return policies, we seek to obtain the distribution $q ^ { * } ( \theta )$ which is the solution of the optimization problem: $\begin{array} { r } { \operatorname { \bar { m a x } } _ { q } \mathbb { E } _ { \theta \sim q } [ \eta ( \theta ) ] + } \end{array}$ $\alpha H ( q )$ , where $H ( q ) = \mathbb { E } _ { \theta \sim q } [ - \log q ( \theta ) ]$ is the entropy of $q$ . Solving the above equation by setting derivative to zero yields the an energy-based formulation for the optimal policy-parameter distribution: as MC $\begin{array} { r } { q ^ { * } ( \theta ) \propto \exp ( \frac { \eta ( \theta ) } { \alpha } ) } \end{array}$ . Drawing samples from this posterior using traditional methods suchly intractable. Stein variational gradient descent (SVGD; Liu & Wang (2016)) is an efficient method for generating samples and also converges to the posterior of the energy-based model. Let $\{ \theta \} _ { 1 } ^ { n }$ be the $n$ particles that constitute the policy ensemble. SVGD provides appropriate direction for perturbing each particle such that induced KL-divergence between the particles and the target distribution $q ^ { * } ( \theta )$ is reduced. The perturbation (gradient) for particle $\theta _ { i }$ is given by (please see Liu & Wang (2016) for derivation):
359
+
360
+ $$
361
+ \Delta \theta _ { i } = \frac { 1 } { n } \sum _ { j = 1 } ^ { n } \left[ \nabla _ { \theta _ { j } } \log q ^ { * } ( \theta _ { j } ) k ( \theta _ { j } , \theta _ { i } ) + \nabla _ { \theta _ { j } } k ( \theta _ { j } , \theta _ { i } ) \right]
362
+ $$
363
+
364
+ where $k ( \theta _ { j } , \theta _ { i } )$ is a positive definite kernel function. Using $\begin{array} { r } { q ^ { * } ( \theta ) \propto \exp ( \frac { \eta ( \theta ) } { \alpha } ) } \end{array}$ as target distribution, and $\bar { k } ( \theta _ { j } , \theta _ { i } ) = \exp ( - D _ { J S } ( \rho _ { \pi _ { \theta _ { j } } } , \rho _ { \pi _ { \theta _ { i } } } ) / T )$ as the JS-kernel, we get the gradient direction for ascent:
365
+
366
+ $$
367
+ \Delta \theta _ { i } = \frac { 1 } { n } \sum _ { j = 1 } ^ { n } \mathrm { e x p } ( - D _ { J S } ( \rho _ { \pi _ { \theta _ { j } } } , \rho _ { \pi _ { \theta _ { i } } } ) / T ) \Big [ \nabla _ { \theta _ { j } } \frac { \eta ( \pi _ { \theta _ { j } } ) } { \alpha } - \frac { 1 } { T } \nabla _ { \theta _ { j } } D _ { J S } ( \rho _ { \pi _ { \theta _ { j } } } , \rho _ { \pi _ { \theta _ { i } } } ) \Big ]
368
+ $$
369
+
370
+ where $\rho _ { \pi _ { \theta } } ( s , a )$ is the state-action visitation distribution for policy $\pi _ { \theta }$ , and $T$ is the temperature.
371
+ Also, for our case, $\nabla _ { \boldsymbol { \theta } _ { j } } \eta ( \pi _ { \boldsymbol { \theta } _ { j } } )$ is the interpolated gradient from self-imitation (Equation 5).
372
+
373
+ # 5.8.2 IMPLEMENTATION DETAILS
374
+
375
+ The $- \nabla _ { \boldsymbol { \theta } _ { j } } D _ { J S } ( \rho _ { \pi _ { \boldsymbol { \theta } _ { j } } } , \rho _ { \pi _ { \boldsymbol { \theta } _ { i } } } )$ gradient in the above equation is the repulsion factor that pushes $\pi _ { \boldsymbol { \theta } _ { i } }$ away from $\pi _ { \theta _ { j } }$ . Similar repulsion can be achieved by using the gradient $+ \nabla _ { \theta _ { i } } D _ { J S } ( \rho _ { \pi _ { \theta _ { j } } } , \rho _ { \pi _ { \theta _ { i } } } )$ ; note that this gradient is w.r.t $\theta _ { i }$ instead of $\theta _ { j }$ and the sign is reversed. Empirically, we find that the latter results in slightly better performance.
376
+
377
+ Estimation of $\nabla _ { \theta _ { i } } D _ { J S } ( \rho _ { j } , \rho _ { i } )$ : This can be done in two ways - using implicit and explicit distributions. In the implicitstate-actions pairs from ethoand we could train a parameterized disto implicitly approximate the ratio $( \phi )$ $\pi _ { i }$ $\pi _ { j }$ $r _ { i j } ^ { \phi } = \rho _ { \pi _ { i } } ( s , a ) / [ \rho _ { \pi _ { i } } ( s , a ) \dot { + }$ . We could then use the policy gradient theorem to obtain the gradient of $D _ { J S }$ as explained in Section 2.2. This, however, requires us to learn $\mathcal { O } ( n ^ { 2 } )$ discriminator networks for a population of size $n$ , one for each policy pair $( i , j )$ . To reduce the computational and memory resource burden to ${ \mathcal { O } } ( n )$ , we opt for explicit modeling of $\rho _ { \pi _ { i } }$ . Specifically, we train a network $\rho _ { \psi _ { i } }$ to approximate the state-action visitation density for each policy $\pi _ { i }$ . The $\rho _ { \psi _ { 1 } } \ldots \rho _ { \psi _ { n } }$ networks are learned using the $D _ { J S }$ optimization (Equation 2), and we can easily obtain the ratio $r _ { i j } ( s , a ) = \rho _ { \psi _ { i } } ( s , a ) / [ \bar { \rho _ { \psi _ { i } } } ( s , a ) + \bar { \rho _ { \psi _ { j } } } ( s , a ) ]$ . The agent then uses $\log r _ { i j } ( s , a )$ as the SVPG exploration rewards in the policy gradient theorem.
378
+
379
+ State-value baselines: We use state-value function networks as baselines to reduce the variance in sampled policy-gradients. Each agent $\theta _ { i }$ in a population of size $n$ trains $n + 1$ state-value networks corresponding to real environment rewards $r ( s , a )$ , self-imitation rewards $- \log r ^ { \phi } ( s , a )$ , and $n - 1$ SVPG exploration rewards $\log r _ { i j } ( s , a )$ .
380
+
381
+ # 5.9 COMPARISON TO OH ET AL. (2018)
382
+
383
+ In this section, we provide evaluation for a recently proposed method for self-imitation learning (SIL; Oh et al. (2018)). The SIL loss function take the form:
384
+
385
+ $$
386
+ \mathcal { L } ^ { S I L } = \mathbb { E } _ { s , a , D } \Big [ - \log \pi _ { \theta } ( a | s ) ( R - V _ { \theta } ( s ) ) _ { + } + \frac { \beta } { 2 } | | ( R - V _ { \theta } ( s ) ) _ { + } | | ^ { 2 } \Big ]
387
+ $$
388
+
389
+ In words, the algorithm buffers $( s , a )$ and the corresponding return $( R )$ for each transition in rolled trajectories, and reuses them for training if the stored return value is higher than the current statevalue estimate $V _ { \theta } ( s )$ .
390
+
391
+ We use the code provided by the authors 2. As per our understanding, $\mathrm { P P O + S I L }$ does not use a single set of hyper-parameters for all the MuJoCo tasks (Appendix A; Oh et al. (2018)). We follow their methodology and report numbers for the best configuration for each task. This is different from our experiments since we run all tasks on a single fix hyper-parameter set (Appendix 5.5), and therefore a direct comparison of the average scores between the two approaches is tricky.
392
+
393
+ Table 3: Performance of $\mathrm { P P O + S I L }$ (Oh et al., 2018) on tasks with episodic rewards, noisy rewards with masking probability $p _ { m }$ , and dense rewards. All runs use 5M timesteps of interaction with the environment.
394
+
395
+ <table><tr><td></td><td>SIL Dense rewards Oh et al. (2018)</td><td>SIL Episodic rewards</td><td>SIL Noisy rewards Each rt suppressed w/ 90% prob. (pm = 0.9)</td><td>SIL Noisy rewards Each rt suppressed w/ 50% prob.(pm =0.5)</td></tr><tr><td>Walker</td><td>3973</td><td>257</td><td>565</td><td>3911</td></tr><tr><td>Humanoid</td><td>3610</td><td>530</td><td>1126</td><td>3460</td></tr><tr><td>Humanoid-Standup (×104)</td><td>18.9</td><td>4.9</td><td>14.9</td><td>18.8</td></tr><tr><td>Hopper</td><td>1983</td><td>563</td><td>1387</td><td>1723</td></tr><tr><td>Swimmer</td><td>120</td><td>17</td><td>50</td><td>100</td></tr><tr><td>InvertedDoublePendulum</td><td>6250</td><td>405</td><td>6563</td><td>6530</td></tr></table>
396
+
397
+ Table 3 shows the performance of $\mathrm { P P O + S I L }$ on MuJoCo tasks under the various reward distributions explained in Section 3.1 - dense, episodic and noisy. We observe that, compared to the dense rewards setting (default Gym rewards), the performance suffers under the episodic case and when the rewards are masked out with $p _ { m } = 0 . 9$ . Our intuition is as follows. PPO+SIL makes use of the cumulative return $( R )$ from each transition of a past good rollout for the update. When rewards are provided only at the end of the episode, for instance, cumulative return does not help with the temporal credit assignment problem and hence is not a strong learning signal. Our approach, on the other hand, derives dense, per-timestep rewards using an objective based on divergence-minimization. This is useful for credit assignment, and as indicated in Table 1. (Section 3.1) leads to learning good policies even under the episodic and noisy $p _ { m } = 0 . 9$ settings.
398
+
399
+ # 5.10 COMPARISON TO OFF-POLICY RL (Q-LEARNING)
400
+
401
+ Our approach makes use of replay memory $\mathcal { M } _ { E }$ to store the past good rollouts of the agent. Offpolicy RL methods such as DQN (Mnih et al., 2015) also accumulate agent experience in a replay buffer and reuse them for learning (e.g. by reducing TD-error). In this section, we evaluate the performance of one such recent algorithm - Twin Delayed Deep Deterministic policy gradient (TD3; Fujimoto et al. (2018)) on tasks with episodic and noisy rewards. TD3 builds on DDPG (Lillicrap et al., 2015) and surpasses its performance on all the MuJoCo tasks evaluated by the authors.
402
+
403
+ <table><tr><td></td><td>TD3 Dense rewards Fujimoto et al. (2018)</td><td>TD3 Episodic rewards</td><td>TD3 Noisy rewards Each rt suppressed w/ 90% prob.(pm = 0.9)</td><td>TD3 Noisy rewards Each rt suppressed w/ 50% prob.(pm = 0.5)</td></tr><tr><td>Walker</td><td>4352</td><td>189</td><td>395</td><td>2417</td></tr><tr><td>Hopper</td><td>3636</td><td>402</td><td>385</td><td>1825</td></tr><tr><td>InvertedDoublePendulum</td><td>9350</td><td>363</td><td>948</td><td>4711</td></tr><tr><td>Swimmer*</td><td>■</td><td></td><td></td><td>1</td></tr><tr><td>Humanoid-Standup*</td><td></td><td></td><td>=</td><td>=</td></tr><tr><td>Humanoid*</td><td></td><td></td><td>=</td><td></td></tr></table>
404
+
405
+ Table 4: Performance of TD3 (Fujimoto et al., 2018) on tasks with episodic rewards, noisy rewards with masking probability $p _ { m }$ , and dense rewards. All runs use 5M timesteps of interaction with the environment.
406
+
407
+ Table 4 shows that the performance of TD3 suffers appreciably with the episodic and noisy $p _ { m } = 0 . 9$ reward settings, indicating that popular off-policy algorithms (DDPG, TD3) do not exploit the past experience in a manner that accelerates learning when rewards are scarce during an episode.
408
+
409
+ \* For 3 tasks used in our paper—Swimmer and the high-dimensional Humanoid, HumanoidStandup—the TD3 code from the authors 3 is unable to learn a good policy even in presence of dense rewards (default Gym rewards). These tasks are also not included in the evaluation by Fujimoto et al. (2018).
410
+
411
+ # 5.11 COMPARING SVPG EXPLORATION TO A NOVELTY-BASED BASELINE
412
+
413
+ We run a new exploration baseline - $\mathrm { E X ^ { 2 } }$ (Fu et al., 2017) and compare its performance to SIinteract-JS on the hard exploration MuJoCo tasks considered in Section 3.2. The $\mathrm { E X ^ { 2 } }$ algorithm does implicit state-density $\rho ( s )$ estimation using discriminative modeling, and uses it for noveltybased exploration by adding $- \log \rho ( s )$ as the bonus. We used the author provided code 4 and hyperparameter settings. TRPO is used as the policy gradient algorithm.
414
+
415
+ Table 5: Performance of $\mathrm { E X ^ { 2 } }$ (Fu et al., 2017) and SI-interact-JS on the hard exploration MuJoCo tasks from Section 3.2. SparseHalfCheetah, SparseHalfCheetah, SparseAnt use 1M, 1M and 2M timesteps of interaction with the environment, respectively. Results are averaged over 3 separate runs.
416
+
417
+ <table><tr><td></td><td>EX²</td><td>SI-interact-JS</td></tr><tr><td>SparseHalfCheetah</td><td>-286</td><td>769</td></tr><tr><td>SparseHopper</td><td>1477</td><td>1949</td></tr><tr><td>SparseAnt</td><td>-3.9</td><td>208</td></tr></table>
md/train/S1g2V3Cct7/S1g2V3Cct7.md ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EXPERIENCE REPLAY FOR CONTINUAL LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Continual learning is the problem of learning new tasks or knowledge while protecting old knowledge and ideally generalizing from old experience to learn new tasks faster. Neural networks trained by stochastic gradient descent often degrade on old tasks when trained successively on new tasks with different data distributions. This phenomenon, referred to as catastrophic forgetting, is considered a major hurdle to learning with non-stationary data or sequences of new tasks, and prevents networks from continually accumulating knowledge and skills. We examine this issue in the context of reinforcement learning, in a setting where an agent is exposed to tasks in a sequence. Unlike most other work, we do not provide an explicit indication to the model of task boundaries, which is the most general circumstance for a learning agent exposed to continuous experience. While various methods to counteract catastrophic forgetting have recently been proposed, we explore a straightforward, general, and seemingly overlooked solution – that of using experience replay buffers for all past events – with a mixture of on- and off-policy learning, leveraging behavioral cloning. We show that this strategy can still learn new tasks quickly yet can substantially reduce catastrophic forgetting in both Atari and DMLab domains, even matching the performance of methods that require task identities. When buffer storage is constrained, we confirm that a simple mechanism for randomly discarding data allows a limited size buffer to perform almost as well as an unbounded one.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Modern day reinforcement learning (RL) has benefited substantially from a massive influx of computational resources. In some instances, the number of data points to feed into RL algorithms has kept in step with computational feasibility. For example, in simulation environments or in self-play RL, it is possible to generate fresh data on the fly. In such settings, the continual learning problem (Ring, 1997) is often ignored because new experiences can be collected on demand, and the start states of the simulation can be controlled. When training on multiple tasks, it is possible to train on all environments simultaneously within the same data batch.
12
+
13
+ As RL is increasingly applied to problems in industry or other real-world settings, however, it is necessary to consider cases, such as robotics, where gathering new experience is expensive or difficult. In such examples, simultaneous training may be infeasible. Instead, an agent must be able to learn from only one task at a time. The time spent on different tasks and the sequence in which those tasks occur are not under the control of the agent. The boundaries between tasks, in fact, will often be unknown – or tasks will deform continuously and not have definite boundaries at all. Such a paradigm for training eliminates the possibility of simultaneously acting upon and learning from several tasks, and leads to the danger of catastrophic forgetting, wherein an agent forgets what it has learned previously when it encounters a new situation.
14
+
15
+ Here, we consider the setting of reinforcement learning where compute and memory resources are large, but the environment is not stationary: this may arise because an RL agent is encountering a task curriculum or sequence of unrelated tasks, engaged in a budgeted physical interaction within a robot, or learning from unstructured interaction with humans. In this setting, the problem of continual learning rears its head: the distribution over experiences is not controlled to facilitate the agent’s maintenance of previously acquired ability.
16
+
17
+ An ideal continual learning system should meet three requirements. First, it should retain previously learned capacities. When a previously encountered task or situation is encountered, performance should immediately be good – ideally as good as it was historically. Second, maintenance of old skills or knowledge should not inhibit further rapid acquisition of a new skill or knowledge. These two simultaneous constraints – maintaining the old while still adapting to the new – represent the challenge known as the stability-plasticity dilemma Grossberg (1982). Third, where possible, a continual learning system should learn new skills that are related to old ones faster than it would have de novo, a property known as constructive interference or positive transfer.
18
+
19
+ ![](images/2f2e8e397f02c2fb4e044236788ce53437ac3519732f819028385a81cf923fc9.jpg)
20
+ Figure 1: Separate, simultaneous, and sequential training: the $x$ -axis denotes environment steps summed across all tasks and the $y$ -axis episode score. In “Sequential”, thick line segments are used to denote the task currently being trained, while thin segments are plotted by evaluating performance without learning. In simultaneous training, performance on explore object locations small is higher than in separate training, an example of modest constructive interference. In sequential training, tasks that are not currently being learned exhibit very dramatic catastrophic forgetting. (See Appendix C for a different plot of these data.)
21
+
22
+ We here demonstrate the surprising power of a simple approach: Continual Learning with Experience And Replay (CLEAR). We show that training a network on a mixture of novel experience on-policy and replay experience off-policy allows for both maintenance of performance on earlier tasks and fast adaptation to new tasks. A significant further boost in performance and reduction in catastrophic forgetting is obtained by enforcing behavioral cloning between the current policy and its past self. While memory is rarely severely limited in modern RL, we show that small replay buffers filled with uniform samples from past experiences can be almost as effective as buffers of unbounded size. When comparing CLEAR against state-of-the-art approaches for reducing catastrophic forgetting, we obtain better or comparable results, despite the relative simplicity of our approach; yet, crucially, CLEAR requires no information about the identity of tasks or boundaries between them.
23
+
24
+ # 2 RELATED WORK
25
+
26
+ The problem of catastrophic forgetting in neural networks has long been recognized (Grossberg, 1982), and it is known that rehearsing past data can be a satisfactory antidote for some purposes (McClelland, 1998; French, 1999). Consequently, in the supervised setting that is the most common paradigm in machine learning, catastrophic forgetting has been accorded less attention than in cognitive science or neuroscience, since a fixed dataset can be reordered and replayed as necessary to ensure high performance on all samples.
27
+
28
+ In recent years, however, there has been renewed interest in overcoming catastrophic forgetting in RL contexts and in supervised learning from streaming data (Parisi et al., 2018). Current strategies for mitigating catastrophic forgetting have primarily focused on schemes for protecting the parameters inferred in one task while training on another. For example, in Elastic Weight Consolidation (EWC) (Kirkpatrick et al., 2017), weights important for past tasks are constrained to change more slowly while learning new tasks. The Progressive Networks approach (Rusu et al., 2016) freezes subnetworks trained on individual tasks, and Progress & Compress (Schwarz et al., 2018) uses EWC to consolidate the network after each task has been learned. Kaplanis et al. (2018) treat individual synaptic weights as dynamical systems with latent dimensions / states that protect information. Outside of RL, Zenke et al. (2017) develop a method similar to EWC that maintains estimates of the importance of weights for past tasks, Li & Hoiem (2017) leverage a mixture of task-specific and shared parameters, and Milan et al. (2016) develop a rigorous Bayesian approach for estimating unknown task boundaries. Notably all these methods assume that task identities or boundaries are known, with the exception of Milan et al. (2016), for which the approach is likely not scalable to highly complex tasks.
29
+
30
+ ![](images/cb086f3d51af01fdad811ec99b216226b67686d5eb249644ae8e52beb016326d.jpg)
31
+ Figure 2: Demonstration of CLEAR on three DMLab tasks, which are trained cyclically in sequence. CLEAR reduces catastrophic forgetting so significantly that sequential tasks train almost as well as simultaneous tasks (see Figure 1). When the behavioral cloning loss terms are ablated, there is still reduced forgetting from off-policy replay alone. As above, thicker line segments are used to denote the task that is currently being trained. (See Appendix C for a different plot of these data.)
32
+
33
+ Rehearsing old data via experience replay buffers is a common technique in RL. However, their introduction has primarily been driven by the goal of data-efficient learning on single tasks (Lin, 1992; Mnih et al., 2015; Gu et al., 2017). Research in this vein has included prioritized replay for maximizing the impact of rare experiences (Schaul et al., 2016), learning from human demonstration data seeded into a buffer (Hester et al., 2017), and methods for approximating replay buffers with generative models (Shin et al., 2017). A noteworthy use of experience replay buffers to protect against catastrophic forgetting was demonstrated in Isele & Cosgun (2018) on toy tasks, with a focus on how buffers can be made smaller. Previous works (Gu et al., 2017; O’Donoghue et al., 2016; Wang et al., 2016) have explored mixing on- and off-policy updates in RL, though these were focused on speed and stability in individual tasks and did not examine continual learning. Here, in CLEAR, we demonstrate that a mixture of replay data and fresh experience protects against catastrophic forgetting while also permitting fast learning, and performs better than either pure onpolicy learning or pure off-policy learning from replay. We provide a thorough investigation and robust algorithm in CLEAR, conducting a wide variety of tests on both limited-size and unbounded buffers with complex RL tasks using state-of-the-art methods, and improve the stability of simple replay with the addition of behavioral cloning.
34
+
35
+ # 3 THE CLEAR METHOD
36
+
37
+ CLEAR uses actor-critic training on a mixture of new and replayed experiences. In the case of replay experiences, two additional loss terms are added to induce behavioral cloning between the network and its past self. The motivation for behavioral cloning is to prevent network output on replayed tasks from drifting while learning new tasks. We penalize (1) the KL divergence between the historical policy distribution and the present policy distribution, (2) the L2 norm of the difference between the historical and present value functions. Formally, this corresponds to adding the following loss functions, defined with respect to network parameters $\theta$ :
38
+
39
+ $$
40
+ L _ { \mathrm { p o l i c y - c l o n i n g } } : = \sum _ { a } \mu ( a | h _ { s } ) \log { \frac { \mu ( a | h _ { s } ) } { \pi _ { \theta } ( a | h _ { s } ) } } ,
41
+ $$
42
+
43
+ $$
44
+ L _ { \mathrm { v a l u e - c l o n i n g } } : = | | V _ { \theta } ( h _ { s } ) - V _ { \mathrm { r e p l a y } } ( h _ { s } ) | | _ { 2 } ^ { 2 } ,
45
+ $$
46
+
47
+ where $\pi _ { \theta }$ denotes the (current) policy of the network over actions $a , \mu$ the policy generating the observed experience, and $h _ { s }$ the hidden state of the network at time $s$ . Note that computing $\bar { \mathrm { K L } } [ \mu | | \pi _ { \theta } ]$ instead of $\operatorname { K L } [ \pi _ { \boldsymbol { \theta } } | | \mu ]$ ensures that $\pi _ { \boldsymbol { \theta } } ( a | h _ { s } )$ is nonzero wherever the historical policy is as well.
48
+
49
+ We apply CLEAR in a distributed training context based on the Importance Weighted Actor-Learner Architecture (Espeholt et al., 2018). A single learning network is fed experiences (both novel and
50
+
51
+ ![](images/2eafc7a1ca6c7c1be52871ecd3f8172b22ac53af14a7311a7911455d3b0ff395.jpg)
52
+ Figure 3: Comparison between different proportions of new and replay examples while cycling training among three tasks. We observe that with a 75-25 new-replay split, CLEAR eliminates most, but not all, catastrophic forgetting. At the opposite extreme, $100 \%$ replay prevents forgetting at the expense of reduced overall performance (with an especially noticeable reduction in early performance on the task rooms keys doors puzzle). A 50-50 split represents a good tradeoff between these extremes. (See Appendix C for a different plot of these data.)
53
+
54
+ replay) by a number of acting networks, for which the weights are asynchronously updated to match those of the learner. The network architecture and hyperparameters are chosen as in Espeholt et al. (2018). Training proceeds according to V-Trace. Namely, define the V-Trace target $v _ { s }$ by:
55
+
56
+ $$
57
+ v _ { s } : = V ( h _ { s } ) + \sum _ { t = s } ^ { s + n - 1 } \gamma ^ { t - s } \left( \prod _ { i = s } ^ { t - 1 } c _ { i } \right) \delta _ { t } V ,
58
+ $$
59
+
60
+ where $\delta _ { t } V : = \rho _ { t } \left( r _ { t } + \gamma V ( h _ { t + 1 } ) - V ( h _ { t } ) \right)$ , $\begin{array} { r } { c _ { i } : = \operatorname* { m i n } ( \bar { c } , \frac { \pi _ { \theta } ( a _ { i } | h _ { i } ) } { \mu ( a _ { i } | h _ { i } ) } ) } \end{array}$ , and $\begin{array} { r } { \rho _ { t } = \operatorname* { m i n } ( \bar { \rho } , \frac { \pi _ { \theta } ( a _ { t } | h _ { t } ) } { \mu ( a _ { t } | h _ { t } ) } ) } \end{array}$ , for constants $\bar { c }$ and $\bar { \rho }$ .
61
+
62
+ Then, the value function update is given by the L2 loss:
63
+
64
+ $$
65
+ L _ { \mathrm { v a l u e } } : = \left( V _ { \theta } ( h _ { s } ) - v _ { s } \right) ^ { 2 } .
66
+ $$
67
+
68
+ The policy gradient loss is:
69
+
70
+ $$
71
+ \begin{array} { r } { L _ { \mathrm { p o l i c y - g r a d i e n t } } : = - \rho _ { s } \log \pi _ { \theta } ( a _ { s } | h _ { s } ) \left( r _ { s } + \gamma v _ { s + 1 } - V _ { \theta } ( h _ { s } ) \right) . } \end{array}
72
+ $$
73
+
74
+ We also use an entropy loss:
75
+
76
+ $$
77
+ L _ { \mathrm { e n t r o p y } } : = \sum _ { a } \pi _ { \theta } ( a | h _ { s } ) \log \pi _ { \theta } ( a | h _ { s } ) .
78
+ $$
79
+
80
+ The loss functions $L _ { \mathrm { v a l u e } }$ , $L _ { \mathrm { p o l i c y - g r a d i e n t } }$ , and $L _ { \mathrm { e n t r o p y } }$ are applied both for new and replay experiences. In addition, we add $L _ { \mathrm { p o l i c y - c l o n i n g } }$ and $L _ { \mathrm { v a l u e - c l o n i n g } }$ for replay experiences only. In general, our experiments use a 50-50 mixture of novel and replay experiences, though performance does not appear to be very sensitive to this ratio. Further implementation details are given in Appendix A.
81
+
82
+ # 4 RESULTS
83
+
84
+ # 4.1 CATASTROPHIC FORGETTING VS. INTERFERENCE
85
+
86
+ Our first experiment (Figure 1) was designed to distinguish between two distinct concepts that are sometimes conflated, interference and catastrophic forgetting, and to emphasize the outsized role of the latter as compared to the former. Interference occurs when two or more tasks are incompatible (destructive interference) or mutually helpful (constructive interference) within the same model. Catastrophic forgetting occurs when a task’s performance goes down not as a result of incompatibility with another task but as a result of the second task overwriting it within the model. As we aim to illustrate, the two are independent phenomena, and while interference may happen, forgetting is ubiquitous.
87
+
88
+ We considered a set of three distinct tasks within the DMLab set of environments (Beattie et al., 2016), and compared three training paradigms on which a network may be trained to perform these three tasks: (1) Training networks on the individual tasks separately, (2) training a single network examples from all tasks simultaneously (which permits interference among tasks), and (3) training a single network sequentially on examples from one task, then the next task, and so on cyclically. Across all training protocols, the total amount of experience for each task was held constant. Thus, for separate networks training on separate tasks, the $x$ -axis in our plots shows the total number of environment frames summed across all tasks. For example, at three million frames, one million were on task 1, one million on task 2, and one million on task 3. This allows a direct comparison to simultaneous training, in which the same network was trained on all three tasks.
89
+
90
+ ![](images/47e101294e49148bab9ed0b66dd2d526575f7c469e3b5ebf880e5002a42edafe.jpg)
91
+ Figure 4: Comparison of the performance of training with different buffer sizes, using reservoir sampling to ensure that each buffer stores a uniform sample from all past experience. We observe only minimal difference in performance, with the smallest buffer (storing 1 in 200 experiences) demonstrating some catastrophic forgetting. (See Appendix C for a different plot of these data.)
92
+
93
+ We observe that in DMLab, there is very little difference between separate and simultaneous training. This indicates minimal interference between tasks. If anything, there is a small amount of constructive interference, with simultaneous training performing slightly better than separate training. We assume this is a result of (i) commonalities in image processing required across different tasks, and (ii) certain basic exploratory behaviors, e.g., moving around, that are advantageous across tasks. (By contrast, destructive interference might result from incompatible behaviors or from insufficient model capacity.)
94
+
95
+ By contrast, there is a large difference between either of the above modes of training and sequential training, where performance on a task decays immediately when training switches to another task – that is, catastrophic forgetting. Note that the performance of the sequential training appears at some points to be greater than that of separate training. This is purely because in sequential training, training proceeds exclusively on a single task, then exclusively on another task. For example, the first task quickly increases in performance since the network is effectively seeing three times as much data on that task as the networks training on separate or simultaneous tasks.
96
+
97
+ # 4.2 CLEAR
98
+
99
+ We here demonstrate the efficacy of CLEAR for diminishing catastrophic forgetting (Figure 2). We apply CLEAR to the cyclically repeating sequence of DMLab tasks used in the preceding experiment. Our method effectively eliminates forgetting on all three tasks, while preserving overall training performance (see “Sequential” training in Figure 1 for reference). When the task switches, there is little, if any, dropoff in performance when using CLEAR, and the network picks up immediately where it left off once a task returns later in training. Without behavioral cloning, the mixture of new experience and replay still reduces catastrophic forgetting, though the effect is reduced.
100
+
101
+ # 4.3 BALANCE OF ON- AND OFF-POLICY LEARNING
102
+
103
+ In this experiment (Figure 3), we consider the ratio of new examples to replay examples during training. Using $100 \%$ new examples is simply standard training, which as we have seen is subject to dramatic catastrophic forgetting. At 75-25 new-replay, there is already significant resistance to forgetting. At the opposite extreme, $100 \%$ replay examples is extremely resistant to catastrophic forgetting, but at the expense of a (slight) decrease in performance attained. We believe that 50- 50 new-replay represents a good tradeoff, combining significantly reduced catastrophic forgetting with no appreciable decrease in performance attained. Unless otherwise stated, our experiments on CLEAR will use a 50-50 split of new and replay data in training.
104
+
105
+ ![](images/6218075b072f0c8049d2f1132cb0160eb8889f9b62be607d20a1da603c7a9047.jpg)
106
+ Figure 5: The DMLab task natlab varying map randomize (brown line) is presented at different positions within a cyclically repeating sequence of three other DMLab tasks. We find that (1) performance on the probe task is independent of its position in the sequence, (2) the effectiveness of CLEAR does not degrade as more experiences and tasks are introduced into the buffer.
107
+
108
+ It is notable that it is possible to train purely on replay examples, since the network has essentially no on-policy learning. In fact, the figure shows that with $100 \%$ replay, performance on each task increases throughout, even when on-policy learning is being applied to a different task. Just as Figure 2 shows the importance of behavioral cloning for maintaining past performance on a task, so this experiment shows that off-policy learning can actually increase performance from replay alone. Both ingredients are necessary for the success of CLEAR.
109
+
110
+ # 4.4 LIMITED-SIZE BUFFERS
111
+
112
+ In some cases, it may be impractical to store all past experiences in the replay buffer. We therefore test the efficacy of buffers that have capacity for only a relatively small number of experiences (Figure 4). Once the buffer is full, we use reservoir sampling to decide when to replace elements of the buffer with new experiences (Isele & Cosgun, 2018) (see details in Appendix A). Thus, at each point in time, the buffer contains a (fixed size) sample uniformly at random of all past experiences.
113
+
114
+ We consider a sequence of tasks with 900 million environmental frames, comparing a large buffer of capacity 450 million to two small buffers of capacity 5 and 50 million. We find that all buffers perform well and conclude that it is possible to learn and reduce catastrophic forgetting even with a replay buffer that is significantly smaller than the total number of experiences. Decreasing the buffer size to 5 million results in a slight decrease in robustness to catastrophic forgetting. This may be due to over-fitting to the limited examples present in the buffer, on which the learner trains disproportionately often.
115
+
116
+ # 4.5 LEARNING A NEW TASK QUICKLY
117
+
118
+ It is a reasonable worry that relying on a replay buffer could cause new tasks to be learned more slowly as the new task data will make up a smaller and smaller portion of the replay buffer as the buffer gets larger. In this experiment (Figure 5), we find that this is not a problem for CLEAR, relying as it does on a mixture of off- and on-policy learning. Specifically, we find the performance attained on a task is largely independent of the amount of data stored in the buffer and on the identities of the preceding tasks. We consider a cyclically repeating sequence of three DMLab tasks. At different points in the sequence, we insert a fourth DMLab task as a “probe”. We find that the performance attained on the probe task is independent of the point at which it is introduced within the training sequence. This is true both for normal training and for CLEAR. Notably, CLEAR succeeds in greatly reducing catastrophic forgetting for all tasks, and the effect on the probe task does not diminish as the probe task is introduced later on in the training sequence. See also Appendix B for an experiment demonstrating that pure off-policy learning performs quite differently in this setting.
119
+
120
+ # 4.6 COMPARISON TO P&C AND EWC
121
+
122
+ Finally, we compare our method to Progress & Compress (P&C) (Schwarz et al., 2018) and Elastic Weight Consolidation (EWC) (Kirkpatrick et al., 2017), state-of-the-art methods for reducing catastrophic forgetting that, unlike replay, assume that the boundaries between different tasks are known (Figure 6). We use exactly the same sequence of Atari tasks as the authors of P&C (Schwarz et al., 2018), with the same time spent on each task. Likewise, the network and hyperparameters we use are designed to match exactly those used in Schwarz et al. (2018). This is simplified by the authors of P&C also using a training paradigm based on that in Espeholt et al. (2018). In this case, we use CLEAR with a 75-25 balance of new-replay experience.
123
+
124
+ We find that we obtain comparable performance to P&C and better performance than EWC, despite CLEAR being significantly simpler and agnostic to the boundaries between tasks. On tasks krull, hero, and ms pacman, we obtain significantly higher performance than P&C (as well as EWC), while on beam rider and star gunner, P&C obtains higher performance. It is worth noting that though the on-policy model (baseline) experiences significant catastrophic forgetting, it also rapidly re-acquires its previous performance after re-exposure to the task; this allows baseline to be cumulatively better than EWC on some tasks (as is noted in the original paper Kirkpatrick et al. (2017)). An alternative plot of this experiment, showing cumulative performance on each task, is presented in Appendix C.
125
+
126
+ # 5 DISCUSSION
127
+
128
+ Some version of replay is believed to be present in biological brains. We do not believe that our implementation is reflective of neurobiology, though there are potential connections; hippocampal replay has been proposed as a systems-level mechanism to reduce catastrophic forgetting and improve generalization as in the theory of complementary learning systems (McClelland, 1998). This contrasts to some degree with synapse-level consolidation, which is also believed to be present in biology (Benna & Fusi, 2016), but is more like continual learning methods that protect parameters.
129
+
130
+ Indeed, algorithms for continual learning may live on a Pareto frontier: different methods may have different regimes of applicability. In cases for which storing a large memory buffer is truly prohibitive, methods that protect inferred parameters, such as Progress & Compress, may be more suitable than replay methods. When task identities are available or boundaries between tasks are very clear, leveraging this information may reduce memory or computational demands or be useful to alert the agent to engage in rapid learning. Further, there exist training scenarios that are adversarial either to our method or to any method that prevents forgetting. For example, if the action space of a task were changed during training, fitting to the old policy’s action distribution, whether through behavioral cloning, off-policy learning, weight protection, or any of a number of other strategies for preventing catastrophic forgetting, could have a deleterious effect on future performance. For such cases, we may need to develop algorithms that selectively protect skills as well as forget them.
131
+
132
+ ![](images/5a16653237c5e89a85928694b32a4fd98d9904a59816efa45cd016632315b34c.jpg)
133
+ Figure 6: Comparison of CLEAR to Progress & Compress (P&C) and Elastic Weight Consolidation (EWC). We find that CLEAR demonstrates comparable or greater performance than these methods, despite being significantly simpler and not requiring any knowledge of boundaries between tasks. (See Appendix C for a different plot of these data.)
134
+
135
+ We have explored CLEAR in a range of continual learning scenarios; we hope that some of the experimental protocols, such as probing with a novel task at varied positions in a training sequence, may inspire other research. Moving forward, we anticipate many algorithmic innovations that build on the ideas set forward here. For example, weight-consolidation techniques such as Progress & Compress are quite orthogonal to our approach and could be married with it for further performance gains. Moreover, while the V-Trace algorithm we use is effective at off-policy correction for small shifts between the present and past policy distributions, it is possible that off-policy approaches leveraging Q-functions, such as Retrace (Munos et al., 2016), may prove more powerful still.
136
+
137
+ We have described a simple but powerful approach for preventing catastrophic forgetting in continual learning settings. CLEAR uses on-policy learning on fresh experiences to adapt rapidly to new tasks, while using off-policy learning with behavioral cloning on replay experience to maintain and modestly enhance performance on past tasks. Behavioral cloning on replay data further enhances the agent’s stability. Our method is simple, scalable, and practical; it takes advantage of the general abundance of memory and storage in modern computers and computing facilities. We believe that the broad applicability and simplicity of the approach make CLEAR a candidate “first line of defense” against catastrophic forgetting in many RL contexts.
138
+
139
+ # REFERENCES
140
+
141
+ 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. ´ Preprint arXiv:1612.03801, 2016.
142
+
143
+ Marcus K Benna and Stefano Fusi. Computational principles of synaptic memory consolidation. Nature neuroscience, 19(12):1697, 2016.
144
+
145
+ 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. In ICML, 2018.
146
+
147
+ Robert M French. Catastrophic forgetting in connectionist networks. Trends in cognitive sciences, 3(4):128–135, 1999.
148
+
149
+ Stephen Grossberg. How does a brain build a cognitive code? In Studies of mind and brain, pp. 1–52. Springer, 1982.
150
+
151
+ Shixiang Gu, Tim Lillicrap, Richard E Turner, Zoubin Ghahramani, Bernhard Scholkopf, and Sergey ¨ Levine. Interpolated policy gradient: Merging on-policy and off-policy gradient estimation for deep reinforcement learning. In NIPS, 2017.
152
+
153
+ Todd Hester, Matej Vecerik, Olivier Pietquin, Marc Lanctot, Tom Schaul, Bilal Piot, Dan Horgan, John Quan, Andrew Sendonaris, Gabriel Dulac-Arnold, et al. Deep Q-learning from demonstrations. Preprint arXiv:1704.03732, 2017.
154
+
155
+ David Isele and Akansel Cosgun. Selective experience replay for lifelong learning. In AAAI, 2018.
156
+
157
+ Christos Kaplanis, Murray Shanahan, and Claudia Clopath. Continual reinforcement learning with complex synapses. Preprint arXiv:1802.07239, 2018.
158
+
159
+ James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. Overcoming catastrophic forgetting in neural networks. In Proceedings of the National Academy of Sciences, 2017.
160
+
161
+ Zhizhong Li and Derek Hoiem. Learning without forgetting. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2017.
162
+
163
+ Long-Ji Lin. Self-improving reactive agents based on reinforcement learning, planning and teaching. Machine learning, 8(3-4):293–321, 1992.
164
+
165
+ James L McClelland. Complementary learning systems in the brain: A connectionist approach to explicit and implicit cognition and memory. Annals of the New York Academy of Sciences, 843 (1):153–169, 1998.
166
+
167
+ Kieran Milan, Joel Veness, James Kirkpatrick, Michael Bowling, Anna Koop, and Demis Hassabis. The forget-me-not process. In NIPS, 2016.
168
+
169
+ 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.
170
+
171
+ Remi Munos, Tom Stepleton, Anna Harutyunyan, and Marc Bellemare. Safe and efficient off-policy ´ reinforcement learning. In NIPS, 2016.
172
+
173
+ Brendan O’Donoghue, Remi Munos, Koray Kavukcuoglu, and Volodymyr Mnih. Combining policy gradient and Q-learning. Preprint arXiv:1611.01626, 2016.
174
+
175
+ German I Parisi, Ronald Kemker, Jose L Part, Christopher Kanan, and Stefan Wermter. Continual lifelong learning with neural networks: A review. Preprint arXiv:1802.07569, 2018.
176
+
177
+ Mark B Ring. Child: A first step towards continual learning. Machine Learning, 28(1):77–104, 1997.
178
+
179
+ Andrei A Rusu, Neil C Rabinowitz, Guillaume Desjardins, Hubert Soyer, James Kirkpatrick, Koray Kavukcuoglu, Razvan Pascanu, and Raia Hadsell. Progressive neural networks. Preprint arXiv:1606.04671, 2016.
180
+
181
+ Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. Prioritized experience replay. In ICLR, 2016.
182
+
183
+ Jonathan Schwarz, Jelena Luketina, Wojciech M Czarnecki, Agnieszka Grabska-Barwinska, Yee Whye Teh, Razvan Pascanu, and Raia Hadsell. Progress & compress: A scalable framework for continual learning. In ICML, 2018.
184
+
185
+ Hanul Shin, Jung Kwon Lee, Jaehong Kim, and Jiwon Kim. Continual learning with deep generative replay. In NIPS, 2017.
186
+
187
+ Ziyu Wang, Victor Bapst, Nicolas Heess, Volodymyr Mnih, Remi Munos, Koray Kavukcuoglu, and Nando de Freitas. Sample efficient actor-critic with experience replay. Preprint arXiv:1611.01224, 2016.
188
+
189
+ Friedemann Zenke, Ben Poole, and Surya Ganguli. Continual learning through synaptic intelligence. In ICML, 2017.
190
+
191
+ # A IMPLEMENTATION DETAILS
192
+
193
+ # A.1 DISTRIBUTED SETUP
194
+
195
+ Our training setup was based on that of Espeholt et al. (2018), with multiple actors and a single learner. The actors (which run on CPU) generate training examples, which are then sent to the learner. Weight updates made by the learner are propagated asynchronously to the actors. The workflows for each actor and for the learner are described below in more detail.
196
+
197
+ Actor. A training episode (unroll) is generated and inserted into the actor’s buffer. Reservoir sampling is used (see further details below) if the buffer has reached its maximum capacity. The actor then samples another unroll from the buffer. The new unroll and replay unroll are both fed into a queue of examples that are read by the learner. The actor waits until its last example in the queue has been read before creating another.
198
+
199
+ Learner. Each element of a batch is a pair (new unroll, replay unroll) from the queue provided by actors. Thus, the number of new unrolls and the number of replay unrolls both equal the entire batch size. Depending on the buffer utilization hyperparameter (see Figure 3), the learner uses a balance of new and replay examples, taking either the new unroll or the replay unroll from each pair. Thus, no actor contributes more than a single example to the batch (reducing the variance of batches).
200
+
201
+ # A.2 NETWORK
202
+
203
+ For our DMLab experiments, we used the same network as in the DMLab experiments of Espeholt et al. (2018). We selected the shallower of the models considered there (a network based on Mnih et al. (2015)), omitting the additional LSTM module used for processing textual input since none of the tasks we considered included such input. For Atari, we used the same network in Progress & Compress (Schwarz et al., 2018) (which is also based on Espeholt et al. (2018)), also copying all hyperparameters.
204
+
205
+ # A.3 BUFFERS
206
+
207
+ Our replay buffer stores all information necessary for the V-Trace algorithm, namely the input presented by the environment, the output logits of the network, the value function output by the network, the action taken, and the reward obtained. Leveraging the distributed setup, the buffer is split among all actors equally, so that, for example, if the total buffer size were one million across a hundred actors, then each actor would have buffer capacity of ten thousand. All buffer sizes are measured in environment frames (not in numbers of unrolls), in keeping with the $x$ -axis of our training plots.
208
+
209
+ For baseline experiments, no buffer was used, while all other parameters and the network remained constant.
210
+
211
+ Unless otherwise specified, the replay buffer was capped at half the number of environment frames on which the network is trained. This is by design – to show that even past the buffer capacity, replay continues to prevent catastrophic forgetting. When the buffer fills up, then new unrolls are added by reservoir sampling, so that the buffer at any given point contains a uniformly random sample of all unrolls up until the present time. Reservoir sampling is implemented as in Isele & Cosgun (2018) by having each unroll associated with a random number between 0 and 1. A threshold is initialized to 0 and rises with time so that the number of unrolls above the threshold is fixed at the capacity of the buffer. Each unroll is either stored or abandoned in its entirety; no unroll is partially stored, as this would preclude training.
212
+
213
+ # A.4 TRAINING
214
+
215
+ Training was conducted using V-Trace, with hyperparameters on DMLab/Atari tasks set as in Espeholt et al. (2018). Behavioral cloning loss functions $L _ { \mathrm { p o l i c y - c l o n i n g } }$ and $L _ { \mathrm { v a l u e - c l o n i n g } }$ were added in some experiments with weights of 0.01 and 0.005, respectively. The established loss functions Lpolicy-gradient, $L _ { \mathrm { v a l u e } }$ , and $L _ { \mathrm { e n t r o p y } }$ were applied with weights of 1, 0.5, and ${ \approx } 0 . 0 0 5$ , in keeping with Espeholt et al. (2018). No significant effort was made to optimize fully the hyperparameters for CLEAR.
216
+
217
+ # A.5 EVALUATION
218
+
219
+ We evaluate each network during training on all tasks, not simply that task on which it is currently being trained. Evaluation is performed by pools of testing actors, with a separate pool for each task in question. Each pool of testing actors asynchronously updates its weights to match those of the learner, similarly to the standard (training) actors used in our distributed learning setup. The key differences are that each testing actor (i) has no replay buffer, (ii) does not feed examples to the learner for training, (iii) runs on its designated task regardless of whether this task is the one currently in use by training actors.
220
+
221
+ # A.6 EXPERIMENTS
222
+
223
+ In many of our experiments, we consider tasks that change after a specified number of learning episodes. The total number of episodes is monitored by the learner, and all actors switch between tasks simultaneously at the designated point, henceforward feeding examples to the learner based on experiences on the new task (as well as replay examples). Each experiment was run independently three times; figures plot the mean performance across runs, with error bars showing the standard deviation.
224
+
225
+ # B PROBE TASK WITH $100 \%$ REPLAY
226
+
227
+ Our goal in this experiment was to investigate more thoroughly than Figure 3 to what extent the mixture of on- and off-policy learning is necessary, instead of pure off-policy learning, in learning new tasks swiftly. We rerun our “probe task” experiments (Section 4.5), where the DMLab task natlab varying map randomized is presented at different positions in a cyclically repeating sequence of other DMLab tasks. In this case, however, we use CLEAR with $100 \%$ (off-policy) replay experience. We observe that, unlike in the original experiment (Figure 5), the performance obtained on the probe task natlab varying map randomized deteriorates markedly as it appears later in the sequence of tasks. For later positions in the sequence, the probe task comprises a smaller percentage of replay experience, thereby impeding purely off-policy learning. This result underlines why CLEAR uses new experience, as well as replay, to allow rapid learning of new tasks.
228
+
229
+ ![](images/82f14b109e25ca17227e98ed4906725dc46304c60d185fbc72358fb992cabd45.jpg)
230
+ Figure 7: This figure shows the same “probe task” setup as Figure 5, but with CLEAR using $100 \%$ replay experience. Performance on the probe task natlab varying map randomized decreases markedly as it appears later in the sequence of tasks, emphasizing the importance of using a blend of new experience and replay instead of $100 \%$ replay.
231
+
232
+ # C FIGURES REPLOTTED ACCORDING TO CUMULATIVE SUM
233
+
234
+ In this section, we replot the results of our main experiments, so that the $y$ -axis shows the mean cumulative reward obtained on each task during training; that is, the reward shown for time $t$ is the average $( 1 / t ) \sum _ { s < t } r _ { s }$ . This makes it easier to compare performance between models, though it smoothes out the individual periods of catastrophic forgetting. We also include tables comparing the values of the final cumulative rewards at the end of training.
235
+
236
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>explore...</td><td rowspan=1 colspan=1>rooms_collect...</td><td rowspan=1 colspan=1>rooms_keys...</td></tr><tr><td rowspan=1 colspan=1>Separate</td><td rowspan=1 colspan=1>29.24</td><td rowspan=1 colspan=1>8.79</td><td rowspan=1 colspan=1>19.91</td></tr><tr><td rowspan=1 colspan=1>Simultaneous</td><td rowspan=1 colspan=1>32.35</td><td rowspan=1 colspan=1>8.81</td><td rowspan=1 colspan=1>20.56</td></tr><tr><td rowspan=1 colspan=1>Sequential (no CLEAR)</td><td rowspan=1 colspan=1>17.99</td><td rowspan=1 colspan=1>5.01</td><td rowspan=1 colspan=1>10.87</td></tr><tr><td rowspan=1 colspan=1>CLEAR (50-50 new-replay)</td><td rowspan=1 colspan=1>31.40</td><td rowspan=1 colspan=1>8.00</td><td rowspan=1 colspan=1>18.13</td></tr><tr><td rowspan=1 colspan=1>CLEAR w/o behavioral cloning</td><td rowspan=1 colspan=1>28.66</td><td rowspan=1 colspan=1>7.79</td><td rowspan=1 colspan=1>16.63</td></tr><tr><td rowspan=1 colspan=1>CLEAR, 75-25 new-replay</td><td rowspan=1 colspan=1>30.28</td><td rowspan=1 colspan=1>7.83</td><td rowspan=1 colspan=1>17.86</td></tr><tr><td rowspan=1 colspan=1>CLEAR,100% replay</td><td rowspan=1 colspan=1>31.09</td><td rowspan=1 colspan=1>7.48</td><td rowspan=1 colspan=1>13.39</td></tr><tr><td rowspan=1 colspan=1>CLEAR,buffer5M</td><td rowspan=1 colspan=1>30.33</td><td rowspan=1 colspan=1>8.00</td><td rowspan=1 colspan=1>18.07</td></tr><tr><td rowspan=1 colspan=1>CLEAR,buffer 50M</td><td rowspan=1 colspan=1>30.82</td><td rowspan=1 colspan=1>7.99</td><td rowspan=1 colspan=1>18.21</td></tr></table>
237
+
238
+ ![](images/daf0d1b74b06e2d16d0138065bacc4f9791038986d3ee878f871910f54e23e89.jpg)
239
+ Figure 8: Quantitative comparison of the final cumulative performance between standard training (“Sequential (no CLEAR)”) and various versions of CLEAR (see Figures 9, 10, 11, and 12 below) on a cyclically repeating sequence of DMLab tasks. We also include the results of training on each individual task with a separate network (“Separate”) and on all tasks simultaneously (“Simultaneous”) instead of sequentially. As described in Section 4.1, these situations represent no-forgetting scenarios and thus present upper bounds on the performance expected in a continual learning setting, where tasks are presented sequentially. Remarkably, CLEAR achieves performance comparable to “Separate” and “Simultaneous”, demonstrating that forgetting is virtually eliminated.
240
+ Figure 9: Alternative plot of the experiments shown in Figure 1, showing the difference in cumulative performance between training on tasks separately, simultaneously, and sequentially (without using CLEAR). The marked decrease in performance for sequential training is due to catastrophic forgetting. As in our earlier plots, thicker line segments are used to denote times at which the network is gaining new experience on a given task.
241
+
242
+ ![](images/55261fe95d499a1663f48d11348a53227eaf6ce98736d360b1b76681ea545d05.jpg)
243
+ Figure 10: Alternative plot of the experiments shown in Figure 2, showing how applying CLEAR when training on sequentially presented tasks gives almost the same results as training on all tasks simultaneously (compare to sequential and simultaneous training in Figure 9 above). Applying CLEAR without behavioral cloning also yields decent results.
244
+
245
+ ![](images/11d8ea8904016133e59f70f61c531a020561649bb8bbff91bee61ea8e356d851.jpg)
246
+ Figure 11: Alternative plot of the experiments shown in Figure 3, comparing performance between using CLEAR with 75-25 new-replay experience, 50-50 new-replay experience, and $100 \%$ replay experience. An equal balance of new and replay experience seems to represent a good tradeoff between stability and plasticity, while $100 \%$ replay reduces forgetting but lowers performance overall.
247
+
248
+ ![](images/66269e241cd72c0f9e2fb3fbc361e24ce26e1033433b84119dd340560205801a.jpg)
249
+ Figure 12: Alternative plot of the experiments shown in Figure 4, showing that reduced-size buffers still allow CLEAR to achieve essentially the same performance.
250
+
251
+ Figure 13: Quantitative comparison of the final cumulative performance between baseline (standard training), CLEAR, Elastic Weight Consolidation (EWC), and Progress & Compress (P&C) (see Figure 14 below). Overall, CLEAR performs comparably to or better than P&C, and significantly better than EWC and baseline.
252
+
253
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>space_invaders</td><td rowspan=1 colspan=1>krull</td><td rowspan=1 colspan=1>beam_rider</td><td rowspan=1 colspan=1>hero</td><td rowspan=1 colspan=1>star-gunner</td><td rowspan=1 colspan=1>ms-pacman</td></tr><tr><td rowspan=1 colspan=1>Baseline</td><td rowspan=1 colspan=1>346.47</td><td rowspan=1 colspan=1>5512.36</td><td rowspan=1 colspan=1>952.72</td><td rowspan=1 colspan=1>2737.32</td><td rowspan=1 colspan=1>1065.20</td><td rowspan=1 colspan=1>753.83</td></tr><tr><td rowspan=1 colspan=1>CLEAR</td><td rowspan=1 colspan=1>426.72</td><td rowspan=1 colspan=1>8845.12</td><td rowspan=1 colspan=1>585.05</td><td rowspan=1 colspan=1>8106.22</td><td rowspan=1 colspan=1>991.74</td><td rowspan=1 colspan=1>1222.82</td></tr><tr><td rowspan=1 colspan=1>EWC</td><td rowspan=1 colspan=1>549.22</td><td rowspan=1 colspan=1>5352.92</td><td rowspan=1 colspan=1>432.78</td><td rowspan=1 colspan=1>4499.35</td><td rowspan=1 colspan=1>704.20</td><td rowspan=1 colspan=1>639.75</td></tr><tr><td rowspan=1 colspan=1>P&amp;C</td><td rowspan=1 colspan=1>455.34</td><td rowspan=1 colspan=1>7025.40</td><td rowspan=1 colspan=1>743.38</td><td rowspan=1 colspan=1>3433.10</td><td rowspan=1 colspan=1>1261.86</td><td rowspan=1 colspan=1>924.52</td></tr></table>
254
+
255
+ ![](images/e69e52e550d426a64e883ac2eee1eabc869e4fe44e4b41fe0eb0b5704c777283.jpg)
256
+ Figure 14: Alternative plot of the experiments shown in Figure 6, showing that CLEAR attains comparable or better performance than the more complicated methods Progress & Compress (P&C) and Elastic Weight Consolidation (EWC), which also require information about task boundaries, unlike CLEAR.
md/train/S1gBz2C9tX/S1gBz2C9tX.md ADDED
@@ -0,0 +1,410 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # IMPORTANCE RESAMPLING FOR OFF-POLICY POLICY EVALUATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Importance sampling is a common approach to off-policy learning in reinforcement learning. While it is consistent and unbiased, it can result in high variance updates to the parameters for the value function. Weighted importance sampling (WIS) has been explored to reduce variance for off-policy policy evaluation, but only for linear value function approximation. In this work, we explore a resampling strategy to reduce variance, rather than a reweighting strategy. We propose Importance Resampling (IR) for off-policy learning, that resamples experience from the replay buffer and applies a standard on-policy update. The approach avoids using importance sampling ratios directly in the update, instead correcting the distribution over transitions before the update. We characterize the bias and consistency of the our estimator, particularly compared to WIS. We then demonstrate in several toy domains that IR has improved sample efficiency and parameter sensitivity, as compared to several baseline WIS estimators and to IS. We conclude with a demonstration showing IR improves over IS for learning a value function from images in a racing car simulator.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ An important component of many learning systems is learning value functions for many policies. Some examples of such systems are the Horde architecture composed of General Value Functions (GVFs) (Sutton et al., 2011; Modayil et al., 2014), systems that use options (Sutton et al., 1999; Schaul et al., 2015a), predictive representation approaches (Sutton et al., 2005; Schaul and Ring, 2013; Silver et al., 2017) and systems with auxiliary tasks (Jaderberg et al., 2017). For each target policy, the value function returns the expected return from a state, and can provide useful information about (long-term) outcomes under different behaviors. Off-policy learning is critical for learning many value functions with different policies at scale, because it enables data to be generated from one behavior policy to update the values for each target policy in parallel.
12
+
13
+ The typical strategy for off-policy learning is to use importance sampling (IS). For a given state $s$ , with action $a$ selected according to behaviour $\mu$ , the importance sampling ratio is the ratio between the probability of the action under the target policy $\pi$ and the behaviour: $\frac { \pi ( a | s ) } { \mu ( a | s ) }$ . The update is multiplied by this ratio, adjusting the action probabilities so that the expectation of the update is as if the actions were sampled according to the target policy $\pi$ . Though the IS estimator is unbiased and consistent (Kahn and Marshall, 1953; Rubinstein and Kroese, 2016), it can suffer from high or even infinite variance due to large magnitude IS ratios, in theory (Andradottir et al., 1995) and in practice (Precup et al., 2001; Mahmood et al., 2014; 2017).
14
+
15
+ There have been some attempts to modify policy evaluation algorithms to mitigate this variance.1 Weighted IS (WIS) algorithms have been introduced (Precup et al., 2001; Mahmood et al., 2014; Mahmood and Sutton, 2015), which normalize each update by the sample average of the ratios. These algorithms did improve learning over standard IS strategies, but are not straightforward to extend to nonlinear function approximation. In the offline setting, a reweighting scheme, called importance sampling with unequal support (Thomas and Brunskill, 2017), was introduced to account for samples where the ratio is zero, in some cases significantly reducing variance. Another strategy has been to use rescaling or truncation of IS ratios, such as in V-trace (Espeholt et al., 2018). Several other methods have introduced bias similarly for algorithms with eligibility traces by truncating or scaling IS ratios to maintain stability of the eligibility trace vector, including Tree-Backup (Precup et al., 2000), Retrace (Munos et al., 2016) and ABQ (Mahmood et al., 2017). Truncation of IS-ratios in V-trace can incur significant bias, and this additional truncation parameter does need to be tuned.
16
+
17
+ An alternative to reweighting updates is to instead correct the distribution before updating the estimator using weighted bootstrap sampling: resampling a new set of data from the previously generated samples (Smith et al., 1992; Arulampalam et al., 2002). Consider a setting where a buffer of data is stored, generated by a behavior policy. Samples for policy $\pi$ can be obtained by resampling from this buffer, proportionally to $\frac { \pi ( a | s ) } { \mu ( a | s ) }$ for state-action pairs $( s , a )$ in the buffer. In the sampling literature, this strategy has been proposed under the name Sampling Importance Resampling (SIR) (Rubin, 1988; Smith et al., 1992; Gordon et al., 1993), and has been particularly successful for Sequential Monte Carlo sampling (Gordon et al., 1993; Skare et al., 2003). Such resampling strategies have also been popular in classification, with over-sampling or under-sampling typically being preferred to weighted (cost-sensitive) updates (Lopez et al., 2013).
18
+
19
+ Such a resampling strategy, however, has yet to be proposed for policy evaluation, though there are several potential benefits. By correcting the distribution before updating, standard on-policy updates can be used, without needing to modify or re-derive with IS ratios. This simplifies application of different optimizers, such as those with momentum terms. Another benefit is that the magnitude of the updates will vary less—because updates are not multiplied by very small or very large importance sampling ratios—potentially reducing variance of stochastic updates and simplifying stepsize selection. Resampling should have larger benefits for learning approaches, as compared to averaging or numerical integration problems, because updates accumulate in the weight vector and change the optimization trajectory of the weights. For example, very large importance sampling ratios could destabilize the weights. Such a problem does not occur for resampling, as instead the same transition will simply be resampled multiple times, spreading out the large magnitude update across multiple updates. On the other extreme, with small ratios, IS will waste updates on transitions with very small IS ratios. Resampling, therefore, should have better sample efficiency. Two important questions, therefore, are if these hypothesized advantages manifest in practice in off-policy learning, and how SIR can be extended for use in policy evaluation.
20
+
21
+ In this work, we investigate the use of SIR for online off-policy policy evaluation. We first introduce Importance Resampling (IR), which uses an SIR strategy to sample transitions from a buffer of (recent) transitions. These sampled transitions are then used for on-policy updates. We show that IR, with a sliding-window buffer, is a consistent estimator of the one-step on-policy updates, with the same bias as WIS. We then empirically investigate IR on three toy domains and a racing car simulation learning from images. We find that IR is more sample efficient—learning more quickly in terms of number of updates—and has reduced sensitivity in terms of learning rate parameters, for both fixed parameters and within the RMSProp optimizer.
22
+
23
+ # 2 BACKGROUND
24
+
25
+ We consider the problem of learning General Value Functions (GVFs) (Sutton et al., 2011). The agent interacts in an environment defined by a set of states $s$ , a set of actions $\mathcal { A }$ and Markov transition dynamics, with probability $\mathrm { P } ( s ^ { \prime } | s , a )$ of transitions to state $s ^ { \prime }$ when taking action $a$ in state $s$ . A GVF is defined for policy $\pi : S \times A \to [ 0 , 1 ]$ , cumulant $c : S \times \mathcal { A } \times \mathcal { S } \mathbb { R }$ and continuation function $\gamma : S \times \mathcal { A } \times \mathcal { S } [ 0 , 1 ]$ $c _ { t + 1 } \{ \stackrel { \mathrm { d e f } } { = } c ( S _ { t } , A _ { t } , S _ { t + 1 } )$ $\gamma _ { t + 1 } \{ \stackrel { \mathrm { d e f } } { = } \gamma ( S _ { t } , A _ { t } , S _ { t + 1 } )$ $V ( s ) \stackrel { \mathrm { d e f } } { = } \mathbb { E } _ { \pi } \left[ c _ { t + 1 } + \gamma _ { t + 1 } c _ { t + 2 } + \gamma _ { t + 1 } \gamma _ { t + 2 } c _ { t + 3 } + \ldots | S _ { t } = s \right] = \mathbb { E } _ { \pi } \left[ \sum _ { i = 1 } ^ { \infty } \left( \prod _ { j = 0 } ^ { i - 1 } \gamma _ { t + j } \right) c _ { t + i } | S _ { t } = s \right] .$
26
+
27
+ The operator $\mathbb { E } _ { \pi }$ indicates the actions are selected according to policy $\pi$ for the expectation. GVFs encompass standard definitions of value functions, where the cumulant is a reward and the continuation function is a constant. Otherwise, they specify a broader set of value functions, that enable predictions about discounted sums of others signals into the future, when following a target policy $\pi$ . These values are typically estimated using parametric function approximation, with parameters $\theta \in \mathbb { R } ^ { d }$ defining approximate values $V _ { \theta } ( s )$ .
28
+
29
+ In off-policy learning, transitions are sampled according to behaviour policy, rather than the target policy. To get an unbiased sample of an update to the parameters, the action probabilities need to be adjusted. Consider on-policy temporal difference (TD) learning, with update $\alpha _ { t } \delta _ { t } \nabla _ { \theta } V _ { \theta } ( s )$ for a given $S _ { t } = s$ , for stepsize $\alpha _ { t } \in \mathbb { R } ^ { + }$ and TD-error $\delta _ { t } \stackrel { \mathrm { d e f } } { = } C _ { t + 1 } + \gamma _ { t + 1 } V _ { \theta } ( S _ { t + 1 } ) - V _ { \theta } ( s )$ . If actions are instead sampled according to a behaviour policy $\mu : \mathcal { S } \times \mathcal { A } [ 0 , 1 ]$ , then we can use importance sampling (IS) to modify the update, giving the off-policy TD update $\alpha _ { t } \rho _ { t } \delta _ { t } \nabla _ { \theta } V _ { \theta } ( s )$ for IS ratio $\rho _ { t } \stackrel { \mathrm { d e f } } { = } \frac { \pi ( A _ { t } | S _ { t } ) } { \mu ( A _ { t } | S _ { t } ) }$ . Given state $S _ { t } = s$ , if $\mu ( a | s ) > 0$ when $\pi ( a | s ) > 0$ , then the expected value of these two updates are equal. To see why, notice that
30
+
31
+ $$
32
+ \mathbb { E } _ { \mu } \left[ \alpha _ { t } \rho _ { t } \delta _ { t } \nabla _ { \theta } V _ { \theta } ( s ) | S _ { t } = s \right] = \alpha _ { t } \nabla _ { \theta } V _ { \theta } ( s ) \mathbb { E } _ { \mu } \left[ \rho _ { t } \delta _ { t } | S _ { t } = s \right]
33
+ $$
34
+
35
+ and we have
36
+
37
+ $$
38
+ \begin{array} { r l } { \overline { { \Omega _ { \mu } } } \left[ \rho _ { t } \delta _ { t } | S _ { t } = s \right] = \displaystyle \sum _ { a \in A } \mu ( a | s ) \mathbb { E } \left[ \rho _ { t } \delta _ { t } | S _ { t } = s , A _ { t } = a \right] } & { = \displaystyle \sum _ { a \in A } \mu ( a | s ) \frac { \pi ( a | s ) } { \mu ( a | s ) } \mathbb { E } \left[ \delta _ { t } | S _ { t } = s , A _ { t } = a \right] } \\ { = \displaystyle \sum _ { a \in A } \pi ( a | s ) \mathbb { E } \left[ \delta _ { t } | S _ { t } = s , A _ { t } = a \right] } & { \quad = \mathbb { E } _ { \pi } \left[ \delta _ { t } | S _ { t } = s \right] . } \end{array}
39
+ $$
40
+
41
+ Other on-policy updates can also be modified with IS ratios to adjust these action probabilities.
42
+
43
+ Though unbiased, IS can be high-variance, and so weighted IS ratios are typically preferred. For a batch consisting of transitions $\{ ( s _ { i } , a _ { i } , s _ { i + 1 } , c _ { i + 1 } , \rho _ { i } ) \} _ { i = 1 } ^ { n }$ , batch WIS uses a normalized estimate for the update. For example, an offline batch WIS TD algorithm would use update $\begin{array} { r } { \alpha _ { t } \frac { \rho _ { t } \delta _ { t } \nabla _ { \theta } V _ { \theta } ( s ) } { \sum _ { i = 1 } ^ { n } \rho _ { i } } } \end{array}$ . When learning online, an efficient WIS update is less straightforward, and has resulted in algorithms specialized to the tabular setting (Precup et al., 2001) or linear functions (Mahmood et al., 2014; Mahmood and Sutton, 2015). We nonetheless use WIS as baseline, in the experiments and theory.
44
+
45
+ # 3 RESAMPLING STRATEGIES FOR OFF-POLICY POLICY EVALUATION
46
+
47
+ In this section, we introduce resampling, as an alternative to importance sampling for off-policy learning. We first introduce the algorithm, Importance Resampling (IR). We then prove consistency and characterize the bias. We conclude with a discussion about its variance properties.
48
+
49
+ Importance Resampling requires access to a buffer of samples, from which we can resample. Replaying experience from a buffer was introduced as a biologically plausible mechanism to reuse old experience (Lin, 1992; 1993), and has since become common for improving sample efficiency, particularly for control (Mnih et al., 2015; Schaul et al., 2015b). In the simplest case—which we assume here—the buffer is a sliding window of the most recent $n$ samples, $\{ ( s _ { i } , a _ { i } , s _ { i + 1 } , c _ { i + 1 } , \rho _ { i } ) \} _ { i = t - n } ^ { t }$ , at time step $t > n$ . These samples are generated by taking actions according to behaviour $\mu$ , and so the tuples are generated with probability $d _ { \mu } ( s ) \mu ( a \vert s ) \mathrm { P } ( s ^ { \prime } \vert s , a )$ , where $d _ { \mu } : S [ 0 , 1 ]$ is the stationary distribution for policy $\mu$ . The goal is to obtain samples instead according to $\bar { d _ { \mu } } ( s ) \bar { \pi } ( a | s ) \mathrm { P } ( s ^ { \prime } | s , a )$ , as if we had taken actions according to policy $\pi$ from state $s \sim d _ { \mu }$ . This assumption—that states are still sampled from $d _ { \mu }$ —underlies most off-policy learning algorithms; very few attempt to use IS to adjust probabilities $d _ { \mu }$ to $d _ { \pi }$ (Precup et al., 2001).
50
+
51
+ The IR algorithm is simple: resample a mini-batch of size $k$ on each step $t$ from the buffer of size $n$ , proportionally to $\rho _ { i }$ in the buffer. Standard on-policy updates, such as on-policy TD or on-policy gradient TD, are then used on this resample. The key difference to IS and WIS is that the sampling distribution itself is corrected (see Theorem C.1), before the update, whereas IS and WIS correct the update itself. This small difference, however, can have larger ramifications practically, particularly with updates that accumulate in the parameters.
52
+
53
+ We consider two variants of IR: with and without bias correction. For point $t _ { j }$ sampled from the buffer, let $\Delta _ { t _ { j } }$ be the on-policy update for that transition. For example, for TD, $\tilde { \Delta t _ { t _ { j } } } = \delta _ { t _ { j } } \nabla _ { \theta } V _ { \theta } \big ( s _ { t _ { j } } \big )$ . The first step for either variant is to sample a mini-batch of size $k$ from the buffer, proportionally to $\rho _ { i }$ , as described above. The standard IR update simply uses a mini-batch, whereas Bias-Corrected IR (BC-IR) pre-multiplies with the average ratio in the buffer $\textstyle { \bar { \rho } } _ { t } = { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } \rho _ { i }$ ,
54
+
55
+ $$
56
+ \begin{array} { r } { { \mathbf { I R } : \qquad \alpha _ { t } \frac { 1 } { k } \displaystyle \sum _ { j = 1 } ^ { k } \Delta _ { t _ { j } } } } \end{array}
57
+ $$
58
+
59
+ $$
60
+ \begin{array} { r } { { \mathbf { B C - I R : } } \qquad \alpha _ { t } \bar { \rho } _ { t } \frac { 1 } { k } \displaystyle \sum _ { j = 1 } ^ { k } \Delta _ { t _ { j } } . } \end{array}
61
+ $$
62
+
63
+ BC-IR negates bias introduced by the average ratio in the buffer deviating significantly from the true mean. For reasonably large buffers, $\bar { \rho } _ { t }$ will be close to 1 making IR and BC-IR have nearidentical updates. In practice, we find the two variants of IR perform similarly. Nonetheless, they do have different theoretical properties, particularly for small buffer sizes $n$ , so we characterize both. Though BC-IR has better bias properties, IR is simpler—not requiring any modification to the updates—which may be more important than the small amount of bias introduced by the IR without bias correction. For this reason, we advocate for and analyze both variants.
64
+
65
+ Across all results, we make the following assumption.
66
+
67
+ Assumption 1. Transition tuples $X _ { i } = ( S _ { i } , A _ { i } , S _ { i + 1 } )$ are sampled i.i.d. according to the distribution $p ( \bar { x } = ( s , a , s ^ { \prime } ) ) = d _ { \mu } ( s ) \mu ( a | s ) \mathrm { P } ( s ^ { \prime } | s , a )$ , for $i = 1 , 2 , 3 , \dots$ .
68
+
69
+ To distinguish expectations under $p ( x ) = d _ { \mu } ( s ) \mu ( a | s ) \mathrm { P } ( s ^ { \prime } | s , a )$ and $q ( x ) = d _ { \mu } ( s ) \pi ( a | s ) \mathrm { P } ( s ^ { \prime } | s , a )$ , we overload the notation from above, using operators $\mathbb { E } _ { \mu }$ and $\mathbb { E } _ { \pi }$ respectively. To reduce clutter, we will typically write $\mathbb { E }$ to mean $\mathbb { E } _ { \mu }$ , because most expectations are under the sampling distribution.
70
+
71
+ # 3.1 BIAS OF IR
72
+
73
+ We first show that IR is biased, and that its bias is actually equal to batch WIS (in Theorem 3.1). This bias is small for reasonably large $n$ , because it is proportional to $1 / n$ . In terms of mean-squared error, composed of squared bias and variance, this term is $\mathbf { \bar { 1 } } / n ^ { 2 }$ and is relatively negligible compared to the variance. Nonetheless, for smaller buffers, such bias could have an impact. We show that with a simple modification, in BC-IR, we obtain an unbiased estimate of the update (Corollary 3.1.1).
74
+
75
+ Theorem 3.1. [Bias for a fixed buffer of size n] Assume a buffer $B$ of n transitions is sampled i.i.d., according to $d _ { \mu } ( s ) \mu ( a | s ) \mathrm { P } ( s ^ { \prime } | s , a )$ . Let $\begin{array} { r } { X _ { \mathrm { I R } } \ \stackrel { \mathrm { d e f } } { = } \ \frac { 1 } { k } \sum _ { j = 1 } ^ { k } \Delta _ { i _ { j } } } \end{array}$ for transitions $i _ { 1 } , \dots , i _ { k }$ sampled randomly from the buffer proportionally to $\rho _ { i }$ . Let $\begin{array} { r } { X _ { \mathrm { { W I S } * } } \stackrel { \mathrm { d e f } } { = } \sum _ { i = 1 } ^ { n } \frac { \rho _ { i } } { \sum _ { j = 1 } ^ { n } \rho _ { j } } \Delta _ { i } } \end{array}$ ef Pni=1 P ρinj=1 ρj be the batch WIS estimator of the update, with $\rho _ { i } \stackrel { \mathrm { d e f } } { = } \pi ( A _ { i } | S _ { i } ) / \mu ( A _ { i } | S _ { i } )$ . Then, $\mathbb { E } [ X _ { \mathrm { I R } } ] = \mathbb { E } [ X _ { \mathrm { W I S * } } ]$ , and so the bias of $X _ { \mathrm { I R } }$ is proportional to
76
+
77
+ $$
78
+ \widetilde { \mathrm { B i a s } } ( X _ { \mathrm { I R } } ) = \mathbb { E } [ X _ { \mathrm { I R } } ] - \mathbb { E } _ { \boldsymbol \pi } [ \Delta ] \propto \frac { 1 } { n } ( \mathbb { E } _ { \boldsymbol \pi } [ \Delta ] \sigma _ { \rho } ^ { 2 } - \sigma _ { \rho , \Delta } \sigma _ { \rho } \sigma _ { \Delta } )
79
+ $$
80
+
81
+ where get po $\mathbb { E } _ { \pi } [ \Delta ]$ i ro; ons from ; and co $S$ taken riance $\pi$ $\begin{array} { r } { \sigma _ { \rho } ^ { 2 } \ = \ \mathrm { \tilde { V } a r } ( \frac { 1 } { n } \grave { \sum } _ { j = 1 } ^ { n } \rho _ { j } ) } \end{array}$ $\begin{array} { r } { \sigma _ { \Delta } ^ { 2 } \ = \ \mathrm { V a r } ( \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \rho _ { i } \Delta _ { i } ) } \end{array}$ $\sigma _ { ( \rho , \Delta ) } =$ $\begin{array} { r } { \mathrm { C o v } \big ( \frac { 1 } { n } \sum _ { j = 1 } ^ { n } \rho _ { j } , \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \rho _ { i } \Delta _ { i } \big ) } \end{array}$ .
82
+
83
+ Proof. Notice first that when we weight with $\rho _ { i }$ , this is equivalent to weighting with $\frac { d _ { \mu } ( \tilde { S _ { i } } ) \pi ( A _ { i } | S _ { i } ) \mathrm { P } ( S _ { i + 1 } | S _ { i } , A _ { i } ) } { d _ { \prime \prime } ( S _ { i } ) \mu ( A _ { i } | S _ { i } ) \mathrm { P } ( S _ { i + 1 } | S _ { i } , A _ { i } ) }$ and so we are applying the correct IS ratio for the transition.
84
+
85
+ $$
86
+ \begin{array} { r l } { { \mathbb { E } [ X _ { \mathrm { I R } } ] = \mathbb { E } [ \mathbb { E } \bigl [ X _ { \mathrm { I R } } \vert B \bigr ] ] = \mathbb { E } [ \mathbb { E } [ \frac { 1 } { k } \sum _ { j = 1 } ^ { k } \Delta _ { i j } \vert B ] ] = \mathbb { E } [ \frac { 1 } { k } \sum _ { j = 1 } ^ { k } \mathbb { E } \bigl [ \Delta _ { i j } \vert B \bigr ] ] } \quad } & { { } } \\ { \displaystyle } & { { } = \mathbb { E } \bigg [ \sum _ { i = 1 } ^ { n } \frac { \rho _ { i } } { \sum _ { j = 1 } ^ { n } \rho _ { j } } \Delta _ { i } \bigg ] = \mathbb { E } \bigl [ X _ { \mathrm { W I S * } } \big ] \quad \quad \triangleright \ \mathrm { b e c a u s e } \ \mathbb { E } \bigl [ \Delta _ { i _ { j } } \vert B \bigr ] = \sum _ { i = 1 } ^ { n } \frac { \rho _ { i } } { \sum _ { j = 1 } ^ { n } \rho _ { j } } \Delta _ { i } } \end{array}
87
+ $$
88
+
89
+ This bias of $X _ { \mathrm { I R } }$ is therefore the same as batch WIS, which is characterized in (Owen, 2013, Section 2.7), completing the proof. □
90
+
91
+ This bias of IR will be small for reasonably large $n$ , both because it is proportional to $1 / n$ and because larger $n$ will result in lower variance of the average ratios and average update for the buffer. In particular, as $n$ grows, these variances decay proportionally to $n$ .
92
+
93
+ Corollary 3.1.1. Bias-corrected $I R$ , with estimator $\begin{array} { r } { X _ { \mathrm { B C } } \ { \stackrel { \mathrm { d e f } } { = } } \ { \frac { \bar { \rho } } { k } } \sum _ { j = 1 } ^ { k } \Delta _ { i _ { j } } } \end{array}$ for $\begin{array} { r } { \bar { \rho } = \frac { 1 } { n } \sum _ { j = 1 } ^ { n } \rho _ { j } } \end{array}$ unbiased: $\mathbb { E } [ X _ { \mathrm { B C } } ] = \mathbb { E } _ { \pi } [ \Delta ]$ .
94
+
95
+ Proof.
96
+
97
+ $$
98
+ \begin{array} { r l } & { \Xi [ X _ { \mathrm { B C } } ] = \mathbb { E } \Big [ \frac { \bar { \rho } } { k } \sum _ { j = 1 } ^ { k } \mathbb { E } [ \Delta _ { i _ { j } } | B ] \Big ] = \mathbb { E } \Big [ \bar { \rho } \displaystyle \sum _ { i = 1 } ^ { n } \frac { \rho _ { i } } { \sum _ { j = 1 } ^ { n } \rho _ { j } } \Delta _ { i } \Big ] = \mathbb { E } \Big [ \frac { 1 } { n } \displaystyle \sum _ { i = 1 } ^ { n } \rho _ { i } \Delta _ { i } \Big ] = \frac { 1 } { n } \displaystyle \sum _ { i = 1 } ^ { n } \mathbb { E } \Big [ \frac { \pi ( A _ { i } | S _ { i } ) } { \mu ( A _ { i } | S _ { i } ) } \Delta _ { i } \Big ] } \\ & { \phantom { \Xi _ { \rho } } = \frac { 1 } { n } \displaystyle \sum _ { i = 1 } ^ { n } \mathbb { E } \Big [ \frac { d _ { \mu } ( S _ { i } ) \pi ( A _ { i } | S _ { i } ) \mathrm { P } ( S _ { i + 1 } | S _ { i } , A _ { i } ) } { d _ { \mu } ( S _ { i } ) \mu ( A _ { i } | S _ { i } ) \mathrm { P } ( S _ { i + 1 } | S _ { i } , A _ { i } ) } \Delta _ { i } \Big ] = \frac { 1 } { n } \displaystyle \sum _ { i = 1 } ^ { n } \mathbb { E } _ { \pi } \left[ \Delta \right] = \mathbb { E } _ { \pi } \left[ \Delta \right] . } \end{array}
99
+ $$
100
+
101
+ # 3.2 CONSISTENCY OF IR
102
+
103
+ Consistency of IR in terms of an increasing buffer, with $n \infty$ , is a relatively straightforward extension on results for SIR, with or without bias correction (see Theorem C.1 in Appendix C). More interesting is consistency in terms of increasing interactions with the environment, $t \to \infty$ , with a fixed length buffer, as will be the case in practice. IR, without bias correction, is asymptotically biased in this case; in fact, its asymptotic bias is the one characterized above for a fixed length buffer in Theorem 3.1. This asymptotic bias, though, is proportional to $1 / n$ , which is negligible for typical buffer sizes. BC-IR, on the other hand, is consistent, even with a sliding window, as we show in the following theorem.
104
+
105
+ Theorem 3.2. Let $B _ { i } = \{ X _ { i - n + 1 } , . . . , X _ { i } \}$ be the buffer of the most recent n transitions sampled by time i, i.i.d. as ssamples from buffer ified in Assumption. Define the sliding $^ { l }$ . Let windo $X _ { \mathrm { B C } } ^ { ( i ) }$ be theimator stimator, with . Assume the $k$ $B _ { i }$ $\begin{array} { r } { X _ { t } \ \stackrel { \mathrm { d e f } } { = } \ \frac { 1 } { t } \sum _ { i = 1 } ^ { t } X _ { \mathrm { B C } } ^ { ( i ) } } \end{array}$ exists a $c > 0$ such that $\mathrm { V a r } ( X _ { \mathrm { B C } } ^ { ( i ) } ) \leq c$ ∀i. Then, as $t \to \infty$ , $X _ { t }$ converges in probability to $\mathbb { E } _ { \pi } [ \Delta ]$ .
106
+
107
+ Proof. Notice first that $X _ { \mathrm { B C } } ^ { ( i ) }$ is random because $B _ { i }$ is random and because transitions are sampled from $B _ { i }$ . Therefore, given $B _ { i }$ , $X _ { \mathrm { B C } } ^ { ( i ) }$ is independent of other random variables $B _ { j }$ and $X _ { \mathrm { B C } } ^ { ( j ) }$ for $j \neq i$ . Now, using Corollary 3.1.1, we can show that BC-IR is unbiased for a sliding window
108
+
109
+ $$
110
+ \mathbb { E } \big [ X _ { t } \big ] = \mathbb { E } \Big [ \frac { 1 } { t } \sum _ { i = 1 } ^ { t } X _ { \mathrm { B C } } ^ { ( i ) } \Big ] = \frac { 1 } { t } \sum _ { i = 1 } ^ { t } \mathbb { E } \big [ \mathbb { E } [ X _ { \mathrm { B C } } ^ { ( i ) } | B _ { i } ] \big ] = \mathbb { E } _ { \pi } \left[ \Delta \right] .
111
+ $$
112
+
113
+ Next, we show that $\begin{array} { r } { \operatorname* { l i m } _ { | i - j | \to \infty } \mathrm { C o v } ( X _ { \mathrm { B C } } ^ { ( i ) } , X _ { \mathrm { B C } } ^ { ( j ) } ) = 0 } \end{array}$ . For $| i - j | \geq m ,$ , $B _ { i }$ and $B _ { j }$ are independent, because they are disjoint sets of i.i.d. random variables. Correspondingly, $X _ { \mathrm { B C } } ^ { ( i ) }$ is in$X _ { \mathrm { B C } } ^ { ( j ) }$ ce, we get that . The first term $\mathrm { C o v } ( X _ { \mathrm { B C } } ^ { ( i ) } , \bar { X _ { \mathrm { B C } } ^ { ( j ) } } ) =$ $\mathrm { C o v } ( X _ { \mathrm { B C } } ^ { ( i ) } , X _ { \mathrm { B C } } ^ { ( j ) } | B _ { i } , B _ { j } ) + \mathrm { C o v } ( \mathbb { E } [ X _ { \mathrm { B C } } ^ { ( i ) } | B _ { i } ] , \mathbb { E } [ X _ { \mathrm { B C } } ^ { ( j ) } | B _ { j } ] ) = 0$ $X _ { \mathrm { B C } } ^ { ( i ) }$ is independent of X(j)BC given $B _ { i }$ , and the second term is zero because $B _ { i }$ and $B _ { j }$ are independent. Therefore, $\begin{array} { r } { \operatorname* { l i m } _ { | i - j | \to \infty } \mathrm { C o v } ( X _ { \mathrm { B C } } ^ { ( i ) } , X _ { \mathrm { B C } } ^ { ( j ) } ) = 0 } \end{array}$ .
114
+
115
+ Using the assumption on the variance, we can apply Lemma C.3 to $X _ { t }$ to get the desired result.
116
+
117
+ # 3.3 VARIANCE AND EFFECTIVE SAMPLE SIZE
118
+
119
+ In this section, we provide some intuition on the variance properties of the discussed off-policy estimators. Similarly to bias, we can characterize the variance of the IR estimator relative to batch WIS. $X _ { \mathrm { W I S * } }$ is able to use a batch update on all the data in the buffer, which should result in a lowvariance estimate but is an unrealistic algorithm to use in practice. Instead, it provides a benchmark, where the goal is to obtain similar variance to $X _ { \mathrm { W I S * } }$ , but within realistic computational restrictions. Because of the clear relationship between IR and WIS, as used in Theorem 3.1, we can easily characterize the variance of $X _ { \mathrm { I R } }$ relative to $X _ { \mathrm { W I S * } }$ using the law of total covariance:
120
+
121
+ $$
122
+ \begin{array} { r l r } & { } & { \mathbb { V } ( X _ { \mathrm { I R } } ) = \mathbb { V } \left[ \mathbb { E } [ X _ { \mathrm { I R } } | B ] \right] + \mathbb { E } \left[ \mathbb { V } [ X _ { \mathrm { I R } } | B ] \right] } \\ & { } & { = \mathbb { V } \left[ X _ { \mathrm { W I S * } } \right] + \mathbb { E } \left[ \mathbb { V } [ X _ { \mathrm { I R } } | B ] \right] ~ } \end{array}
123
+ $$
124
+
125
+ where the variability is due to having randomly sampled buffers $B$ and random sampling from $B$ . The second term corresponds to the noise introduced by sampling a mini-batch of $k$ transitions from the buffer $B$ , instead of using the entire buffer like WIS. For more insight, we can expand this second term, $\begin{array} { r } { \mathbb { E } \left[ \mathbb { V } [ X _ { \mathrm { I R } } | B ] \right] = \mathbb { E } \left[ ( \frac { 1 } { k } \sum _ { j = 1 } ^ { k } \Delta _ { i _ { j } } - \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \Delta _ { i } ) ^ { 2 } | B \right] } \end{array}$ , where we consider the variance independently for each element of $\Delta _ { i }$ and so apply the square element-wise. The variability is not due to IS ratios, and instead arises from variability in the updates themselves. Therefore, the variance of IR corresponds to the variance of WIS, with some additional variance due to this variability around the average update in the buffer.
126
+
127
+ This variance contrasts the variance of the corresponding mini-batch IS estimator:
128
+
129
+ $$
130
+ \mathbb { V } \Big ( \frac { 1 } { k } \sum _ { j = 1 } ^ { k } \rho _ { i _ { j } } \Delta _ { i _ { j } } \Big ) = \mathbb { E } \Big [ \Big ( \frac { 1 } { k } \sum _ { j = 1 } ^ { k } \rho _ { i _ { j } } \Delta _ { i _ { j } } - \mathbb { E } _ { \pi } [ \Delta ] \Big ) ^ { 2 } \Big ]
131
+ $$
132
+
133
+ For large importance sampling ratios, this mini-batch can deviate significantly around the mean update. Further, this deviation around the mean update is across all transitions, unlike $\mathbb { E } \left[ \mathbb { V } [ X _ { \mathrm { I R } } | B ] \right]$ which reflects the expected deviation for a buffer of size $n$ . The IS estimator is unbiased, as opposed to IR and WIS which both introduce some bias. A more fair comparison is to BC-IR, which is unbiased, with variance
134
+
135
+ $$
136
+ \mathbb { V } \Big ( X _ { \mathrm { B C } } \Big ) = \mathbb { E } \Big [ \Big ( \frac { \bar { \rho } } { k } \sum _ { j = 1 } ^ { k } \Delta _ { i _ { j } } - \mathbb { E } _ { \pi } [ \Delta ] \Big ) ^ { 2 } \Big ]
137
+ $$
138
+
139
+ It is difficult to state generally that the variability of the IS estimator will be greater than $X _ { \mathrm { B C } }$ , because it depends on the properties of the update vector $\Delta _ { i _ { j } }$ itself. However, the key difference between them is that $X _ { \mathrm { B C } }$ multiplies all the updates by the averaged ratio, whereas IS includes individual (potentially high magnitude) ratios inside the sum.
140
+
141
+ Finally, the variance of IR will be affected by what is known as the effective sample size. For data with several high magnitude ratios, and many small ratios, the IS estimator will likely suffer from high-variance updates. IR, however, will not be completely robust to this setting either: it will prevent high magnitude updates, but will be sampling from an effectively smaller dataset. This effective size is smaller because IR will repeatedly sample the same transitions, and potentially never sample some of the transitions with small IS ratios. With less data, we typically incur more variance.
142
+
143
+ One common estimator of effective sample size is $\frac { \left( \sum _ { i = 1 } ^ { n } \rho _ { i } \right) ^ { 2 } } { \sum _ { i = 1 } ^ { n } \rho _ { i } ^ { 2 } }$ (Kong et al., 1994; Martino et al., 2017). This estimate lies between 1 and $n$ . When the effective sample size is low, this indicates that most of the probability is concentrated on a few samples, which could be problematic. An important next step is to better understand theoretically the implications of effective sample size. Here, we now turn to experiments to gain more insight into the relative efficacy of IR to IS, in settings including such skewed ratios.
144
+
145
+ # 4 EXPERIMENTS
146
+
147
+ In this section, we present results for predictions made with difficult polices in three domains. We compare IR and BC-IR 2 to an importance sampling approach using uniformly sampled experiences from the replay buffer $\mathrm { ( E R + I S ) }$ , and three variants of weighted importance sampling (WIS). The three variants of WIS considered are WIS-Batch, WIS-Buffer, and WIS-Optimal discussed further in the appendix3 4. For tabular domains, we don’t average over the mini-batch updates, although doing so won’t change results significantly. We report parameter studies and learning curves, excluding buffer size studies, on a single buffer size shared between all the methods. Although results from other buffer sizes (not shown here) have similar conclusions. We show $9 5 \%$ confidence intervals on all results unless otherwise specified.
148
+
149
+ # 4.1 SETTINGS
150
+
151
+ Random Walk Markov Chain We use a typically constructed random walk Markov chain (Sutton and Barto, 2018) with 8 non-terminating states and 2 terminating, with a reward of 1 on the transition to the right-most terminal state and 0 everywhere else. The agent follows a policy $\mu$ and learns the value function according to a target policy $\pi$ . We compute the root mean squared value error (RMSVE) on every training step with a value function found using dynamic programming with threshold 10−15.
152
+
153
+ ![](images/bcd65fdffeefcca784d605af84696eb3d58b1bd70492bd11751eeb241a98c7ab.jpg)
154
+
155
+ ![](images/c9d1e9dbb09a160e873f2634e41bcc9abdfeb5ea4f9ef18f134b1e29a751ab87.jpg)
156
+ Figure 1: Learning rate sensitivity study in the Random Walk Markov Chain with buffer size $n =$ 15000, batch size $b = 1 6$ For simplicity we write the policies as follows: $\mu = [ \mu ( \mathrm { l e f t } | \cdot )$ , $\mu ( \mathrm { r i g h t } | )$ . left $\mu = [ 0 . 5 , 0 . 5 ]$ , $\pi = [ 0 . 1 , 0 . 9 ]$ , center $\mu = [ 0 . 9 , 0 . 1 ]$ , $\pi = [ 0 . 1 , 0 . 9 ]$ , right $\mu = [ 0 . 9 9 , 0 . 0 1 ] , \pi =$ [0.01, 0.99]. Additional results using V-Trace and Sarsa can be found in the appendix B.1
157
+ Figure 2: left and center Buffer size study for the random walk markov chain and four rooms domain respectively. We select the best settings for each buffersize and report the average RMSVE right Four rooms domain learning rate sensitivities parameter study.
158
+
159
+ Four Rooms Environment The four rooms domain is a well known hard domain used for training options (Stolle and Precup, 2002). The behavior policy followed by the agent is equiprobable everywhere except for 25 randomly selected states which take the action down with probability 0.05 with remaining probability split equally amongst the other actions. The 25 random states are the same for all runs, but we also evaluated different states for each run (see appendix). The target policy of interest is to take the down action deterministically, inducing highly variant IS ratios. The cumulant for the value function is 1 when the agent hits a wall and 0 otherwise. The continuation function is $\gamma = 0 . 9$ terminating when the agent hits a wall. We calculate the RMSVE similarly to the Markov Chain.
160
+
161
+ Simulated Car Domain We use the TORCs race car simulator to perform scaling experiments using neural networks. We set up the simulator to produce $6 4 \mathrm { x } 1 2 8$ cropped grayscale images. We have an underlying deterministic steering controller that produces steering actions $a _ { d e t } \in [ - 1 , + 1 ]$ and take an action with probability defined by a Gaussian a $\mathcal { N } ( a _ { d e t } , 0 . 1 )$ . We show a demonstration learning a single GVF with cumulant 1 when the car is near the center of the road (signal provided by Torcs), continuation function with 0.9 everywhere with terminating condition the same as the cumulant, and a target policy modeled as a gaussian $\mathcal { N } ( 0 . 1 5 , 0 . 0 0 7 5 )$ , which corresponds to steering left.
162
+
163
+ # 4.2 RESULTS
164
+
165
+ In each of the domains tested we see significant improvements in the range of effective learning rates. The most stark example is seen in the right plot of figure 1. Here the behaviour policy induces importance sampling ratios as high as 99 while also having very few effective samples from which to train. After 1000 training epochs only a single learning rate seemed to not diverge using $\mathrm { E R + I S }$ and WIS-Buffer. In this same setting, IR performs very similar to the value function trained with on policy data. We also see lower sensitivity to learning rate in the four rooms environment, rightmost figure 2. 5
166
+
167
+ Another benefit of IR is the gains in sample efficiency, and the focus on potentially rare samples following the target policy. We show this with the learning curves found in figure 3. In the random walk and four rooms domains we see WIS-Buffer and WIS-Batch perform approximately the same as $\mathrm { E R + I S }$ with IR outperforming the competitors. This can be attributed to IR’s resampling scheme, where we see more samples important to training. This is especially apparent in the four rooms experiments, where we may only get a few chances to train from certain hard to reach states. The uniform sampling methods will more likely miss out on rare examples, or only see them once making learning slow. We also note that WIS-Batch is unable to learn in the hardest of settings for the Markov chain, potentially due to the bias incurred from only performing WIS on a subsample of the entire data. One interesting observation is in the Baird’s Star Problem where IR results in better weights and lower value error (see appendix).
168
+
169
+ ![](images/0734802ee27e4ef295c1cae54745c60ca6cada3b32d998f013593971f64b5cbd.jpg)
170
+ Figure 3: left Markov Chain Random Walk with $n \ = \ 1 5 0 0 0$ , $b ~ = ~ 1 6$ , $\mu = [ 0 . 9 9 , 0 . 0 1 ] , \pi =$ $\left[ 0 . 0 1 , 0 . 9 9 \right]$ , optimal learning rates from above parameter study center Four rooms environment $n = 1 0 0 0 0$ , $b = 3 2$ with optimal settings from below parameter studies. We report $7 0 \%$ confidence bands for ease of comparison. right Torcs racing car simulator learning curves of RMSRE calculated over a pre-collected evaluation set. $\alpha _ { \mathrm { B C - I R } } ~ = ~ 1 e ^ { - 4 } , \alpha _ { \mathrm { I R } } ~ = ~ 1 e ^ { - 4 } , \overline { { { \alpha } } } _ { \mathrm { I S } } ~ = ~ 1 e ^ { - 6 }$ selected from a parameter study using RMSProp and the NVIDIA network designed for self-driving cars (Bojarski et al., 2016)
171
+
172
+ The experiments in the Torcs domain show faster learning using a deep learning system. While the results are promising, they are not as stark as we would have expected given the prior experiments and the variance in final performance is much larger for BC-IR and IR. There are several contributing factors to learning off-policy using IR and IS that need to be considered. First by using RMSProp or other adaptive learning rate algorithms we are potentially gaining WIS like benefits, reducing the variance of the updates considerably. IR may improve performance when the behaviour and target policies cause even more variant importance ratios, but with an adaptive learning rate algorithm this becomes less problematic when using IS. More needs to be understood about the interactions between adaptive algorithms and off-policy learning with importance sampling ratios.
173
+
174
+ # 5 CONCLUSIONS
175
+
176
+ Resampling for off-policy learning has been unconsidered, to our knowledge, up until now. This may be due to a focus on learning from only the most recent experiences and throwing away transitions once used. The resampling approach is now viable because of the increased prominence of the experience replay buffer in deep reinforcement learning. Previous approaches have exploited the experience replay buffer for orthogonal purposes including Prioritized Experience Replay (Schaul et al., 2015b), which prioritizes training examples according to the temporal difference error $w _ { i } =$ $| \delta _ { i } | + \epsilon$ . A possible extension to IR is to sample from an intermediate sampling distribution which eases high variant importance sampling ratios (see Appendix B.5).
177
+
178
+ In this paper we introduced a new approach to off-policy learning: resampling. We explored the theoretical implications of importance resampling, including a correction term to guarantee consistency in the moving window setting. We provided a number of empirical studies in hard off-policy learning settings outperforming the realistic competitors often by a wide margin, while also being less sensitive to learning rate in the mini-batch stochastic gradient update. We found IR to outperform IS in cases with potentially high importance sampling ratios suggesting a possible reduction in variance. Finally, we show improvements in learning rate performance for IR and BC-IR methods using deep learning within a challenging racing car simulator environment. There remains a number of both theoretical and empirical questions surrounding the benefits of the resampling approach to off-policy learning worth exploring in future work.
179
+
180
+ # REFERENCES
181
+
182
+ Sigrun Andradottir, Daniel P Heyman, and Teunis J Ott. On the Choice of Alternative Measures in Importance Sampling with Markov Chains. Operations Research, 1995.
183
+
184
+ M S Arulampalam, S Maskell, N Gordon, and T Clapp. A Tutorial on Particle Filters for Online Nonlinear/Non-Gaussian Bayesian Tracking. IEEE Transactions on Signal Processing, 2002.
185
+
186
+ Leemon Baird. Residual Algorithms: Reinforcement Learning with Function Approximation. In Machine Learning Proceedings 1995. 1995.
187
+
188
+ Mariusz Bojarski, Davide Del Testa, Daniel Dworakowski, Bernhard Firner, Beat Flepp, Prasoon Goyal, Lawrence D Jackel, Mathew Monfort, Urs Muller, Jiakai Zhang, et al. End to end learning for self-driving cars. arXiv preprint arXiv:1604.07316, 2016.
189
+
190
+ Lasse Espeholt, Hubert Soyer, Remi Munos, Karen Simonyan, Volodymir Mnih, Tom Ward, Yotam ´ Doron, Vlad Firoiu, Tim Harley, Iain Dunning, and others. IMPALA: Scalable distributed DeepRL with importance weighted actor-learner architectures. arXiv preprint arXiv:1802.01561, 2018.
191
+
192
+ N J Gordon, D J Salmond, Radar, AFM Smith IEE Proceedings F Signal, and 1993. Novel approach to nonlinear/non-Gaussian Bayesian state estimation. IET, 1993.
193
+
194
+ Max Jaderberg, Volodymyr Mnih, Wojciech Marian Czarnecki, Tom Schaul, Joel Z Leibo, David Silver, and Koray Kavukcuoglu. Reinforcement Learning with Unsupervised Auxiliary Tasks. In International Conference on Representation Learning, 2017.
195
+
196
+ H Kahn and A W Marshall. Methods of Reducing Sample Size in Monte Carlo Computations. Journal of the Operations Research Society of America, 1953.
197
+
198
+ Augustine Kong, Jun S Liu, and Wing Hung Wong. Sequential imputations and Bayesian missing data problems. Journal of the American Statistical Association, 1994.
199
+
200
+ Long-Ji Lin. Self-Improving Reactive Agents Based On Reinforcement Learning, Planning and Teaching. Machine Learning, 1992.
201
+
202
+ Long-Ji Lin. Reinforcement Learning for Robots Using Neural Networks. PhD thesis, Carnegie Mellon University, 1993.
203
+
204
+ Victoria Lopez, Alberto Fernandez, Salvador Garcia, Vasile Palade, and Francisco Herrera. An insight into classification with imbalanced data: Empirical results and current trends on using data intrinsic characteristics. Information Sciences, 2013.
205
+
206
+ A R Mahmood and R.S. Sutton. Off-policy learning based on weighted importance sampling with linear computational complexity. In Conference on Uncertainty in Artificial Intelligence, 2015.
207
+
208
+ A Rupam Mahmood, Hado P van Hasselt, and Richard S Sutton. Weighted importance sampling for off-policy learning with linear function approximation. In Advances in Neural Information Processing Systems, 2014.
209
+
210
+ Ashique Rupam Mahmood, Huizhen Yu, and Richard S Sutton. Multi-step Off-policy Learning Without Importance Sampling Ratios. arXiv:1509.01240v2, 2017.
211
+
212
+ Luca Martino, V´ıctor Elvira, and Francisco Louzada. Effective sample size for importance sampling based on discrepancy measures. Signal Processing, 2017.
213
+
214
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin Riedmiller, Andreas K. Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis Antonoglou, Helen King, Dharshan Kumaran, Daan Wierstra, Shane Legg, and Demis Hassabis. Human-level control through deep reinforcement learning. Nature, 2015.
215
+
216
+ Joseph Modayil, Adam White, and Richard S Sutton. Multi-timescale nexting in a reinforcement learning robot. Adaptive Behavior - Animals, Animats, Software Agents, Robots, Adaptive Systems, 2014.
217
+
218
+ Remi Munos, Tom Stepleton, Anna Harutyunyan, and Marc G Bellemare. Safe and Efficient Off- ´ Policy Reinforcement Learning. Advances in Neural Information Processing Systems, 2016.
219
+
220
+ Art B. Owen. Monte Carlo theory, methods and examples. 2013.
221
+
222
+ Doina Precup, Richard S Sutton, and Satinder P Singh. Eligibility Traces for Off-Policy Policy Evaluation. ICML, 2000.
223
+
224
+ Doina Precup, Richard S Sutton, and Sanjoy Dasgupta. Off-Policy Temporal-Difference Learning with Function Approximation. ICML, 2001.
225
+
226
+ Donald B Rubin. Using the SIR algorithm to simulate posterior distributions. Bayesian statistics, 1988.
227
+
228
+ Reuven Y Rubinstein and Dirk P Kroese. Simulation and the Monte Carlo Method. John Wiley & Sons, 2016.
229
+
230
+ Tom Schaul and Mark Ring. Better generalization with forecasts. In International Joint Conference on Artificial Intelligence, 2013.
231
+
232
+ Tom Schaul, Daniel Horgan, Karol Gregor, and David Silver. Universal Value Function Approximators. In International Conference on Machine Learning, 2015a.
233
+
234
+ Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. Prioritized Experience Replay. arXiv:1511.05952 [cs], 2015b.
235
+
236
+ David Silver, Hado van Hasselt, Matteo Hessel, Tom Schaul, Arthur Guez, Tim Harley, Gabriel Dulac-Arnold, David P Reichert, Neil C Rabinowitz, Andre Barreto, and Thomas Degris. The ´ Predictron - End-To-End Learning and Planning. In AAAI Conference on Artificial Intelligence, 2017.
237
+
238
+ Øivind Skare, Erik Bølviken, and Lars Holden. Improved Sampling-Importance Resampling and Reduced Bias Importance Sampling. Scandinavian Journal of Statistics, 2003.
239
+
240
+ AFM Smith, AE Gelfand The American Statistician, and 1992. Bayesian statistics without tears: a sampling–resampling perspective. Taylor & Francis, 1992.
241
+
242
+ Martin Stolle and Doina Precup. Learning Options in Reinforcement Learning. In International Symposium on Abstraction, Reformulation, and Approximation, 2002.
243
+
244
+ Richard S Sutton and Andrew G Barto. Reinforcement Learning: An Introduction - Draft. MIT Press, 2018.
245
+
246
+ Richard S Sutton, Doina Precup, and Satinder Singh. Between MDPs and semi-MDPs: A framework for temporal abstraction in reinforcement learning. Artificial intelligence, 1999.
247
+
248
+ Richard S Sutton, Eddie J Rafols, and Anna Koop. Temporal Abstraction in Temporal-difference Networks. In Advances in Neural Information Processing Systems, 2005.
249
+
250
+ Richard S Sutton, H Maei, D Precup, and S Bhatnagar. Fast gradient-descent methods for temporaldifference learning with linear function approximation. In International Conference on Machine Learning, 2009.
251
+
252
+ Richard S Sutton, J Modayil, M Delp, T Degris, P.M. Pilarski, A White, and D Precup. Horde: A scalable real-time architecture for learning knowledge from unsupervised sensorimotor interaction. In International Conference on Autonomous Agents and Multiagent Systems, 2011.
253
+
254
+ Philip Thomas and Emma Brunskill. Data-Efficient Off-Policy Policy Evaluation for Reinforcement Learning. In AAAI Conference on Artificial Intelligence, 2016.
255
+
256
+ Philip S Thomas and Emma Brunskill. Importance Sampling with Unequal Support. In AAAI Conference on Artificial Intelligence, 2017.
257
+
258
+ # A WEIGHTED IMPORTANCE SAMPLING
259
+
260
+ We consider three weighted importance sampling updates as competitors to IR. $N$ is the size of the experience replay buffer, $b$ is the size of a single batch.
261
+
262
+ WIS-Batch
263
+
264
+ $$
265
+ \begin{array} { r l } & { \Delta \theta = \frac { \sum _ { i } ^ { b } \rho _ { i } \delta _ { i } \nabla _ { \theta } V \left( s _ { i } ; \theta \right) } { \sum _ { j } ^ { b } \rho _ { j } } } \\ & { \Delta \theta = N \frac { \sum _ { i } ^ { b } \rho _ { i } \delta _ { i } \nabla _ { \theta } V \left( s _ { i } ; \theta \right) } { \sum _ { j } ^ { N } \rho _ { j } } } \\ & { \Delta \theta = \frac { \sum _ { i } ^ { N } \rho _ { i } \delta _ { i } \nabla _ { \theta } V \left( s _ { i } ; \theta \right) } { \sum _ { j } ^ { N } \rho _ { j } } } \end{array}
266
+ $$
267
+
268
+ WIS-Buffer
269
+
270
+ WIS-Optimal
271
+
272
+ # B MORE EXPERIMENTAL RESULTS
273
+
274
+ # B.1 MARKOV CHAIN
275
+
276
+ ![](images/9da6c321bbbbbd8ead1fa8bf6a0fea1872e17fa4649168cba4df27ffb41dc8da.jpg)
277
+ Figure 4: Markov Chain results for V-Trace and Sarsa. Four clipping parameters were chosen with different amounts of aggressiveness. They were calculated from the known max importance sampling value, multiplied by the scalars 0.5 and 0.9. We also included a clipping value of 1.0 which is consistent with the recommendations made for retrace. The error for Sarsa was calculated by deriving the state-value function from the current action-state value function, and following the same error calculation as with the other methods.
278
+
279
+ We also include results in the random walk markov chain for V-Trace and Sarsa. V-Trace exhibited the same issues as importance sampling, where we can see a clear disadvantage in the harder policies. Also, we can clearly see a bias-variance trade off in V-Trace as the clipping parameter $\bar { \rho }$ became more aggressive. Sarsa makes clear gains over $\mathrm { E R + I S }$ (and IR in the easiest setting), but fails to learn the true value function for the hardest settings.
280
+
281
+ # B.2 BAIRD’S STAR PROBLEM
282
+
283
+ We use a well known variant of the Star Problem (Baird, 1995; Sutton et al., 2009) proposed as a counter example to the convergence of semi-gradient temporal difference learning in the off-policy setting. We train using a batch version of TDC (Sutton et al., 2009). We calculate the RMSVE for each state on every training step.
284
+
285
+ # B.3 FOUR ROOMS DOMAIN
286
+
287
+ We also sampled new random states in which to act unfavorably for every run. We found the behavior used in the experiments presented in the main text to be harder than many of the other policies sampled randomly.
288
+
289
+ ![](images/5f1521f986a544af3d7659be89e13937e6ceebf879f467627c30db231e6d2895.jpg)
290
+ Figure 5: Baird’s Star Problem.
291
+
292
+ ![](images/e68fd8c360f7e4ee6415ea86397db78b1f34d7bcc613ab2c8e2823adb3f0eebd.jpg)
293
+ Figure 6: Four rooms experiments for new random states every run: left Learning rate sensitivity center Buffer Size Sensitivity right Learning Curves
294
+
295
+ # B.4 MOUNTAIN CAR
296
+
297
+ We use the standard mountain car domain described in (Sutton and Barto, 2018). To make the simulations more realistic we collect experience from behavior policy learned through Q-learning (Sutton and Barto, 2018) with a $\epsilon$ -greedy exploration strategy. We code a GVF to predict whether the agent will hit the back wall within a horizon of $\gamma = 0 . 9$ while following the the persistent policy accelerating forward. We use two exploration parameters $\epsilon = \{ 0 . 1 , 0 . 5 \}$ with maximum importance sampling ratio values at $\rho _ { m a x } = \{ 6 , 3 0 \}$ respectively.
298
+
299
+ We show comparisons for both a static step size SGD and with the Adam optimizer. These experiments perform as expected, except for one configuration of the behavior policy using the Adam optimizer. It is possible that the Adam optimizer is getting some benefit similar to WIS with the recency averages of updates accounting for the high variance of the update.
300
+
301
+ ![](images/c72d930bad65fa8a144d87bc95d2fd6e172b6992fbf11368fcf2f479730df304.jpg)
302
+
303
+ ![](images/3e9abe76e66d058b2ceca2e258717238db82cf8e57579a158267ce7e11a57870.jpg)
304
+ Figure 7: Mountain Car: Mini-batch Gradient Descent with constant learning rate $\pi =$ $[ 0 \bar { , } 0 , 1 . 0 ] , | B | = 5 0 0 0 0$ , Left $\epsilon = 0 . 1$ , Right $\epsilon = 0 . 5$
305
+
306
+ # B.5 SAMPLING ACCORDING TO INTERMEDIATE POLICIES
307
+
308
+ While intuitively it might seem sampling according to the target policy will produce the best value functions, when making multiple predictions with the same training network it would be more convenient to sample from the experience replay buffer with an intermediate policy. We get the benefits of less variant importance sampling ratios with the ability to use one IR buffer for multiple policies.
309
+
310
+ ![](images/3c7869c8680f39a13d34871059b4209fc7eab38053a880dee6ae0b1fb45c6cde.jpg)
311
+ Figure 8: Mountain Car: Mini-batch Gradient Descent with Adam Optimizer. $\mathbf { X }$ -axis: learning rates, y-axis: RMSVE $\pi = [ 0 , 0 , 1 . 0 ]$ , $| B | = 5 0 0 0 0$ , Left $\epsilon = 0 . 1$ , Right $\epsilon = 0 . 5$
312
+
313
+ ![](images/2e970eccd6e0549dd9eeb497bc5cde85ba55c4120ef9299c050e11f19551902f.jpg)
314
+ Figure 9: Mountain Car left Learning curve for optimal settings for Adam optimizer $\mathbf { X }$ -axis: time $( 1 0 ^ { 4 } )$ y-axis: RMSVE center Early example of learned predictions $\mathbf { X }$ -axis: Time y-axis: Prediction right Late example of learned predictions $\mathbf { X }$ -axis: Time, y-axis: Prediction
315
+
316
+ To combine the IR and importance sampling with a uniform experience replay we sample from the buffer according to the PMF
317
+
318
+ $$
319
+ p ( \mathrm { s a m p l i n g \ : } d _ { i } ) = \frac { \bar { \rho } _ { i } } { \sum _ { j } \bar { \rho } _ { j } } , \qquad \bar { \rho } _ { i } = \frac { \pi _ { s a m p l e } ( a _ { t } | s _ { t } ) } { \mu ( a _ { t } | s _ { t } ) } .
320
+ $$
321
+
322
+ We would then us off-policy temporal difference methods with the effective importance sampling ratio used as ρeffective $\begin{array} { r } { \rho _ { \mathrm { e f f e c t i v e } } = \overbar { \frac { \pi ( a _ { t } | s _ { t } ) } { \pi _ { s a m p l e } ( a _ { t } | s _ { t } ) } } } \end{array}$ . We show initial results for this extension in the markov chain random walk in figure 10.
323
+
324
+ ![](images/70d15713995c97393356a8070e26a408b9be3f225a38249a667b6ec6437c1d83.jpg)
325
+ Figure 10: Intermediate sampling policies in a random walk markov chain. (left) $\pi = [ 0 . 1 , 0 . 9 ] , \mu =$ [0.9, 0.1], (right) $\pi = [ 0 . 0 1 , 0 . 9 9 ]$ , $\mu = [ 0 . 9 9 , 0 . 0 1 ]$
326
+
327
+ # C MORE THEORETICAL RESULTS
328
+
329
+ # C.1 CONSISTENCY OF THE IR ESTIMATOR WITH GROWING BUFFER SIZE
330
+
331
+ We show the consistency of the IR estimator with $n \to \infty$ for convenience, but our approach closely follows that of (Smith et al., 1992).
332
+
333
+ Theorem C.1. Let $B = \{ x _ { 1 } , x _ { 2 } , . . . , x _ { n } \}$ be a buffer of data sampled i.i.d. according to proposal distribution $p ( x )$ . Let $q ( x )$ be some distribution of interest and assume the proposal distribution samples everywhere where $\overset { \cdot } { q } ( x )$ is non-zero. Also, let $Y$ be a discrete random variable taking values $x _ { i }$ with probability $\propto \frac { q ( x _ { i } ) } { p ( x _ { i } ) }$ .
334
+
335
+ Then, $Y$ converges in distribution to $X \sim Q$ as $n \to \infty$
336
+
337
+ Proof. Let $\begin{array} { r } { \rho _ { i } = \frac { q ( x _ { i } ) } { p ( x _ { i } ) } } \end{array}$ . From the probability mass function of $Y$ , we have that:
338
+
339
+ $$
340
+ \begin{array} { r l } { \mathbb { P } [ Y \leq a ] = \displaystyle \sum _ { i = 1 } ^ { n } \mathbb { P } [ Y = x _ { i } ] \mathbb { I } \{ x _ { i } \leq a \} } \\ { = \frac { n ^ { - 1 } \sum _ { i = 1 } ^ { n } \rho _ { i } \mathbb { I } \{ x _ { i } \leq a \} } { n ^ { - 1 } \sum _ { i = 1 } ^ { n } \rho _ { i } } } \\ { \frac { n ^ { - \alpha } \rho _ { i } \mathbb { P } ( x ) \mathbb { I } \{ x \leq a \} ] } { \mathbb { E } _ { q } [ \rho ( x ) ] } } \\ { = \frac { 1 - \int _ { - \infty } ^ { \alpha } \frac { q ( x ) } { \rho ( x ) } p ( x ) d x + 0 \cdot \int _ { a } ^ { \infty } \frac { q ( x ) } { \rho ( x ) } p ( x ) d x } { \int _ { - \infty } ^ { \infty } \frac { q ( x ) } { \rho ( x ) } p ( x ) d x } } \\ { = \int _ { - \infty } ^ { a } q ( x ) d x } \end{array}
341
+ $$
342
+
343
+ The above shows consistency. If we have a large enough buffer, then the importance resampling will closely approximate sampling from the target distribution $Q$ . In particular, any expectation we want to estimate under $Q$ can also be a well-approximated by using the defined sampling scheme.
344
+
345
+ # C.2 CHANGING BEHAVIOUR POLICIES
346
+
347
+ We consider the importance sampling estimator under conditions of a changing policy.
348
+
349
+ Theorem C.2. Let $P$ be a target distribution with density $p$ and $\{ x _ { i } \} _ { i = 1 } ^ { n }$ be a dataset where each $x _ { i }$ is sampled from $P _ { i }$ independently. Then, the weighted importance sampling estimator $\hat { \mu } =$ $\scriptstyle \sum _ { i = 1 } ^ { n } { \frac { \rho _ { i } } { \sum _ { j = 1 } ^ { n } \rho _ { j } } } g ( x _ { i } )$ is consistent for $\mathbb { E } _ { f } [ g ( X ) ]$ where $g ( . )$ is a function of interest and $\begin{array} { r } { \rho _ { i } = \frac { q ( x _ { i } ) } { p _ { i } ( x _ { i } ) } } \end{array}$
350
+
351
+ Proof. First, we rewrite $\begin{array} { r } { \hat { \mu } = \frac { \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \rho _ { i } g ( x _ { i } ) } { \frac { 1 } { n } \sum _ { j = 1 } ^ { n } \rho _ { j } } } \end{array}$ and let $Y _ { i } = \rho _ { i } g ( x _ { i } )$ .
352
+
353
+ Next, we find the expectations of $Y _ { i }$ and $\rho _ { i }$
354
+
355
+ $$
356
+ \begin{array} { c l c r } { { \displaystyle \mathbb { E } _ { p _ { i } } [ Y _ { i } ] = \int \frac { q ( \boldsymbol { x } ) } { p _ { i } ( \boldsymbol { x } ) } g ( \boldsymbol { x } ) p _ { i } ( \boldsymbol { x } ) d \boldsymbol { x } } } \\ { { = \mathbb { E } _ { q } [ g ( \boldsymbol { X } ) ] } } \end{array}
357
+ $$
358
+
359
+ $$
360
+ \begin{array} { l } { \displaystyle \mathbb { E } _ { p _ { i } } [ \rho _ { i } ] = \int \frac { q ( { \boldsymbol x } ) } { p _ { i } ( { \boldsymbol x } ) } p _ { i } ( { \boldsymbol x } ) d { \boldsymbol x } } \\ { \displaystyle = \int q ( { \boldsymbol x } ) d { \boldsymbol x } } \\ { \displaystyle = 1 } \end{array}
361
+ $$
362
+
363
+ Finally, since all $Y _ { i }$ and all $\rho _ { i }$ have the same expectation and are independent, we apply the law of large numbers to obtain that
364
+
365
+ $$
366
+ \hat { \mu } = \frac { \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \rho _ { i } g ( x _ { i } ) } { \frac { 1 } { n } \sum _ { j = 1 } ^ { n } \rho _ { j } } \xrightarrow [ ] { n \to \infty } \frac { { \mathbb E } _ { q } [ g ( X ) ] } { ( 1 ) }
367
+ $$
368
+
369
+ as desired.
370
+
371
+ Theorem C.2 implies that, even if the behaviour policy is changing over time, as long as we use an importance ratio corresponding to the policy that was used to select an action, we will retain an unbiased estimate of the expected update.
372
+
373
+ # C.3 CONSISTENCY UNDER A SLIDING WINDOW DATASET
374
+
375
+ Lemma C.3. Let $Z _ { 1 } , . . . Z _ { n }$ be random variables with mean $\mu$ . Suppose there exists a $c > 0$ such that $\mathbb { V } ( Z _ { i } ) \le c \ \forall i$ and that $\begin{array} { r } { \operatorname* { l i m } _ { | i - j | \to \infty } \operatorname { C o v } ( X _ { i } , X _ { j } ) = 0 } \end{array}$ .
376
+ Then, as N → ∞, 1N PNi=1 Zi converges in probability to µ.
377
+
378
+ Proof. Let $\begin{array} { r } { S _ { N } = \sum _ { i = 1 } ^ { N } Z _ { i } } \end{array}$
379
+
380
+ $$
381
+ \mathbb { V } ( S _ { N } ) = \sum _ { i = 1 } ^ { N } \mathbb { V } ( Z _ { i } ) + 2 \sum _ { i = 1 } ^ { N } \sum _ { j = i + 1 } ^ { N } \operatorname { C o v } ( Z _ { i } , Z _ { j } )
382
+ $$
383
+
384
+ The first term is bounded by $c N$ from our assumption on the variance. Now, to bound the second term.
385
+
386
+ Fix $\delta > 0$ and choose $M$ such that $\forall | i - j | > M$ , $| \mathrm { C o v } ( Z _ { i } , Z _ { j } ) | < \delta$ (such an $M$ must exist since $\begin{array} { r } { \operatorname* { l i m } _ { | i - j | \to \infty } \operatorname { C o v } ( X _ { i } , X _ { j } ) = 0 ) } \end{array}$ . Assuming that $N > M$ , we can decompose the second term into
387
+
388
+ $$
389
+ \begin{array} { r l } & { \displaystyle \sum _ { i = 1 } ^ { N } \sum _ { j = i + 1 } ^ { N } \mathrm { C o v } ( Z _ { i } , Z _ { j } ) = \sum _ { i = 1 } ^ { N } \sum _ { j = i + 1 } ^ { i + M } \mathrm { C o v } ( Z _ { i } , Z _ { j } ) + \sum _ { i = 1 } ^ { N } \sum _ { j = i + M + 1 } ^ { N } \mathrm { C o v } ( Z _ { i } , Z _ { j } ) } \\ & { \displaystyle \left| \sum _ { i = 1 } ^ { N } \sum _ { j = i + 1 } ^ { N } \mathrm { C o v } ( Z _ { i } , Z _ { j } ) \right| \leq \sum _ { i = 1 } ^ { N } \sum _ { j = i + 1 } ^ { i + M } | \mathrm { C o v } ( Z _ { i } , Z _ { j } ) | + \sum _ { i = 1 } ^ { N } \sum _ { j = i + M + 1 } ^ { N } | \mathrm { C o v } ( Z _ { i } , Z _ { j } ) | } \end{array}
390
+ $$
391
+
392
+ By the Cauchy-Schwarz inequality and our variance assumption, $| \mathrm { C o v } ( Z _ { i } , Z _ { j } ) | \le c$ . So, we get
393
+
394
+ $$
395
+ \begin{array} { r } { \left| \displaystyle \sum _ { i = 1 } ^ { N } \displaystyle \sum _ { j = i + 1 } ^ { N } \mathrm { C o v } ( Z _ { i } , Z _ { j } ) \right| \le \displaystyle \sum _ { i = 1 } ^ { N } \displaystyle \sum _ { j = i + 1 } ^ { i + M } c + \displaystyle \sum _ { i = 1 } ^ { N } \sum _ { j = i + M + 1 } ^ { N } \delta } \\ { \le N M c + N ^ { 2 } \delta } \end{array}
396
+ $$
397
+
398
+ Altogether, our upper bound is
399
+
400
+ $$
401
+ \mathbb { V } \left( \frac { S _ { N } } { N } \right) \le \frac { c } { N } + \frac { M c } { N } + \delta
402
+ $$
403
+
404
+ Finally, we apply Chebyshev’s inequality. For a fixed $\epsilon > 0$ ,
405
+
406
+ $$
407
+ \begin{array} { l } { \displaystyle { P \left( \left| \frac { S _ { N } } { N } - \mu \right| > \epsilon \right) \le \frac { 1 } { \epsilon ^ { 2 } } \mathbb { V } \left( \frac { S _ { N } } { N } \right) } } \\ { \displaystyle { \le \frac { 1 } { \epsilon ^ { 2 } } \left( \frac { c } { N } + \frac { M c } { N } + \delta \right) } } \end{array}
408
+ $$
409
+
410
+ Since we can choose $\delta$ to be arbitrarily small (say $\begin{array} { r } { \delta = \frac { 1 } { N } , } \end{array}$ ), the right-hand side goes to $0$ as $N \to \infty$ , concluding the proof.
md/train/SkfhIo0qtQ/SkfhIo0qtQ.md ADDED
@@ -0,0 +1,612 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # VOLUMETRIC CONVOLUTION: AUTOMATIC REPRE-SENTATION LEARNING IN UNIT BALL
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Convolution is an efficient technique to obtain abstract feature representations using hierarchical layers in deep networks. Although performing convolution in Euclidean geometries is fairly straightforward, its extension to other topological spaces—such as a sphere $( \dot { \mathbb { S } } ^ { 2 } )$ or a unit ball $( { \mathbb { B } } ^ { 3 } )$ —entails unique challenges. In this work, we propose a novel ‘volumetric convolution’ operation that can effectively convolve arbitrary functions in $\mathbb { B } ^ { 3 }$ . We develop a theoretical framework for volumetric convolution based on Zernike polynomials and efficiently implement it as a differentiable and an easily pluggable layer for deep networks. Furthermore, our formulation leads to derivation of a novel formula to measure the symmetry of a function in $\mathbb { B } ^ { 3 }$ around an arbitrary axis, that is useful in 3D shape analysis tasks. We demonstrate the efficacy of proposed volumetric convolution operation on a possible use-case i.e., 3D object recognition task.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Convolution-based deep neural networks have performed exceedingly well on 2D representation learning tasks (Krizhevsky et al., 2012; He et al., 2016). The convolution layers perform parameter sharing to learn repetitive features across the spatial domain while having lower computational cost by using local neuron connectivity. However, most state-of-the-art convolutional networks can only work on Euclidean geometries and their extension to other topological spaces e.g., spheres, is an open research problem. Remarkably, the adaptation of convolutional networks to spherical domain can advance key application areas such as robotics, geoscience and medical imaging.
12
+
13
+ Some recent efforts have been reported in the literature that aim to extend convolutional networks to spherical signals. Initial progress was made by Boomsma & Frellsen (2017), who performed conventional planar convolution with a careful padding on a spherical-polar representation and its cube-sphere transformation (Ronchi et al., 1996). A recent pioneering contribution by Cohen et al. (2018) used harmonic analysis to perform efficient convolution on the surface of the sphere $( \mathbb { S } ^ { 2 } )$ to achieve rotational equivariance. These works, however, do not systematically consider radial information in a 3D shape and the feature representations are learned at specified radii. Specifically, Cohen et al. (2018) estimated similarity between spherical surface and convolutional filter in $\mathbb { S } ^ { \bar { 2 } }$ , where the kernel can be translated in $\mathbb { S } ^ { 2 }$ . Furthermore, Weiler et al. (2018) recently solved the more general problem of SE(3) equivariance by modeling 3D data as dense vector fields in 3D Euclidean space. In this work however, we focus on $\mathbb { B } ^ { 3 }$ to achieve the equivariance to SO(3).
14
+
15
+ In this paper, we propose a novel approach to perform volumetric convolutions inside unit ball $( { \mathbb { B } } ^ { 3 } )$ that explicitly learns representations across the radial axis. Although we derive generic formulas to convolve functions in $\mathbb { B } ^ { 3 }$ , we experiment on one possible use case in this work, i.e., 3D shape recognition. In comparison to closely related spherical convolution approaches, modeling and convolving 3D shapes in $\mathbb { B } ^ { 3 }$ entails two key advantages: ‘volumetric convolution’ can capture both 2D texture and 3D shape features and can handle non-polar 3D shapes. We develop the theory of volumetric convolution using orthogonal Zernike polynomials (Canterakis, 1999), and use careful approximations to efficiently implement it using low computational-cost matrix multiplications. Our experimental results demonstrate significant boost over spherical convolution and that confirm the high discriminative ability of features learned through volumetric convolution.
16
+
17
+ Furthermore, we derive an explicit formula based on Zernike Polynomials to measure the axial symmetry of a function in $\mathbb { B } ^ { 3 }$ , around an arbitrary axis. While this formula can be useful in many function analysis tasks, here we demonstrate one particular use-case with relevance to 3D shape recognition. Specifically, we use the the derived formula to propose a hand-crafted descriptor that accurately encodes the axial symmetry of a 3D shape. Moreover, we decompose the implementation of both volumetric convolution and axial symmetry measurement into differentiable steps, which enables them to be integrated to any end-to-end architecture.
18
+
19
+ Finally, we propose an experimental architecture to demonstrate the practical usefulness of proposed operations. We use a capsule network after the convolution layer as it allows us to directly compare feature discriminability of spherical convolution and volumetric convolution without any bias. In other words, the optimum deep architecture for spherical convolution may not be the same for volumetric convolution. Capsules, however, do not deteriorate extracted features and the final accuracy only depends on the richness of input shape features. Therefore, a fair comparison between spherical and volumetric convolutions can be done by simply replacing the convolution layer.
20
+
21
+ It is worth pointing out that the proposed experimental architecture is only a one possible example out of many possible architectures, and is primarily focused on three factors: 1) Capture useful features with a relatively shallow network compared to state-of-the-art. 2) Show richness of computed features through clear improvements over spherical convolution. 3) Demonstrate the usefulness of the volumetric convolution and axial symmetry feature layers as fully differentiable and easily pluggable layers, which can be used as building blocks for end-to-end deep architectures.
22
+
23
+ The main contributions of this work include:
24
+
25
+ • Development of the theory for volumetric convolution that can efficiently model functions in $\mathbb { B } ^ { 3 }$ .
26
+ • Implementation of the proposed volumetric convolution as a fully differentiable module that can be plugged into any end-to-end deep learning framework. The first approach to perform volumetric convolution on 3D objects that can simultaneously model 2D (appearance) and 3D (shape) features.
27
+ • A novel formula to measure the axial symmetry of a function defined in $\mathbb { B } ^ { 3 }$ , around an arbitrary axis using Zernike polynomials.
28
+ • An experimental end-to-end trainable framework that combines hand-crafted feature representation with automatically learned representations to obtain rich 3D shape descriptors.
29
+
30
+ The rest of the paper is structured as follows. In Sec. 2 we introduce the overall problem and our proposed solution. Sec. 3 presents an overview of 3D Zernike polynomials. Then, in Sec. 4 and Sec. 5 we derive the proposed volumetric convolution and axial symmetry measurement formula respectively. Sec. 6.2 presents our experimental architecture, and in Sec. 7 we show the effectiveness of the derived operators through extensive experiments. Finally, we conclude the paper in Sec. 8.
31
+
32
+ # 2 PROBLEM DEFINITION
33
+
34
+ Convolution is an effective method to capture useful features from uniformly spaced grids in $\mathbb { R } ^ { n }$ , within each dimension of $n$ , such as gray scale images $( \mathbb { R } ^ { 2 } )$ , RGB images $( \mathbb { R } ^ { 3 } )$ , spatio-temporal data $( \mathbb { R } ^ { 3 } )$ and stacked planar feature maps $( \mathbb { R } ^ { n } )$ . In such cases, uniformity of the grid within each dimension ensures the translation equivariance of the convolution. However, for topological spaces such as $\mathbb { S } ^ { 2 }$ and $\mathbb { B } ^ { 3 }$ , it is not possible to construct such a grid due to non-linearity. A naive approach to perform convolution in $\mathbb { B } ^ { 3 }$ would be to create a uniformly spaced three dimensional grid in $( r , \theta , \phi )$ coordinates (with necessary padding) and perform 3D convolution. However, the spaces between adjacent points in each axis are dependant on their absolute position and hence, modeling such a space as a uniformly spaced grid is not accurate.
35
+
36
+ To overcome these limitations, we propose a novel volumetric convolution operation which can effectively perform convolution on functions in $\mathbb { B } ^ { 3 }$ . It is important to note that ideally, the convolution in $\mathbb { B } ^ { 3 }$ should be a signal on both 3D rotation group and 3D translation. However, since Zernike polynomials do not have the necessary properties to automatically achieve translation equivariance, we stick to 3D rotation group in this work and refer to this operation as convolution from here onwards. Fig. 1 shows the analogy between planar convolution and volumetric convolution. In Sec. 3, we present an overview of 3D Zernike polynomials that will be later used in Sec. 4 to develop volumetric convolution operator.
37
+
38
+ # 3 3D ZERNIKE POLYNOMIALS
39
+
40
+ 3D Zernike polynomials are a complete and orthogonal set of basis functions in $\mathbb { B } ^ { 3 }$ , that exhibits a ‘form invariance’ property under 3D rotation (Canterakis, 1999). A $( n , l , m ) ^ { t h }$ order 3D Zernike basis function is defined as,
41
+
42
+ $$
43
+ Z _ { n , l , m } = R _ { n , l } ( r ) Y _ { l , m } ( \theta , \phi )
44
+ $$
45
+
46
+ where $R _ { n , l }$ is the Zernike radial polynomial (Appendix D.3), $Y _ { l , m } ( \theta , \phi )$ is the spherical harmonics function (Appendix D.1), $n \in \mathbb { Z } ^ { + }$ , $l \in [ 0 , n ]$ , $m \in [ - l , l ]$ and $n - l$ is even. Since 3D Zernike polynomials are orthogonal and complete in $\mathbb { B } ^ { 3 }$ , an arbitrary function $f ( r , \theta , \phi )$ in $\mathbb { B } ^ { 3 }$ can be approximated using Zernike polynomials as follows.
47
+
48
+ $$
49
+ f ( \theta , \phi , r ) = \sum _ { n = 0 } ^ { \infty } \sum _ { l = 0 } ^ { n } \sum _ { m = - l } ^ { l } \Omega _ { n , l , m } ( f ) Z _ { n , l , m } ( \theta , \phi , r )
50
+ $$
51
+
52
+ where $\Omega _ { n , l , m } ( f )$ could be obtained using,
53
+
54
+ $$
55
+ \Omega _ { n , l , m } ( f ) = \int _ { 0 } ^ { 1 } \int _ { 0 } ^ { 2 \pi } \int _ { 0 } ^ { \pi } f ( \theta , \phi , r ) Z _ { n , l , m } ^ { \dag } r ^ { 2 } s i n \phi d r d \phi d \theta
56
+ $$
57
+
58
+ where $^ { \dagger }$ denotes the complex conjugate. In Sec. 4, we will derive the proposed volumetric convolution.
59
+
60
+ # 4 VOLUMETRIC CONVOLUTION OF FUNCTIONS IN $\mathbb { B } ^ { 3 }$
61
+
62
+ When performing convolution in $\mathbb { B } ^ { 3 }$ , a critical problem which arises is that several rotation operations exist for mapping a point $p$ to a particular point $p ^ { \prime }$ . For example, using Euler angles, we can decompose a rotation into three rotation operations $R ( \theta , \phi ) = \mathrm { \bar { \it R } } ( \theta ) _ { y } R ( \mathrm { \bar { \phi } } ) _ { z } R ( \theta ) _ { y }$ , and the first rotation $R ( \theta ) _ { y }$ can differ while mapping $p$ to $p ^ { \prime }$ (if $y$ is the north pole). However, if we enforce the kernel function to be symmetric around $y$ , the function of the kernel after rotation would only depend on $p$ and $p ^ { \prime }$ . This observation is important for our next derivations because we can then uniquely define a 3D rotation on kernel in terms of azimuth and polar angles.
63
+
64
+ Let the kernel be symmetric around $y$ and $f ( \theta , \phi , r ) , g ( \theta , \phi , r )$ be the functions of object and kernel respectively. Then we define volumetric convolution as,
65
+
66
+ $$
67
+ \mathfrak { r } _ { \ast } g ( \alpha , \beta ) : = \langle f ( \theta , \phi , r ) , \tau _ { ( \alpha , \beta ) } ( g ( \theta , \phi , r ) ) \rangle = \int _ { 0 } ^ { 1 } \int _ { 0 } ^ { 2 \pi } \int _ { 0 } ^ { \pi } f ( \theta , \phi , r ) , \tau _ { ( \alpha , \beta ) } ( g ( \theta , \phi , r ) ) \sin \phi d \phi d \theta d r \cos \theta \mathrm { d } \theta ,
68
+ $$
69
+
70
+ where $\tau _ { ( \alpha , \beta ) }$ is an arbitrary rotation, that aligns the north pole with the axis towards $( \alpha , \beta )$ direction ( $\alpha$ and $\beta$ are azimuth and polar angles respectively). Eq. 4 is able to capture more complex patterns compared to spherical convolution due to two reasons: $^ { l }$ ) the inner product integrates along the radius and 2) the projection onto spherical harmonics forces the function into a polar function, that can result in information loss.
71
+
72
+ In Sec. 4.1 we derive differentiable relations to compute 3D Zernike moments for functions in $\mathbb { B } ^ { 3 }$
73
+
74
+ # 4.1 SHAPE MODELING OF FUNCTIONS IN $\mathbb { B } ^ { 3 }$ USING 3D ZERNIKE POLYNOMIALS
75
+
76
+ Instead of using Eq. 3, we derive an alternative method to obtain the set $\left\{ \Omega _ { n , l , m } \right\}$ . The motivations are two fold: $^ { l }$ ) ease of computation and 2) the completeness property of 3D Zernike Polynomials ensures that $\begin{array} { r } { \operatorname* { l i m } _ { n \infty } \mathopen { } \mathclose \bgroup \| f - \sum _ { n } \sum _ { l } \sum _ { m } \Omega _ { n , l , m } Z _ { n , l , m } \aftergroup \egroup \| = 0 } \end{array}$ for any arbitrary function $f$ . However, since $n$ should be finite in the implementation, aforementioned property may not hold, leading to increased distance between the Zernike representation and the original shape. Therefore, minimizing the reconstruction error $\begin{array} { r } { \sum _ { ( \theta , \phi , r ) \in \mathbb { S } ^ { 3 } } \left| \bar { f } ( \theta , \phi , r ) - f ( \theta , \phi , r ) \right| } \end{array}$ where $\begin{array} { r } { \bar { f } ( \theta , \bar { \phi } , r ) = { \sum _ { n } ^ { N } } \sum _ { l } { \sum _ { m } \bar { \Omega _ { n , l , m } } } Z _ { n , l , m } } \end{array}$ , pushes the set $\left\{ \Omega _ { n , l , m } \right\}$ inside frequency space, where $\{ \Omega _ { n , l , m } \}$ has a closer resemblance to the corresponding shape. Following this conclusion, we derive the following method to obtain $\{ \Omega _ { n , l , m } \}$ .
77
+
78
+ ![](images/c81e792c686d5c14318aba4f66ddc2beca97f9b8582d5b7035dd3256e5eeddb4.jpg)
79
+ Figure 1: Analogy between planar and volumetric convolutions. Top (left to right): image, kernel and planar convolution. Bottom (left to right): 3D object, 3D kernel and volumetric convolution. In planar convolution the kernel translates and inner product between the image and the kernel is computed in $( x , y )$ plane. In volumetric convolution a 3D rotation is applied to the kernel and the inner product is computed between 3D function and 3D kernel over $\mathbb { B } ^ { 3 }$ .
80
+
81
+ Since $\begin{array} { r } { Y _ { l , m } ( \theta , \phi ) = ( - 1 ) ^ { m } \sqrt { \frac { 2 l + 1 } { 4 \pi } \frac { ( l - m ) ! } { ( l + m ) ! } } P _ { l } ^ { m } ( c o s \phi ) e ^ { i m \theta } } \end{array}$ , where $P _ { l } ^ { m } ( \cdot )$ is the associated Legendre function (Appendix D.2), it can be deduced that, $Y _ { l , - m } ( \theta , \phi ) = ( - 1 ) ^ { m } Y _ { l , m } ^ { \dag } ( \theta , \phi )$ . Using this relationship we obtain $Z _ { n , l , - m } ( \theta , \phi ) = ( - 1 ) ^ { m } Z _ { n , l , m } ^ { \dag } ( \theta , \phi )$ and hence approximate Eq. 2 as,
82
+
83
+ $$
84
+ f ( \theta , \phi , r ) = \sum _ { n = 0 } ^ { \infty } \sum _ { l = 0 } ^ { n } \sum _ { m = 0 } ^ { l } A _ { n , l , m } R e \{ Z _ { n , l , m } \} + B _ { n , l , m } I m g \{ Z _ { n , l , m } \}
85
+ $$
86
+
87
+ where $R e \{ Z _ { n , l , m } \}$ and $I m g \{ Z _ { n , l , m } \}$ are real and imaginary components of $Z _ { n , l , m }$ respectively. In matrix form, this can be rewritten as,
88
+
89
+ $$
90
+ f ( \theta , \phi , r ) = U a + V b = f ( \theta , \phi , r ) = X c
91
+ $$
92
+
93
+ where $c$ is the set of 3D Zernike moments $\Omega _ { n , l , m }$ . Eq. 6 can be interpreted as an overdetermined linear system, with the set $\Omega _ { n , l , m }$ as the solution. To find the least squared error solution to the Eq. 6 we use the pseudo inverse of $X$ . Since this operation has to be differentiable to train the model end-to-end, a common approach like singular value decomposition cannot be used here. Instead, we use an iterative method to calculate the pseudo inverse of a matrix (Li et al., 2011). It has been shown that $V _ { n }$ converges to $A ^ { + }$ where $A ^ { + }$ is the Moore-Penrose pseudo inverse of $A$ if,
94
+
95
+ $$
96
+ V _ { n + 1 } = V _ { n } ( 3 I - A V _ { n } ( 3 I - A V _ { n } ) ) , n \in \mathbb { Z } ^ { + }
97
+ $$
98
+
99
+ for a suitable initial approximation $V _ { 0 }$ . They also showed that a suitable initial approximation would be $V _ { 0 } = \alpha A ^ { T }$ with $0 < \alpha < 2 / \rho ( A A ^ { T } )$ , where $\rho ( \cdot )$ denotes the spectral radius. Empirically, we choose $\alpha = 0 . 0 0 1$ in our experiments. Next, we derive the theory of volumetric convolution within the unit ball.
100
+
101
+ # 4.2 CONVOLUTION IN $\mathbb { B } ^ { 3 }$ USING 3D ZERNIKE POLYNOMIALS
102
+
103
+ We formally present our derivation of volumetric convolution using the following theorem. A short version of the proof is then provided. Please see Appendix A for the complete derivation.
104
+
105
+ Theorem 1: Suppose $f , g : X \longrightarrow \mathbb { R } ^ { 3 }$ are square integrable complex functions defined in $\mathbb { B } ^ { 3 }$ so that $\langle f , f \rangle < \infty$ and $\langle g , g \rangle < \infty$ . Further, suppose $g$ is symmetric around north pole and $\tau ( \alpha , \beta ) = R _ { y } ( \alpha ) R _ { z } ( \beta )$ where $R \in S O ( 3 )$ . Then,
106
+
107
+ $$
108
+ \int _ { 0 } ^ { 1 } \int _ { 0 } ^ { 2 \pi } \int _ { 0 } ^ { \pi } f ( \theta , \phi , r ) , \tau _ { ( \alpha , \beta ) } ( g ( \theta , \phi , r ) ) \sin \phi d \phi d \theta d r \equiv \frac { 4 \pi } { 3 } \sum _ { n = 0 } ^ { \infty } \sum _ { l = 0 } ^ { n } \sum _ { m = - l } ^ { l } \Omega _ { n , l , m } ( f ) \Omega _ { n , l , 0 } ( g ) Y _ { l , m } ( \theta , \phi , r ) ,
109
+ $$
110
+
111
+ where $\Omega _ { n , l , m } ( f ) , \Omega _ { n , l , 0 } ( g )$ and $Y _ { l , m } ( \theta , \phi )$ are $( n , l , m ) ^ { t h }$ $3 D$ Zernike moment of $f$ , $( n , l , 0 ) ^ { t h } \ 3 D$ Zernike moment of $g$ , and spherical harmonics function respectively.
112
+
113
+ Proof: Completeness property of 3D Zernike Polynomials ensures that it can approximate an arbitrary function in $\bar { \mathbb { B } } ^ { 3 }$ , as shown in Eq. 2. Leveraging this property, Eq. 4 can be rewritten as,
114
+
115
+ $$
116
+ f \ast g ( \theta , \phi ) = \langle \sum _ { n = 0 } ^ { \infty } \sum _ { l = 0 } ^ { n } \sum _ { m = - l } ^ { l } \Omega _ { n , l , m } ( f ) Z _ { n , l , m } , \tau _ { ( \theta , \phi ) } ( \sum _ { n ^ { \prime } = 0 } ^ { \infty } \sum _ { l ^ { \prime } = 0 } ^ { n ^ { \prime } } \sum _ { m ^ { \prime } = - l } ^ { l } \Omega _ { n ^ { \prime } , l ^ { \prime } , m ^ { \prime } } ( g ) Z _ { n ^ { \prime } , l ^ { \prime } , m ^ { \prime } } ) \rangle
117
+ $$
118
+
119
+ However, since $g ( \theta , \phi , r )$ is symmetric around $y$ , the rotation around $y$ should not change the function. This ensures,
120
+
121
+ $$
122
+ g ( r , \theta , \phi ) = g ( r , \theta - \alpha , \phi )
123
+ $$
124
+
125
+ and hence,
126
+
127
+ $$
128
+ \sum _ { n ^ { \prime } = 0 } ^ { \infty } \sum _ { l ^ { \prime } = 0 } ^ { n ^ { \prime } } \sum _ { m ^ { \prime } = - l } ^ { l } \Omega _ { n ^ { \prime } , l ^ { \prime } , m ^ { \prime } } ( g ) R _ { n ^ { \prime } , l ^ { \prime } } ( r ) Y _ { l ^ { \prime } , m ^ { \prime } } = \sum _ { n ^ { \prime } = 0 } ^ { \infty } \sum _ { l ^ { \prime } = 0 } ^ { n ^ { \prime } } \sum _ { m ^ { \prime } = - l } ^ { l } \Omega _ { n ^ { \prime } , l ^ { \prime } , m ^ { \prime } } ( g ) R _ { n ^ { \prime } , l ^ { \prime } } ( r ) Y _ { l ^ { \prime } , m ^ { \prime } } e ^ { - i m ^ { \prime } \alpha }
129
+ $$
130
+
131
+ This is true, if and only if $m ^ { \prime } = 0$ . Therefore, a symmetric function around $y$ , defined inside the unit sphere can be rewritten as,
132
+
133
+ $$
134
+ \sum _ { n ^ { \prime } = 0 } ^ { \infty } \sum _ { l ^ { \prime } = 0 } ^ { n ^ { \prime } } \Omega _ { n ^ { \prime } , l ^ { \prime } , 0 } ( g ) Z _ { n ^ { \prime } , l ^ { \prime } , 0 }
135
+ $$
136
+
137
+ which simplifies Eq. 9 to,
138
+
139
+ $$
140
+ f \ast g ( \theta , \phi ) = \langle \sum _ { n = 0 } ^ { \infty } \sum _ { l = 0 } ^ { n } \sum _ { m = - l } ^ { l } \Omega _ { n , l , m } ( f ) Z _ { n , l , m } , \tau _ { ( \theta , \phi ) } ( \sum _ { n ^ { \prime } = 0 } ^ { \infty } \sum _ { l ^ { \prime } = 0 } ^ { n ^ { \prime } } \Omega _ { n ^ { \prime } , l ^ { \prime } , 0 } ( g ) Z _ { n ^ { \prime } , l ^ { \prime } , 0 } ) \rangle
141
+ $$
142
+
143
+ Using the properties of inner product, Eq. 13 can be rearranged as,
144
+
145
+ $$
146
+ f \ast g ( \theta , \phi ) = \sum _ { n = 0 } ^ { \infty } \sum _ { l = 0 } ^ { n } \sum _ { n ^ { \prime } = 0 } ^ { \infty } \sum _ { l ^ { \prime } = 0 } ^ { n ^ { \prime } } \sum _ { m = - l } ^ { l } \Omega _ { n , l , m } ( f ) \Omega _ { n ^ { \prime } , l ^ { \prime } , 0 } ( g ) \langle Z _ { n , l , m } , \tau _ { ( \theta , \phi ) } ( Z _ { n ^ { \prime } , l ^ { \prime } , 0 } ) \rangle
147
+ $$
148
+
149
+ Using the rotational properties of Zernike polynomials, we obtain (see Appendix A for our full derivation),
150
+
151
+ $$
152
+ f \ast g ( \theta , \phi ) = \frac { 4 \pi } { 3 } \sum _ { n = 0 } ^ { \infty } \sum _ { l = 0 } ^ { n } \sum _ { m = - l } ^ { l } \Omega _ { n , l , m } ( f ) \Omega _ { n , l , 0 } ( g ) Y _ { l , m } ( \theta , \phi )
153
+ $$
154
+
155
+ Since we can calculate $\Omega _ { n , l , m } ( f )$ and $\Omega _ { n , l , 0 } ( g )$ easily using Eq. 6, $f * g ( \theta , \phi )$ can be found using a simple matrix multiplication. It is interesting to note that, since the convolution kernel does not translate, the convolution produces a polar shape, which can be further convolved–if needed–using the relationship f ∗ g(θ, φ) = q $\begin{array} { r } { f \ast g ( \theta , \phi ) = \sqrt { \frac { 4 \pi } { 2 l + 1 } } \sum _ { l } \sum _ { m = - l } ^ { l } \hat { f } ( l , m ) \hat { g } ( l , m ) Y _ { ( l , m ) } ( \theta , \phi ) } \end{array}$ where, ${ \hat { f } } ( l , m )$ and ${ \hat { g } } ( l , m )$ are the $( l , m ) ^ { t h }$ frequency components of $f$ and $g$ in spherical harmonics space. Next, we present a theorem to show the equivariance of volumetric convolution with respect to 3D rotation group.
156
+
157
+ # 4.3 EQUIVARIANCE TO 3D ROTATION GROUP
158
+
159
+ One key property of the proposed volumetric convolution is its equivariance to 3D rotation group. To demonstrate this, we present the following theorem.
160
+
161
+ Theorem 1: Suppose $f , g : X \longrightarrow \mathbb { R } ^ { 3 }$ are square integrable complex functions defined in $\mathbb { B } ^ { 3 }$ so that $\langle f , f \rangle < \infty$ and $\langle g , g \rangle < \infty$ . Also, let $\eta _ { \alpha , \beta , \gamma }$ be a $3 D$ rotation operator that can be decomposed into three Eular rotations $\bar { R } _ { y } ( \alpha ) R _ { z } ( \beta ) R _ { y } ( \gamma )$ and $\tau _ { \alpha , \beta }$ another rotation operator that can be decomposed into $R _ { y } ( \alpha ) R _ { z } ( \beta )$ . Suppose $\eta _ { \alpha , \beta , \gamma } ( g ) = \tau _ { \alpha , \beta } ( g )$ . Then, $\eta _ { ( \alpha , \beta , \gamma ) } ( f ) \ast g ( \theta , \phi ) = \tau _ { ( \alpha , \beta ) } ( f \ast g ) ( \theta , \phi )$ , where $^ *$ is the volumetric convolution operator.
162
+
163
+ The proof to our theorem can be found in Appendix B. The intuition behind the theorem is that if a 3D rotation is applied to a function defined in $\mathbf { \bar { \mathbb { B } } ^ { 3 } }$ Hilbert space, the output feature map after volumetric convolution exhibits the same rotation. The output feature map however, is symmetric around north pole, hence the rotation can be uniquely defined in terms of azimuth and polar angles.
164
+
165
+ # 5 AXIAL SYMMETRY OF FUNCTIONS IN $\mathbb { B } ^ { 3 }$
166
+
167
+ In this section we present the following proposition to obtain the axial symmetry measure of a function in $\mathbb { B } ^ { 3 }$ , around an arbitrary axis using 3D Zernike polynomials.
168
+
169
+ ![](images/284fa40c19573f367ab577b37abf938a8229ee451166d2ea69e1b908b352f3b4.jpg)
170
+ Figure 2: Kernel representations of spherical convolution (left) vs Volumetric convolution (right). In volumetric convolution, the shape is modeled and convolved in $\mathbb { B } ^ { 3 }$ which allows encoding non-polar 3D shapes with texture. In contrast, spherical convolution is performed in $\mathbb { S } ^ { 2 }$ that can handle only polar 3D shapes with uniform texture.
171
+
172
+ Proposition: Suppose $g : X \longrightarrow \mathbb { R } ^ { 3 }$ is a square integrable complex function defined in $\mathbb { B } ^ { 3 }$ such that $\langle g , g \rangle < \infty$ . Then, the power of projection of g in to $S = \left\{ Z _ { i } \right\}$ where $S$ is the set of Zernike basis functions that are symmetric around an axis towards $( \alpha , \beta )$ direction is given by,
173
+
174
+ $$
175
+ | | s y m _ { ( \alpha , \beta ) } | | = \sum _ { n } \sum _ { l = 0 } ^ { n } | | \sum _ { m = - l } ^ { l } \Omega _ { n , l , m } Y _ { m , l } ( \alpha , \beta ) | | ^ { 2 }
176
+ $$
177
+
178
+ where $\alpha$ and $\beta$ are azimuth and polar angles respectively.
179
+
180
+ The proof to our proposition is given in Appendix C.
181
+
182
+ # 6 A CASE STUDY: 3D OBJECT RECOGNITION
183
+
184
+ # 6.1 3D OBJECTS AS FUNCTIONS IN $\mathbb { B } ^ { 3 }$
185
+
186
+ A 2D image is a function on Cartesian plane, where a unique value exists for any $( x , y )$ coordinate. Similarly, a polar 3D object can be expressed as a function on the surface of the sphere, where any direction vector $( \theta , \phi )$ has a unique value. To be precise, a 3D polar object has a boundary function in the form of $f : \mathbb { S } ^ { 2 } \to [ 0 , \infty ]$ .
187
+
188
+ Translation of the convolution kernel on $( x , y )$ plane in 2D case, extends to movements on the surface of the sphere in $\mathbb { S } ^ { 2 }$ . If both the object and the kernel have polar shapes, this task can be tackled by projecting both the kernel and the object onto spherical harmonic functions (Appendix E). However, this technique suffers from two drawbacks. 1) Since spherical harmonics are defined on the surface of the unit sphere, projection of a 3D shape function into spherical harmonics approximates the object to a polar shape, which can cause critical loss of information for non-polar 3D shapes. This is frequently the case in realistic scenarios. 2) The integration happens over the surface of the sphere, which is unable to capture patterns across radius.
189
+
190
+ These limitations can be addressed by representing and convolving the shape function inside the unit ball $( { \mathbb { B } } ^ { 3 } )$ . Representing the object function inside $\mathbb { B } ^ { 3 }$ allows the function to keep its complex shape information without any deterioration since each point is mapped to unique coordinates $( r , \theta , \phi )$ , where $r$ is the radial distance, $\theta$ and $\phi$ are azimuth and polar angles respectively. Additionally, it allows encoding of 2D texture information simultaneously. Figure 2 compares volumetric convolution and spherical convolution. Since we conduct experiments only on 3D objects with uniform surface values, in this work we use the following transformation to apply a simple surface function $f ( \theta , \phi , r )$ to the 3D objects:
191
+
192
+ $$
193
+ f ( \theta , \phi , r ) = \left\{ { r , \mathrm { ~ i f ~ s u r f a c e ~ e x i s t s ~ a t ~ } ( \theta , \phi , r ) } \right.
194
+ $$
195
+
196
+ # 6.2 AN EXPERIMENTAL ARCHITECTURE
197
+
198
+ We implement an experimental architecture to demonstrate the usefulness of the proposed operations. While these operations can be used as building-tools to construct any deep network, we focus on three key factors while developing the presented experimental architecture: 1) Shallowness: Volumetric convolution should be able to capture useful features compared to other methodologies with less number of layers. 2) Modularity: The architecture should have a modular nature so that a fair comparison can be made between volumetric and spherical convolution. We use a capsule network after the convolution layer for this purpose. 3) Flexibility: It should clearly exhibit the usefulness of axial symmetry features as a hand-crafted and fully differentiable layer. The motivation is to demonstrate one possible use case of axial symmetry measurements in 3D shape analysis.
199
+
200
+ ![](images/3112297da6346bdbdd1f3aa87937bed37e3a5e169f98649512f7ced279dbaefc.jpg)
201
+ Figure 3: Experimental architecture: An object is first mapped to three view angles. For each angle, axial symmetry and volumetric convolution features are generated for $P ^ { + }$ and $P ^ { - }$ . These two features are then separately combined using compact bilinear pooling. Finally, the features are fed to two individual capsule networks, and the decisions are max-pooled.
202
+
203
+ The proposed architecture consists of four components. First, we obtain three view angles, and later generate features for each view angle separately. We optimize the view angles to capture complimentary shape details such that the total information content is maximized. For each viewing angle $\cdot _ { k } ,$ , we obtain two point sets $P _ { k } ^ { + }$ and $P _ { k } ^ { - }$ consisting of tuples denoted as:
204
+
205
+ $$
206
+ P _ { k } ^ { + } = \{ ( x _ { i } , y _ { i } , z _ { i } ) : y _ { i } > 0 \}
207
+ $$
208
+
209
+ such that $y$ denotes the horizontal axis. Second, the six point sets are volumetrically convolved with kernels to capture local patterns of the object. The generated features for each point set are then combined using compact bilinear pooling. Third, we use axial symmetry measurements to generate additional features. The features that represent each point set are then combined using compact bilinear pooling. Fourth, we feed features from second and third components of the overall architecture to two independent capsule networks and combine the outputs at decision level to obtain the final prediction. The overall architecture of the proposed scheme is shown in Fig. 3.
210
+
211
+ # 6.3 OPTIMUM VIEW ANGLES
212
+
213
+ We use three view angles to generate features for better representation of the object. First, we translate the center of mass of the set of $( x , y , z )$ points to the origin. The goal of this step is to achieve a general translational invariance, which allows us to free the convolution operation from the burden of detecting translated local patterns. Subsequently, the point set is rearranged as an ordered set on $x$ and $z$ and a 1D convolution net is applied on $y$ values of the points. Here, the objective is to capture local variations of points along the $y$ axis, since later we analyze point sets $P ^ { + }$ and $P ^ { - }$ independently. The trained filters can be assumed to capture properties similar to $\partial ^ { n } y / \partial x ^ { n }$ and $\partial ^ { n } y / \partial z ^ { n }$ , where $n$ is the order of derivative. The output of the 1D convolution net is rotation parameters represented by a $1 \times 9$ vector $\vec { r } = \{ r _ { 1 } , r _ { 2 } , \cdot \cdot \cdot , r _ { 9 } \}$ . Then, we compute $R _ { 1 } = R _ { x } ( r _ { 1 } ) \bar { R } _ { y } ( r _ { 2 } ) R _ { z } ( r _ { 3 } )$ , $R _ { 2 } = R _ { x } ( r _ { 4 } ) R _ { y } ( r _ { 5 } ) R _ { z } ( r _ { 6 } )$ and $R _ { 3 } = R _ { x } ( r _ { 7 } ) \dot { R } _ { y } ( r _ { 8 } ) R _ { z } ( r _ { 9 } )$ where $R _ { 1 } , R _ { 2 }$ and $R _ { 3 }$ are the rotations that map the points to three different view angles.
214
+
215
+ After mapping the original point set to three view angles, we extract the $P _ { k } ^ { + }$ and $P _ { k } ^ { - }$ point sets from each angle $k$ that gives us six point sets. These sets are then fed to the volumetric convolution layer to obtain feature maps for each point set. We then measure the symmetry around four equi-angular axes using Eq. 16, and concatenate these measurement values to form a feature vector for the same point sets.
216
+
217
+ # 6.4 FEATURE FUSION USING COMPACT BILINEAR POOLING
218
+
219
+ Compact bilinear pooling (CBP) provides a compact representation of the full bilinear representation, but has the same discriminative power. The key advantage of compact bilinear pooling is the significantly reduced dimensionality of the pooled feature vector.
220
+
221
+ We first concatenate the obtained volumetric convolution features of the three angles, for $P ^ { + }$ and $P ^ { - }$ separately to establish two feature vectors. These two features are then fused using compact bilinear
222
+
223
+ pooling (Gao et al., 2016). The same approach is used to combine the axial symmetry features. These fused vectors are fed to two independent capsule nets.
224
+
225
+ Furthermore, we experiment with several other feature fusion techniques and present results in Sec. 7.2.
226
+
227
+ # 6.5 CAPSULE NETWORK
228
+
229
+ Capsule Network (CapsNet) (Sabour et al., 2017) brings a new paradigm to deep learning by modeling input domain variations through vector based representations. CapsNets are inspired by so-called inverse graphics, i.e., the opposite operation of image rendering. Given a feature representation, CapsNets attempt to generate the corresponding geometrical representation. The motivation for using CapsNets in the network are twofold: 1) CapsNet promotes a dynamic ‘routing-by-agreement’ approach where only the features that are in agreement with high-level detectors are routed forward. This property of CapsNets does not deteriorate extracted features and the final accuracy only depends on the richness of original shape features. It allows us to directly compare feature discriminability of spherical and volumetric convolution without any bias. For example, using multiple layers of volumetric or spherical convolution hampers a fair comparison since it can be argued that the optimum architecture may vary for two different operations. 2) CapsNet provides an ideal mechanism for disentangling 3D shape features through pose and view equivariance while maintaining an intrinsic co-ordinate frame where mutual relationships between object parts are preserved.
230
+
231
+ Inspired by these intuitions, we employ two independent CapsNets in our network for volumetric convolution features and axial symmetry features. In this layer, we rearrange the input feature vectors as two sets of primary capsules—for each capsule net—and use the dynamic routing technique proposed by Sabour et al. (2017) to predict the classification results. The outputs are then combined using max-pooling, to obtain the final classification result. For volumetric convolution features, our architecture uses 1000 primary capsules with 10 dimensions each. For axial symmetry features, we use 2500 capsules, each with 10 dimensions. In both networks, decision layer consist of 12 dimensional capsules.
232
+
233
+ # 6.6 HYPERPARAMETERS
234
+
235
+ We use $n = 5$ to implement Eq. 15 and three iterations to calculate the Moore-Penrose pseudo inverse using Eq. 7. We use a decaying learning rate $l r = 0 . 1 \times 0 . 9 ^ { \frac { g _ { s t e p } } { 3 0 0 0 } }$ , where $g _ { s t e p }$ is incremented by one per each iteration. For training, we use the Adam optimizer with $\beta _ { 1 } = 0 . 9 , \beta _ { 2 } = 0 . 9 9 9 , \epsilon = 1 \times 1 0 ^ { - 8 }$ where parameters refer to the usual notation. All these values are chosen empirically. Since we have decomposed the theoretical derivations into sets of low-cost matrix multiplications, specifically aiming to reduce the computational complexity, the GPU implementation is highly efficient. For example, the model takes less than 15 minutes for an epoch during the training phase for ModelNet10, with a batchsize 2, on a single GTX 1080Ti GPU.
236
+
237
+ # 7 EXPERIMENTS
238
+
239
+ In this section, we discuss and evaluate the performance of the proposed approach. We first compare the accuracy of our model with relevant state-of-the-art work, and then present a thorough ablation study of our model, that highlights the importance of several architectural aspects. We use ModelNet10 and ModelNet40 datasets in our experiments. Next, we evaluate the robustness of our approach against loss of information and finally show that the proposed approach for computing 3D Zernike moments produce richer representations of 3D shapes, compared to the conventional approach.
240
+
241
+ # 7.1 COMPARISON WITH THE STATE-OF-THE-ART
242
+
243
+ Table 1 illustrates the performance comparison of our model with state-of-the-art. The model attains an overall accuracy of $9 2 . 1 7 \%$ on ModelNet10 and $8 6 . 5 \%$ accuracy on ModelNet40, which is on par with state-of-the-art. We do not compare with other recent work, such as Kanezaki et al. (2016); Qi et al. (2016); Sedaghat et al. (2016); Wu et al. (2016); Qi et al. (2016); Bai et al. (2016); Maturana & Scherer (2015) that show impressive performance on
244
+
245
+ <table><tr><td>Method</td><td>Trainable layers</td><td>#Params</td><td>M10</td><td>M40</td></tr><tr><td>SO-Net (Li et al., 2018)</td><td>11FC</td><td>60M</td><td>95.7%</td><td>93.4%</td></tr><tr><td>Kd-Networks (Klokov &amp; Lempitsky,2017)</td><td>15KD</td><td></td><td>94.0%</td><td>91.8%</td></tr><tr><td>VRN (Brock et al.,2016)</td><td>45Conv</td><td>90M</td><td>93.11%</td><td>90.8%</td></tr><tr><td>Pairwise (Johns et al.,2016)</td><td>23Conv</td><td>143M</td><td>92.8%</td><td>90.7%</td></tr><tr><td>MVCNN (Su et al.,2015)</td><td>60Conv +36FC</td><td>200M</td><td>=</td><td>90.1%</td></tr><tr><td>Ours</td><td>3Conv+2Caps</td><td>4.4M</td><td>92.17%</td><td>86.5%</td></tr><tr><td>PointNet (Qi et al.,2017)</td><td>2ST+5Conv</td><td>80M</td><td>-</td><td>86.2%</td></tr><tr><td>ECC (Simonovsky &amp; Komodakis,2017)</td><td>4Conv +1FC</td><td>-</td><td>-</td><td>83.2%</td></tr><tr><td>DeepPano (Shi et al.,2015)</td><td>4Conv +3FC</td><td></td><td>85.45%</td><td>77,63%</td></tr><tr><td>3DShapeNets (Wu et al.,2015)</td><td>4-3DConv + 2FC</td><td>38M</td><td>83.5%</td><td>77%</td></tr><tr><td>PointNet (Garcia-Garcia et al.,2016)</td><td>2Conv +2FC</td><td>80M</td><td>77.6%</td><td>-</td></tr></table>
246
+
247
+ Table 1: Comparison with state-of-theart methods on ModelNet10 and ModelNet40 datasets (ranked according to performance). Ours achieve a competitive performance with the least network depth.
248
+
249
+ ModelNet10 and ModelNet40. These are not comparable with our proposed approach, as we propose a shallow, single model without any data augmentation, with a relatively low number of parameters. Furthermore, our model reports these results by using only a single volumetric convolution layer for learning features. Fig. 4 demonstrates effectiveness of our architecture by comparing accuracy against the number of trainable parameters in state-of-the-art models.
250
+
251
+ # 7.2 ABLATION STUDY
252
+
253
+ Table 3 depicts the performance comparison between several variants of our model. To highlight the effectiveness of the learned optimum view points, we replace the optimum view point layer with three fixed orthogonal view points. This modification causes an accuracy drop of $6 . 5 7 \%$ , emphasizing that the optimum view points indeed depends on the shape. Another interesting— perhaps the most important—aspect to study is the performance of the proposed volumetric convolution against spherical convolution. To this end, we replace the volumetric convolution layer of our model with spherical convolution and compare the results. It can be seen that our volumetric convolution scheme outperforms spherical convolution by a significant margin of $1 2 . 5 6 \%$ , indicating that volumetric convolution captures shape properties more effectively.
254
+
255
+ Table 2: Ablation study of the proposed architecture on ModelNet10 dataset
256
+
257
+ <table><tr><td>Method</td><td>Accuracy</td></tr><tr><td>Final Architecture (FA)</td><td>92.17%</td></tr><tr><td>FA + Orthogonal Rotation</td><td>85.60%</td></tr><tr><td>FA -VolCNN + SphCNN</td><td>79.53%</td></tr><tr><td>FA -MaxPool+ MeanPool</td><td>87.27%</td></tr><tr><td>FA + Feature Fusion (Axial + Conv)</td><td>86.53%</td></tr><tr><td>Axial Symmetry Features</td><td>66.73%</td></tr><tr><td>VolConv Features</td><td>85.3%</td></tr><tr><td>SphConv Features</td><td>71.6%</td></tr><tr><td>FA -CapsNet +FC layers</td><td>87.3%</td></tr><tr><td>FA - CBP + Feature concat</td><td>90.7%</td></tr><tr><td>FA -CBP+MaxPool</td><td>90.3%</td></tr><tr><td>FA- CBP + Average-pooling</td><td>85.3%</td></tr></table>
258
+
259
+ Furthermore, using mean-pooling instead of maxpooling, at the decision layer drops the accuracy to $8 7 . 2 7 \%$ . We also evaluate performance of using a single capsule net. In this scenario, we combine axial symmetry features with volumetric convolution features using compact bilinear pooling (CBP), and feed it a single capsule network. This variant achieves an overall accuracy of $8 6 . 5 3 \%$ , is a $5 . 6 4 \%$ reduction in accuracy compared to the model with two capsule networks.
260
+
261
+ Moreover, we compare the performance of two feature categories—volumetric convolution features and axial symmetry features—individually. Axial symmetry features alone are able to obtain an accuracy of $6 \dot { 6 } . 7 3 \%$ , while volumetric convolution features reach a significant $8 5 . 3 \%$ accuracy. On the contrary, spherical convolution attains an accuracy of $7 1 . 6 \%$ , which again highlights the effectiveness of volumetric convolution.
262
+
263
+ ![](images/b428c5a58d17bf033834bacd444729018c86a92272c388409fcfa9bb85824a40.jpg)
264
+ Figure 4: Accuracy vs number of trainable params (in millions) trend (ModelNet40)
265
+
266
+ Then we compare between different choices that can be applied to the experimental architecture. We first replace the capsule network with a fully connected layer and achieve an accuracy of $8 7 . 3 \%$ . This is perhaps because capsules are superior to a simple fully connected layer in modeling viewpoint invariant representations. Then we try different substitutions for compact bilinear pooling and achieve $9 0 . 7 \%$ , $9 0 . 3 \%$ and $8 5 . 3 \%$ accuracies respectively for feature concatenation, max-pooling and average-pooling. This justifies the choice of compact bilinear pooling as a feature fusion tool. However, it should be noted that these choices may differ depending on the architecture.
267
+
268
+ ![](images/7f70139c47cce8111eaea8f744556de7b54eec0f0d4655b230f555de4e65c549.jpg)
269
+ Figure 5: The robustness of the proposed model against missing data. The accuracy drop is less than $3 0 \%$ at a high data loss rate of $5 0 \%$ .
270
+
271
+ ![](images/c71331e5a4d17e033c4acd5b8cccafe13611f25e436ff6fddcd6b3a76ed22cc0.jpg)
272
+ Figure 6: The mean reconstruction error $\mathrm { v } _ { \mathrm { s } } \cdot _ { n } \mathrm { \ }$ . Our Zernike frequencies computation approach has far less error than the conventional approach.
273
+
274
+ # 7.3 ROBUSTNESS AGAINST INFORMATION LOSS
275
+
276
+ One critical requirement of a 3D object classification task is to be robust against various information loss. To demonstrate the effectiveness of our proposed features in this aspect, we randomly remove data points from the objects in validation set, and evaluate model performance. The results are illustrated in Fig. 5. The model shows no performance loss until $2 0 \%$ of the data is lost, and only gradually drops to an accuracy level of 66.5 at a $5 0 \%$ data loss, which implies strong robustness against random information loss.
277
+
278
+ # 7.4 EFFECTIVENESS OF THE PROPOSED METHOD FOR CALCULATING 3D ZERNIKE MOMENTS
279
+
280
+ In Sec. 4.1, we proposed an alternative method to calculate 3D Zernike moments (Eq. 5, 6), instead of the conventional approach (Eq. 3). We hypothesized that moments obtained using the former has a closer resemblance to the original shape, due to the impact of finite number of frequency terms. In this section, we demonstrate the validity of our hypothesis through experiments. To this end, we compute moments for the shapes in the validation set of ModelNet10 using both approaches, and compare the mean reconstruction error defined as: $\begin{array} { r l } { \frac { 1 } { T } \sum _ { t } ^ { T } \bigl \| f ( t ) - \sum _ { n } \sum _ { l } \sum _ { m } \Omega _ { n , l , m } Z _ { n , l , m } ( t ) \bigr \| } & { { } } \end{array}$ , where $T$ is the total number of points and $t \in \mathbb { S } ^ { 3 }$ . Fig. 6 shows the results. In both approaches, the mean reconstruction error decreases as $n$ increases. However, our approach shows a significantly low mean reconstruction error of $0 . 0 4 6 7 \%$ at $n = 5$ compared to the conventional approach, which has a mean reconstruction error of $0 . 5 6 \%$ at same $n$ . This result also justifies the utility of Zernike moments for modeling complex 3D shapes.
281
+
282
+ # 8 CONCLUSION
283
+
284
+ In this work, we derive a novel ‘volumetric convolution’ using 3D Zernike polynomials, which can learn feature representations in $\mathbb { B } ^ { 3 }$ . We develop the underlying theoretical foundations for volumetric convolution and demonstrate how it can be efficiently computed and implemented using low-cost matrix multiplications. Furthermore, we propose a novel, fully differentiable method to measure the axial symmetry of a function in $\mathbb { B } ^ { 3 }$ around an arbitrary axis, using 3D Zernike polynomials. Finally, using these operations as building tools, we propose an experimental architecture, that gives competitive results to state-of-the-art with a relatively shallow network, in 3D object recognition task. An immediate extension to this work would be to explore weight sharing along the radius of the sphere.
285
+
286
+ # REFERENCES
287
+
288
+ Song Bai, Xiang Bai, Zhichao Zhou, Zhaoxiang Zhang, and Longin Jan Latecki. Gift: A real-time and scalable 3d shape search engine. In Computer Vision and Pattern Recognition (CVPR), 2016 IEEE Conference on, pp. 5023–5032. IEEE, 2016.
289
+
290
+ Wouter Boomsma and Jes Frellsen. Spherical convolutions and their application in molecular modelling. In Advances in Neural Information Processing Systems, pp. 3436–3446, 2017.
291
+
292
+ Andrew Brock, Theodore Lim, James M Ritchie, and Nick Weston. Generative and discriminative voxel modeling with convolutional neural networks. arXiv preprint arXiv:1608.04236, 2016.
293
+
294
+ N Canterakis. 3d zernike moments and zernike affine invariants for 3d image analysis and recognition. In In 11th Scandinavian Conf. on Image Analysis. Citeseer, 1999.
295
+
296
+ Taco S Cohen, Mario Geiger, Jonas Koehler, and Max Welling. Spherical cnns. International Conference on Learning representations (ICLR), 2018.
297
+
298
+ Yang Gao, Oscar Beijbom, Ning Zhang, and Trevor Darrell. Compact bilinear pooling. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 317–326, 2016.
299
+
300
+ Alberto Garcia-Garcia, Francisco Gomez-Donoso, Jose Garcia-Rodriguez, Sergio Orts-Escolano, Miguel Cazorla, and J Azorin-Lopez. Pointnet: A 3d convolutional neural network for real-time object class recognition. In Neural Networks (IJCNN), 2016 International Joint Conference on, pp. 1578–1584. IEEE, 2016.
301
+
302
+ 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.
303
+
304
+ Edward Johns, Stefan Leutenegger, and Andrew J Davison. Pairwise decomposition of image sequences for active multi-view recognition. In Computer Vision and Pattern Recognition (CVPR), 2016 IEEE Conference on, pp. 3813–3822. IEEE, 2016.
305
+
306
+ Asako Kanezaki, Yasuyuki Matsushita, and Yoshifumi Nishida. Rotationnet: Joint object categorization and pose estimation using multiviews from unsupervised viewpoints. arXiv preprint arXiv:1603.06208, 2016.
307
+
308
+ Roman Klokov and Victor Lempitsky. Escape from cells: Deep kd-networks for the recognition of 3d point cloud models. In 2017 IEEE International Conference on Computer Vision (ICCV), pp. 863–872. IEEE, 2017.
309
+
310
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012.
311
+
312
+ Hou-Biao Li, Ting-Zhu Huang, Yong Zhang, Xing-Ping Liu, and Tong-Xiang Gu. Chebyshev-type methods and preconditioning techniques. Applied Mathematics and Computation, 218(2):260–270, 2011.
313
+
314
+ Jiaxin Li, Ben M Chen, and Gim Hee Lee. So-net: Self-organizing network for point cloud analysis. arXiv preprint arXiv:1803.04249, 2018.
315
+
316
+ Daniel Maturana and Sebastian Scherer. Voxnet: A 3d convolutional neural network for real-time object recognition. In Intelligent Robots and Systems (IROS), 2015 IEEE/RSJ International Conference on, pp. 922–928. IEEE, 2015.
317
+
318
+ Charles R Qi, Hao Su, Matthias Nießner, Angela Dai, Mengyuan Yan, and Leonidas J Guibas. Volumetric and multi-view cnns for object classification on 3d data. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 5648–5656, 2016.
319
+
320
+ Charles R Qi, Hao Su, Kaichun Mo, and Leonidas J Guibas. Pointnet: Deep learning on point sets for 3d classification and segmentation. Proc. Computer Vision and Pattern Recognition (CVPR), IEEE, 1(2):4, 2017.
321
+
322
+ C Ronchi, R Iacono, and Pier S Paolucci. The “cubed sphere”: a new method for the solution of partial differential equations in spherical geometry. Journal of Computational Physics, 124(1): 93–114, 1996.
323
+
324
+ Sara Sabour, Nicholas Frosst, and Geoffrey E Hinton. Dynamic routing between capsules. In Advances in Neural Information Processing Systems, pp. 3859–3869, 2017.
325
+
326
+ Nima Sedaghat, Mohammadreza Zolfaghari, Ehsan Amiri, and Thomas Brox. Orientation-boosted voxel nets for 3d object recognition. arXiv preprint arXiv:1604.03351, 2016.
327
+
328
+ Baoguang Shi, Song Bai, Zhichao Zhou, and Xiang Bai. Deeppano: Deep panoramic representation for 3-d shape recognition. IEEE Signal Processing Letters, 22(12):2339–2343, 2015.
329
+
330
+ Martin Simonovsky and Nikos Komodakis. Dynamic edge-conditioned filters in convolutional neural networks on graphs. In Proc. CVPR, 2017.
331
+
332
+ Hang Su, Subhransu Maji, Evangelos Kalogerakis, and Erik Learned-Miller. Multi-view convolutional neural networks for 3d shape recognition. In Proceedings of the IEEE international conference on computer vision, pp. 945–953, 2015.
333
+
334
+ Maurice Weiler, Mario Geiger, Max Welling, Wouter Boomsma, and Taco Cohen. 3d steerable cnns: Learning rotationally equivariant features in volumetric data. arXiv preprint arXiv:1807.02547, 2018.
335
+
336
+ Jiajun Wu, Chengkai Zhang, Tianfan Xue, Bill Freeman, and Josh Tenenbaum. Learning a probabilistic latent space of object shapes via 3d generative-adversarial modeling. In Advances in Neural Information Processing Systems, pp. 82–90, 2016.
337
+
338
+ Zhirong Wu, Shuran Song, Aditya Khosla, Fisher Yu, Linguang Zhang, Xiaoou Tang, and Jianxiong Xiao. 3d shapenets: A deep representation for volumetric shapes. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1912–1920, 2015.
339
+
340
+ # Supplementary Material Volumetric Convolution: Automatic Representation Learning in Unit Ball
341
+
342
+ A CONVOLUTION WITHIN UNIT SPHERE USING 3D ZERNIKE POLYNOMIALS
343
+
344
+ Theorem 1: Suppose $f , g : X \longrightarrow \mathbb { R } ^ { 3 }$ are square integrable complex functions defined in $\mathbb { B } ^ { 3 }$ so that $\langle f , f \rangle < \infty$ and $\langle g , g \rangle < \infty$ . Further, suppose $g$ is symmetric around north pole and $\tau ( \alpha , \beta ) = R _ { y } ( \alpha ) R _ { z } ( \beta )$ where $R \in S O ( 3 )$ . Then,
345
+
346
+ $$
347
+ \int _ { 0 } ^ { 1 } \int _ { 0 } ^ { 2 \pi } \int _ { 0 } ^ { \pi } f ( \theta , \phi , r ) , \tau _ { ( \alpha , \beta ) } ( g ( \theta , \phi , r ) ) \sin \phi d \phi d \theta d r \equiv \frac { 4 \pi } { 3 } \sum _ { n = 0 } ^ { \infty } \sum _ { l = 0 } ^ { n } \sum _ { m = - l } ^ { l } \Omega _ { n , l , m } ( f ) \Omega _ { n , l , 0 } ( g ) Y _ { l , m } ( \theta , \phi , r ) ,
348
+ $$
349
+
350
+ where $\Omega _ { n , l , m } ( f ) , \Omega _ { n , l , 0 } ( g )$ and $Y _ { l , m } ( \theta , \phi )$ are $( n , l , m ) ^ { t h }$ $3 D$ Zernike moment of $f$ , $( n , l , 0 ) ^ { t h } \ 3 D$ Zernike moment of $g$ , and spherical harmonics function respectively.
351
+
352
+ Proof: Since 3D Zernike polynomials are orthogonal and complete in $\mathbb { B } ^ { 3 }$ , an arbitrary function $f ( r , \theta , \phi )$ in $\mathbb { B } ^ { 3 }$ can be approximated using Zernike polynomials as follows.
353
+
354
+ $$
355
+ f ( \theta , \phi , r ) = \sum _ { n = 0 } ^ { \infty } \sum _ { l = 0 } ^ { n } \sum _ { m = - l } ^ { l } \Omega _ { n , l , m } ( f ) Z _ { n , l , m } ( \theta , \phi , r )
356
+ $$
357
+
358
+ where $\Omega _ { n , l , m } ( f )$ could be obtained using,
359
+
360
+ $$
361
+ \Omega _ { n , l , m } ( f ) = \int _ { 0 } ^ { 1 } \int _ { 0 } ^ { 2 \pi } \int _ { 0 } ^ { \pi } f ( \theta , \phi , r ) Z _ { n , l , m } ^ { \dag } r ^ { 2 } s i n \phi d r d \phi d \theta
362
+ $$
363
+
364
+ where $^ \dagger$ denotes the complex conjugate.
365
+
366
+ Leveraging this property (Eq. 20) of 3D Zernike polynomials Eq. 4 can be rewritten as,
367
+
368
+ $$
369
+ f \ast g ( \theta , \phi ) = \langle \sum _ { n = 0 } ^ { \infty } \sum _ { l = 0 } ^ { n } \sum _ { m = - l } ^ { l } \Omega _ { n , l , m } ( f ) Z _ { n , l , m } , \tau _ { ( \theta , \phi ) } ( \sum _ { n ^ { \prime } = 0 } ^ { \infty } \sum _ { l ^ { \prime } = 0 } ^ { n ^ { \prime } } \sum _ { m ^ { \prime } = - l } ^ { l } \Omega _ { n ^ { \prime } , l ^ { \prime } , m ^ { \prime } } ( g ) Z _ { n ^ { \prime } , l ^ { \prime } , m ^ { \prime } } ) \rangle
370
+ $$
371
+
372
+ But since $g ( \theta , \phi , r )$ is symmetric around $y$ , the rotation around $y$ should not change the function. Which ensures,
373
+
374
+ $$
375
+ g ( r , \theta , \phi ) = g ( r , \theta - \alpha , \phi )
376
+ $$
377
+
378
+ and hence,
379
+
380
+ $$
381
+ \sum _ { n ^ { \prime } = 0 } ^ { \infty } \sum _ { l ^ { \prime } = 0 } ^ { n ^ { \prime } } \sum _ { m ^ { \prime } = - l } ^ { l } \Omega _ { n ^ { \prime } , l ^ { \prime } , m ^ { \prime } } ( g ) R _ { n ^ { \prime } , l ^ { \prime } } ( r ) Y _ { l ^ { \prime } , m ^ { \prime } } = \sum _ { n ^ { \prime } = 0 } ^ { \infty } \sum _ { l ^ { \prime } = 0 } ^ { n ^ { \prime } } \sum _ { m ^ { \prime } = - l } ^ { l } \Omega _ { n ^ { \prime } , l ^ { \prime } , m ^ { \prime } } ( g ) R _ { n ^ { \prime } , l ^ { \prime } } ( r ) Y _ { l ^ { \prime } , m ^ { \prime } } e ^ { - i m ^ { \prime } \alpha }
382
+ $$
383
+
384
+ This is true, if and only if $m ^ { \prime } = 0$ . Therefore, a symmetric function around $y$ , defined inside the unit sphere can be rewritten as,
385
+
386
+ $$
387
+ \sum _ { n ^ { \prime } = 0 } ^ { \infty } \sum _ { l ^ { \prime } = 0 } ^ { n ^ { \prime } } \Omega _ { n ^ { \prime } , l ^ { \prime } , 0 } ( g ) Z _ { n ^ { \prime } , l ^ { \prime } , 0 }
388
+ $$
389
+
390
+ which simplifies Eq. 22 to,
391
+
392
+ $$
393
+ f \ast g ( \theta , \phi ) = \langle \sum _ { n = 0 } ^ { \infty } \sum _ { l = 0 } ^ { n } \sum _ { m = - l } ^ { l } \Omega _ { n , l , m } ( f ) Z _ { n , l , m } , \tau _ { ( \theta , \phi ) } ( \sum _ { n ^ { \prime } = 0 } ^ { \infty } \sum _ { l ^ { \prime } = 0 } ^ { n ^ { \prime } } \Omega _ { n ^ { \prime } , l ^ { \prime } , 0 } ( g ) Z _ { n ^ { \prime } , l ^ { \prime } , 0 } ) \rangle
394
+ $$
395
+
396
+ Using the properties of inner product, Eq. 26 can be rearranged as,
397
+
398
+ $$
399
+ f \ast g ( \theta , \phi ) = \sum _ { n = 0 } ^ { \infty } \sum _ { l = 0 } ^ { n } \sum _ { n ^ { \prime } = 0 } ^ { \infty } \sum _ { l ^ { \prime } = 0 } ^ { n ^ { \prime } } \sum _ { m = - l } ^ { l } \Omega _ { n , l , m } ( f ) \Omega _ { n ^ { \prime } , l ^ { \prime } , 0 } ( g ) \langle Z _ { n , l , m } , \tau _ { ( \theta , \phi ) } ( Z _ { n ^ { \prime } , l ^ { \prime } , 0 } ) \rangle
400
+ $$
401
+
402
+ Consider the term $\tau _ { ( \theta , \phi ) } \mathopen { } \mathclose \bgroup \left( Z _ { n ^ { \prime } , l ^ { \prime } , 0 } \aftergroup \egroup \right)$ . Then,
403
+
404
+ $$
405
+ \tau _ { ( \theta , \phi ) } ( Z _ { n ^ { \prime } , l ^ { \prime } , 0 } ) = \tau _ { ( \theta , \phi ) } ( R _ { n ^ { \prime } , l ^ { \prime } } Y _ { l ^ { \prime } , 0 } ) = R _ { n ^ { \prime } , l ^ { \prime } } \tau _ { ( \theta , \phi ) } ( Y _ { l ^ { \prime } , 0 } ) = R _ { n ^ { \prime } , l ^ { \prime } } \sum _ { m ^ { \prime \prime } = - l ^ { \prime } } ^ { l ^ { \prime } } Y _ { l ^ { \prime } , m ^ { \prime \prime } } D _ { m ^ { \prime \prime } , 0 } ^ { l ^ { \prime } } ( \theta , \phi )
406
+ $$
407
+
408
+ where $D _ { m , m ^ { \prime } } ^ { l }$ is the Wigner-D matrix. But we know that $D _ { m ^ { \prime \prime } , 0 } ^ { l ^ { \prime } } ( \theta , \phi ) = Y _ { l ^ { \prime } , m ^ { \prime \prime } } ( \theta , \phi )$ . Then Eq. 27 becomes,
409
+
410
+ $$
411
+ f \ast g ( \theta , \phi ) = \sum _ { n = 0 } ^ { \infty } \sum _ { l = 0 } ^ { n } \sum _ { n ^ { \prime } = 0 } ^ { \infty } \sum _ { l ^ { \prime } = 0 } ^ { n ^ { \prime } } \sum _ { m = - l } ^ { l } \Omega _ { n , l , m } ( f ) \Omega _ { n ^ { \prime } , l ^ { \prime } , 0 } ( g ) \sum _ { m ^ { \prime \prime } = - l ^ { \prime } } ^ { l ^ { \prime } } Y _ { l ^ { \prime } , m ^ { \prime \prime } } ( \theta , \phi ) \langle Z _ { n , l , m } , Z _ { n ^ { \prime } , l ^ { \prime } , m ^ { \prime \prime } } \rangle
412
+ $$
413
+
414
+ $$
415
+ f \ast g ( \theta , \phi ) = \frac { 4 \pi } { 3 } \sum _ { n = 0 } ^ { \infty } \sum _ { l = 0 } ^ { n } \sum _ { m = - l } ^ { l } \Omega _ { n , l , m } ( f ) \Omega _ { n , l , 0 } ( g ) Y _ { l , m } ( \theta , \phi )
416
+ $$
417
+
418
+ # B EQUIVARIANCE OF VOLUMETRIC CONVOLUTION TO 3D ROTATION GROUP
419
+
420
+ Theorem 1: Suppose $f , g : X \longrightarrow \mathbb { R } ^ { 3 }$ are square integrable complex functions defined in $\mathbb { B } ^ { 3 }$ so that $\langle f , f \rangle < \infty$ and $\langle g , g \rangle < \infty .$ . Also, let $\eta _ { \alpha , \beta , \gamma }$ be a $3 D$ rotation operator that can be decomposed into three Eular rotations $R _ { y } ( \alpha ) R _ { z } ( \beta ) R _ { y } ( \gamma )$ and $\tau _ { \alpha , \beta }$ another rotation operator that can be decomposed into $R _ { y } ( \alpha ) R _ { z } ( \beta )$ . Suppose $\eta _ { \alpha , \beta , \gamma } ( g ) = \tau _ { \alpha , \beta } ( g )$ . Then,
421
+
422
+ $$
423
+ \eta _ { ( \alpha , \beta , \gamma ) } ( f ) \ast g ( \theta , \phi ) = \tau _ { ( \alpha , \beta ) } ( f \ast g ) ( \theta , \phi )
424
+ $$
425
+
426
+ where $^ *$ is the volumetric convolution operator.
427
+
428
+ Proof: Since $\eta _ { ( \alpha , \beta , \gamma ) } \in S O ( 3 )$ , we know that $\eta _ { ( \alpha , \beta , \gamma ) } ( f ( x ) ) = f ( \eta _ { ( \alpha , \beta , \gamma ) } ^ { - 1 } ( x ) )$ . Also we know that $\eta _ { ( \alpha , \beta , \gamma ) } : \mathrm { R } ^ { 3 } \mathrm { R } ^ { 3 }$ is an isometry.
429
+
430
+ Define,
431
+
432
+ $$
433
+ \langle \eta _ { ( \alpha , \beta , \gamma ) } f , \eta _ { ( \alpha , \beta , \gamma ) } g \rangle = \int _ { S ^ { 3 } } f ( \eta _ { ( \alpha , \beta , \gamma ) } ^ { - 1 } ( x ) ) g ( \eta _ { ( \alpha , \beta , \gamma ) } ^ { - 1 } ( x ) ) d x
434
+ $$
435
+
436
+ Consider the Lebesgue measure $\textstyle \lambda ( S ^ { 3 } ) = \int _ { S ^ { 3 } } d x$ . It can be proven that a lebesgue measure invariant under the isometries, which gives us $d x = \breve { d } \eta _ { ( \alpha , \beta , \gamma ) } ( x ) = d \eta _ { ( \alpha , \beta , \gamma ) } ^ { - 1 } ( x ) , \forall x \in S ^ { 3 }$ . Therefore,
437
+
438
+ $$
439
+ < \eta _ { ( \alpha , \beta , \gamma ) } f , \eta _ { ( \alpha , \beta , \gamma ) } g > = \int _ { S ^ { 3 } } f ( \eta _ { ( \alpha , \beta , \gamma ) } ^ { - 1 } ( x ) ) g ( \eta _ { ( \alpha , \beta , \gamma ) } ^ { - 1 } ( x ) ) d ( \eta _ { ( \alpha , \beta , \gamma ) } ^ { - 1 } x ) = < f , g >
440
+ $$
441
+
442
+ Let $f ( \theta , \phi , r )$ and $g ( \theta , \phi , r )$ be the object function and kernel function (symmetric around north pole) respectively. Then volumetric convolution is defined as,
443
+
444
+ $$
445
+ f * g ( \theta , \phi ) = < f , \tau _ { ( \theta , \phi ) } g >
446
+ $$
447
+
448
+ Applying the rotation $\eta _ { ( \alpha , \beta , \gamma ) }$ to $f$ , we get,
449
+
450
+ $$
451
+ \eta _ { ( \alpha , \beta , \gamma ) } ( f ) \ast g ( \theta , \phi ) = < \eta _ { ( \alpha , \beta , \gamma ) } ( f ) , \tau _ { ( \theta , \phi ) } g >
452
+ $$
453
+
454
+ By the result 33, we have,
455
+
456
+ $$
457
+ \eta _ { ( \alpha , \beta , \gamma ) } ( f ) \ast g ( \theta , \phi ) = < f , \eta _ { ( \alpha , \beta , \gamma ) } ^ { - 1 } ( \tau _ { ( \theta , \phi ) } g ) >
458
+ $$
459
+
460
+ However, since $\eta _ { \alpha , \beta , \gamma } ( g ) = \tau _ { \alpha , \beta } ( g )$ we get,
461
+
462
+ $$
463
+ \eta _ { ( \alpha , \beta , \gamma ) } ( f ) \ast g ( \theta , \phi ) = < f , \tau _ { ( \theta - \alpha , \phi - \beta , ) } g >
464
+ $$
465
+
466
+ We know that,
467
+
468
+ $$
469
+ f \ast g ( \theta , \phi ) = < f , \tau _ { ( \theta , \phi ) } g > = \sum _ { n = 0 } ^ { \infty } \sum _ { l = 0 } ^ { n } \sum _ { m = - l } ^ { l } \Omega _ { n , l , m } ( f ) \Omega _ { n , l , 0 } ( g ) Y _ { l , m } ( \theta , \phi )
470
+ $$
471
+
472
+ Then,
473
+
474
+ $$
475
+ \iota _ { ( \alpha , \beta , \gamma ) } ( f ) \ast g ( \theta , \phi ) = < f , \tau _ { ( \theta - \alpha , \phi - \beta ) } g > = \sum _ { n = 0 } ^ { \infty } \sum _ { l = 0 } ^ { n } \sum _ { m = - l } ^ { l } \Omega _ { n , l , m } ( f ) \Omega _ { n , l , 0 } ( g ) Y _ { l , m } ( \theta - \alpha , \phi - \beta )
476
+ $$
477
+
478
+ $$
479
+ \eta _ { ( \alpha , \beta , \gamma ) } ( f ) \ast g ( \theta , \phi ) = ( f \ast g ) ( \theta - \alpha , \phi - \beta )
480
+ $$
481
+
482
+ $$
483
+ \eta _ { ( \alpha , \beta , \gamma ) } ( f ) \ast g ( \theta , \phi ) = \tau _ { ( \alpha , \beta ) } ( f \ast g )
484
+ $$
485
+
486
+ Hence, we achieve equivariance over 3D rotations.
487
+
488
+ C AXIAL SYMMETRY MEASURE OF A FUNCTION IN $\mathbb { B } ^ { 3 }$ AROUND AN ARBITRARY AXIS.
489
+
490
+ Proposition: Suppose $g : X \longrightarrow \mathbb { R } ^ { 3 }$ is a square integrable complex function defined in $\mathbb { B } ^ { 3 }$ such that $\langle g , g \rangle < \infty$ . Then, the power of projection of $g$ in to $S = \{ Z _ { i } \}$ where $S$ is the set of Zernike basis functions that are symmetric around an axis towards $( \alpha , \beta )$ direction is given by,
491
+
492
+ $$
493
+ | | s y m _ { ( \alpha , \beta ) } | | = \sum _ { n } \sum _ { l = 0 } ^ { n } | | \sum _ { m = - l } ^ { l } \Omega _ { n , l , m } Y _ { m , l } ( \alpha , \beta ) | | ^ { 2 }
494
+ $$
495
+
496
+ where $\alpha$ and $\beta$ are azimuth and polar angles respectively.
497
+
498
+ Proof: The subset of complex functions which are symmetric around north pole is $S = \{ Z _ { n , l , 0 } \}$ . Therefore, projection of a function into $S$ gives,
499
+
500
+ $$
501
+ s y m _ { y } ( \theta , \phi ) = \sum _ { n } \sum _ { l = 0 } ^ { n } \langle f , Z _ { n , l , 0 } \rangle z _ { n , l , 0 } ( \theta , \phi )
502
+ $$
503
+
504
+ To obtain the symmetry function around any axis which is defined by $( \alpha , \beta )$ , we rotate the function by $( - \alpha , - \beta )$ , project into $S$ , and final compute the power of the projection.
505
+
506
+ $$
507
+ s y m _ { ( \alpha , \beta ) } ( \theta , \phi ) = \sum _ { n , l } \langle \tau _ { ( - \alpha , - \beta ) } ( f ) , Z _ { n , l , 0 } \rangle z _ { n , l , 0 } ( \theta , \phi )
508
+ $$
509
+
510
+ For any rotation operator $U$ , and for any two points defined on a complex Hilbert space, $x$ and $y$
511
+
512
+ $$
513
+ \langle U ( x ) , U ( y ) \rangle _ { \cal { H } } = \langle x , y \rangle _ { \cal { H } }
514
+ $$
515
+
516
+ Applying this property to 44 gives,
517
+
518
+ $$
519
+ s y m _ { ( \alpha , \beta ) } ( \theta , \phi ) = \sum _ { n , l } \langle f , \tau _ { ( \alpha , \beta ) } ( Z _ { n , l , 0 } ) \rangle z _ { n , l , 0 } ( \theta , \phi )
520
+ $$
521
+
522
+ Using Eq. 20 we get,
523
+
524
+ $$
525
+ s y m _ { ( \alpha , \beta ) } ( \theta , \phi ) = \sum _ { n } \sum _ { l = 0 } ^ { n } \langle \sum _ { n ^ { \prime } } \sum _ { l ^ { \prime } = 0 } ^ { n ^ { \prime } } \sum _ { m ^ { \prime } = - l ^ { \prime } } ^ { l ^ { \prime } } \Omega _ { n ^ { \prime } l ^ { \prime } m ^ { \prime } } Z _ { n ^ { \prime } , l ^ { \prime } , m ^ { \prime } } , \tau _ { ( \alpha , \beta ) } ( Z _ { n , l , 0 ) } \rangle z _ { n , l , 0 } ( \theta , \phi )
526
+ $$
527
+
528
+ Using properties of inner product Eq. 47 further simplifies to,
529
+
530
+ $$
531
+ s y m _ { ( \alpha , \beta ) } ( \theta , \phi ) = \sum _ { n } \sum _ { l = 0 } ^ { n } \sum _ { n ^ { \prime } } \sum _ { l ^ { \prime } = 0 } ^ { n ^ { \prime } } \sum _ { m ^ { \prime } = - l ^ { \prime } } ^ { l ^ { \prime } } \Omega _ { n ^ { \prime } l ^ { \prime } m ^ { \prime } } \langle Z _ { n ^ { \prime } , l ^ { \prime } , m ^ { \prime } } , \tau _ { ( \alpha , \beta ) } ( Z _ { n , l , 0 ) } \rangle z _ { n , l , 0 } ( \theta , \phi )
532
+ $$
533
+
534
+ Using the same derivation as in 28,
535
+
536
+ $$
537
+ \cdot y m _ { ( \alpha , \beta ) } ( \theta , \phi ) = \sum _ { n } \sum _ { l = 0 } ^ { n } \sum _ { n ^ { \prime } } \sum _ { \nu ^ { \prime } = 0 } ^ { n ^ { \prime } } \sum _ { m ^ { \prime } = - l ^ { \prime } } ^ { l ^ { \prime } } \Omega _ { n ^ { \prime } l ^ { \prime } m ^ { \prime } } \sum _ { m ^ { \prime \prime } = - l } ^ { l } Y _ { l , m ^ { \prime \prime } } ( \alpha , \beta ) < Z _ { n ^ { \prime } , l ^ { \prime } , m ^ { \prime } } , Z _ { n , l , m ^ { \prime \prime } } > z _ { n , l , 0 } ( \theta , \beta )
538
+ $$
539
+
540
+ Since 3D Zernike Polynomials are orthogonal we get,
541
+
542
+ $$
543
+ s y m _ { ( \alpha , \beta ) } ( \theta , \phi ) = \frac { 4 \pi } { 3 } \sum _ { n } \sum _ { l = 0 } ^ { n } \sum _ { m = - l } ^ { l } \Omega _ { n , l , m } Y _ { m , l } ( \alpha , \beta ) z _ { n , l , 0 } ( \theta , \phi )
544
+ $$
545
+
546
+ In signal theory the power of a function is taken as the integral of the squared function divided by the size of its domain. Following this we get,
547
+
548
+ $$
549
+ | s y m _ { ( \alpha , \beta ) } | | = \langle ( \sum _ { n } \sum _ { l = 0 } ^ { n } \sum _ { m = - l } ^ { l } \Omega _ { n , l , m } Y _ { m , l } ( \alpha , \beta ) ) z _ { n , l , 0 } ( \theta , \phi ) , ( \sum _ { n ^ { \prime } } \sum _ { \nu = 0 } ^ { n ^ { \prime } } \sum _ { m ^ { \prime } = - l ^ { \prime } } ^ { l ^ { \prime } } \Omega _ { n ^ { \prime } , l ^ { \prime } , m ^ { \prime } } Y _ { m ^ { \prime } , l ^ { \prime } } ( \alpha , \beta ) z _ { n ^ { \prime } , l ^ { \prime } } ( \theta , \alpha ) ) | | \alpha \rangle
550
+ $$
551
+
552
+ We drop the constants here since they do not depend on the frequency. Simplifying Eq. 51 gives,
553
+
554
+ $$
555
+ | | s y m _ { ( \alpha , \beta ) } | | = \sum _ { n } \sum _ { l = 0 } ^ { n } \sum _ { m = - l } ^ { l } \sum _ { m ^ { \prime } = - l } ^ { l } \Omega _ { n , l , m } Y _ { m , l } ( \alpha , \beta ) \Omega _ { n , l , m ^ { \prime } } Y _ { m ^ { \prime } , l } ( \alpha , \beta )
556
+ $$
557
+
558
+ which leads to,
559
+
560
+ $$
561
+ | | s y m _ { ( \alpha , \beta ) } | | = \sum _ { n } \sum _ { l = 0 } ^ { n } | | \sum _ { m = - l } ^ { l } \Omega _ { n , l , m } Y _ { m , l } ( \alpha , \beta ) | | ^ { 2 }
562
+ $$
563
+
564
+ # D FUNCTION DEFINITIONS
565
+
566
+ # D.1 SPHERICAL HARMONICS
567
+
568
+ Spherical harmonics are a set of complete orthogonal functions, which are defined on $\mathbb { S } ^ { 2 }$ .
569
+
570
+ $$
571
+ Y _ { l , m } ( \theta , \phi ) = ( - 1 ) ^ { m } { \sqrt { \frac { 2 l + 1 } { 4 \pi } \frac { ( l - m ) ! } { ( l + m ) ! } } } P _ { l } ^ { m } ( c o s \phi ) e ^ { i m \theta }
572
+ $$
573
+
574
+ where $l$ is an integer, $m$ is an integer, $| m | < l$ , and $P _ { l } ^ { m } ( \cdot )$ is the associated Legendre function (see appendix D.2).
575
+
576
+ # D.2 ASSOCIATED LEGENDRE FUNCTION
577
+
578
+ Associated Legendre function $P _ { l } ^ { m } ( x )$ is defined as,
579
+
580
+ $$
581
+ P _ { l } ^ { m } ( x ) = ( - 1 ) ^ { m } \frac { ( 1 - x ^ { 2 } ) ^ { m / 2 } } { 2 ^ { l } l ! } \frac { d ^ { l + m } } { d x ^ { l + m } } ( x ^ { 2 } - 1 ) ^ { l }
582
+ $$
583
+
584
+ where $l$ is an integer, $m$ is an integer, $| m | < l$ , and $x$ is a real number.
585
+
586
+ D.3 ZERNIKE RADIAL POLYNOMIAL
587
+
588
+ $$
589
+ R _ { n , m } ( r ) = \sum _ { k = 0 } ^ { ( n - m ) / 2 } \frac { ( - 1 ) ^ { k } ( n - k ) ! } { k ! ( ( n + m ) / 2 - k ) ! ( ( n - m ) / 2 - k ) ! } r ^ { n - 2 k }
590
+ $$
591
+
592
+ # E SPHERICAL CONVOLUTION ON $\mathbb { S } ^ { 2 }$
593
+
594
+ Let the $f$ and $g$ be the shape functions of the object and kernel respectively. Then $f$ and $g$ can be expressed as,
595
+
596
+ $$
597
+ f ( \theta , \phi ) = \sum _ { l } \sum _ { m = - l } ^ { l } \hat { f } ( l , m ) Y _ { l , m } ( \theta , \phi ) \quad \mathrm { a n d } , \quad g ( \theta , \phi ) = \sum _ { l } \sum _ { m = - l } ^ { l } \hat { g } ( l , m ) Y _ { l , m } ( \theta , \phi )
598
+ $$
599
+
600
+ where $Y _ { l , m }$ is the $( l , m ) ^ { t h }$ spherical harmonics function and ${ \hat { f } } ( l , m )$ and ${ \hat { g } } ( l , m )$ are $( l , m ) ^ { t h }$ frequency components of $f$ and $g$ respectively. Then the frequency components of convolution $f * g$ can be easily calculated as,
601
+
602
+ $$
603
+ \widehat { f * g } ( l , m ) = \sqrt { \frac { 4 \pi } { 2 l + 1 } } \hat { f } ( l , m ) \hat { g } ( l , 0 ) ^ { \dagger }
604
+ $$
605
+
606
+ where † denotes the complex conjugate.
607
+
608
+ F ROTATION PARAMETERS
609
+
610
+ Table 3: Average rotation parameter values across classes of ModelNet10. The values are reformatted to be positive angles between 0 and 360.
611
+
612
+ <table><tr><td>Class</td><td>r1</td><td>r2</td><td>r3</td><td>r4</td><td>r5</td><td>r6</td><td>r7</td><td>r8</td><td>r9</td></tr><tr><td>Bathtub Bathtub</td><td>319.2</td><td>100.5</td><td>57.8</td><td>185.2</td><td>223.4</td><td>98.3</td><td>350.6</td><td>167.4</td><td>14.2</td></tr><tr><td>Bed</td><td>264.3</td><td>196.3</td><td>103.7</td><td>208.5</td><td>186.2</td><td>194.4</td><td>267.9</td><td>246.3</td><td>81.2</td></tr><tr><td>Chair</td><td>198.6</td><td>91.2</td><td>243.7</td><td>47.4</td><td>161.2</td><td>87.9</td><td>240.5</td><td>47.3</td><td>203.4</td></tr><tr><td>Desk</td><td>88.4</td><td>80.2</td><td>130.9</td><td>206.6</td><td>86.5</td><td>112.8</td><td>291.7</td><td>233.2</td><td>351.4</td></tr><tr><td>Dresser</td><td>58.0</td><td>145.7</td><td>353.1</td><td>148.4</td><td>346.4</td><td>125.3</td><td>47.0</td><td>2.2</td><td>35.4</td></tr><tr><td>Monitor</td><td>218.9</td><td>279.0</td><td>58.1</td><td>10.4</td><td>30.3</td><td>331.4</td><td>90.7</td><td>285.6</td><td>346.1</td></tr><tr><td>Night stand</td><td>85.3</td><td>336.1</td><td>175.9</td><td>246.4</td><td>169.4</td><td>278.7</td><td>317.0</td><td>137.6</td><td>302.9</td></tr><tr><td>Sofa</td><td>306.1</td><td>86.9</td><td>109.2</td><td>311.1</td><td>22.5</td><td>321.4</td><td>96.9</td><td>47.0</td><td>76.2</td></tr><tr><td>Table</td><td>299.8</td><td>85.2</td><td>126.5</td><td>215.1</td><td>221.9</td><td>245.5</td><td>237.1</td><td>50.6</td><td>128.4</td></tr><tr><td>Toilet</td><td>277.0</td><td>325.3</td><td>215.5</td><td>255.6</td><td>192.2</td><td>19.8</td><td>278.4</td><td>193.4</td><td>348.2</td></tr><tr><td>Average</td><td>211.6</td><td>172.6</td><td>157.4</td><td>183.4</td><td>164.1</td><td>182.4</td><td>221.8</td><td>141.1</td><td>189.7</td></tr></table>
md/train/Skgvy64tvr/Skgvy64tvr.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/UEtNMTl6yN/UEtNMTl6yN.md ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NEURAL POOLING FOR GRAPH NEURAL NETWORKS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Tasks such as graph classification, require graph pooling to learn graph-level representations from constituent node representations. In this work, we propose two novel methods using fully connected neural network layers for graph pooling, namely Neural Pooling Method 1 and 2. Our proposed methods have the ability to handle variable number of nodes in different graphs, and are also invariant to the isomorphic structures of graphs. In addition, compared to existing graph pooling methods, our proposed methods are able to capture information from all nodes, collect second-order statistics, and leverage the ability of neural networks to learn relationships among node representations, making them more powerful. We perform experiments on graph classification tasks in the bio-informatics and social network domains to determine the effectiveness of our proposed methods. Experimental results show that our methods lead to an absolute increase of upto $1 . 2 \%$ in classification accuracy over previous works and a general decrease in standard deviation across multiple runs indicating greater reliability. Experimental results also indicate that this improvement in performance is consistent across several datasets.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Over the past several years, there is a growing number of applications where data is generated from non-Euclidean domains and is represented as graphs with complex relationships and interdependency between entities. Deep learning generalised from grid-like data to the graph domain has led to the development of the remarkably successful Graph Neural Networks (GNNs) (Fan et al., 2019; Gao et al., 2019; Ma et al., $2 0 1 9 \mathrm { a }$ ; Wang et al., 2019b) and its numerous variants such the Graph Convolutional Network (GCN) (Kipf & Welling, 2017), GraphSAGE (Hamilton et al., 2017), graph attention network (GAT) (Velickovi ˇ c et al., 2018), jumping knowledge network (JK) (Xu et al., ´ 2018), and graph isomorphism networks (GINs) (Xu et al., 2019), etc.
12
+
13
+ Pooling is a common operation in deep learning on grid-like data, such as images. Pooling layers provide an approach to down sampling feature maps by summarizing the presence of features in patches of the feature map. It reduces dimensionality and also provides local translational invariance. In the case of graph data, pooling is used to obtain a representation of a graph using its constituent node representations. However, it is challenging to develop graph pooling methods due to the some special properties of graph data such as the variable number of nodes in different graphs and the isomorphic structures of graphs. Firstly, the number of nodes varies in different graphs, while the graph representations are usually required to have the same fixed size to fit into other downstream machine learning models where they are used for tasks such as classification. Therefore, graph pooling should be capable of handling the variable number of node representations as inputs and producing fixed-sized graph representations. Secondly, unlike images and texts where we can order pixels and words according to the spatial structural information, there is no inherent ordering relationship among nodes in graphs. Therefore, isomorphic graphs should have the same graph representation, and hence, graph pooling should give the same output by taking node representations in any order as inputs.
14
+
15
+ Our main contributions in this work are two novel graph pooling methods, Neural Pooling Method 1 and 2. These new pooling methods allow us to do the following,i) produce the same dimensional graph representation for graphs with variable number of nodes, ii) remain invariant to the isomorphic structures of graphs, iii) collect second- order statistics, iv) leverage trainable parameters in the form of fully connected neural networks to learn relationships between underlying node representations to generate high quality graph representations which are then used for graph classification tasks.
16
+
17
+ Experiments are performed on four benchmark bio-informatics datasets and five popular social network datasets to demonstrate the effectiveness and superiority of our proposed graph pooling methods. Experimental results show that our methods lead to an improvement in classification accuracy over existing methods and are also more reliable as compared to previous works.
18
+
19
+ # 2 RELATED WORK
20
+
21
+ # 2.1 GRAPH NEURAL NETWORKS
22
+
23
+ A graph can be represented by its adjacency matrix and node features. Formally, for a graph $\mathcal { G }$ consisting of $n$ nodes, its topology information can be represented by an adjacency matrix ${ \pmb A } \in$ $\{ 0 , 1 \} ^ { n \times n }$ and the node features can be represented as $\dot { \boldsymbol { X } } \in \mathbb { R } ^ { n \times d }$ , assuming each node has a d-dimensional feature vector. GNNs learn feature representations for different nodes using these matrices (Gilmer et al., 2017). Several approaches are proposed to investigate deep GNNs, and they generally follow a neighborhood information aggregation scheme (Gilmer et al., 2017; Xu et al., 2019; Kipf & Welling, 2017; Hamilton et al., 2017; Velickovi ˇ c et al., 2018). In each step, ´ the representation of a node is updated by aggregating the representations of its neighbors. Graph Convolutional Networks (GCNs) are popular variants of GNNs and inspired by the first order graph Laplacian methods (Kipf & Welling, 2017). Graph pooling is used to connect embedded graphs outputted by GNN layers with classifiers for graph classification. Given a graph, GNN layers produce node representations, where each node is embedded as a vector. Graph pooling is applied after GNN layers to process node representations into a single feature vector as the graph representation. A classifier takes the graph representation and performs graph classification.
24
+
25
+ # 2.2 GRAPH POOLING
26
+
27
+ Early studies employ simple methods such as averaging and summation as graph pooling (Xu et al., 2019; Duvenaud et al., 2015; Defferrard et al., 2016). However, averaging and summation do not capture the feature correlation information, curtailing the overall model performance (Zhang et al., 2018). Other studies have proposed advanced graph pooling methods, including DIFFPOOL (Ying et al., 2018), SORT-POOL (Zhang et al., 2018), TOPKPOOL (Gao & Ji, 2019), SAGPOOL (Lee et al., 2019), and EIGENPOOL (Ma et al., 2019b), and achieve great performance on multiple benchmark datasets. EIGENPOOL involves the computation of eigenvectors, which is slow and expensive. DIFFPOOL (Ying et al., 2018) treats the graph pooling as a node clustering problem. A cluster of nodes from the original graph are merged to form a new node in the new graph. DIFFPOOL (Ying et al., 2018) proposes to perform the graph convolution operation on node features to obtain node clustering assignment matrix. Intuitively, the class assignment of a given node should depend on the class assignments of other neighbouring nodes. However, DIFFPOOL does not explicitly consider high-order structural relationships, which we that are important for graph pooling. SORTPOOL (Zhang et al., 2018), TOPKPOOL (Gao & Ji, 2019), and SAGPOOL (Lee et al., 2019) learn to select important nodes from the original graph and use these nodes to build a new graph. They share the similar idea to learn a sorting vector based on node representations, which indicates the importance of different nodes. Then only the top $\mathrm { k }$ important nodes are selected to form a new graph while the other nodes are ignored. However, the ignored nodes may contain important features and this information is lost during pooling. It is worth noting that all the graph pooling methods mentioned till now only collect first-order statistics (Boureau et al., 2010). A recent study has proposed second order graph pooling methods $S O P o o l _ { b i m a p }$ and $S O P o o l _ { a t t e n t i o n }$ (Wang & Ji, 2020). In this work, we propose two novel methods using fully connected neural network layers for graph pooling, namely Neural Pooling Method 1 and 2. Compared to existing graph pooling methods, our proposed methods are able to capture information from all nodes, collect second-order statistics, and leverage the ability of neural networks to learn relationships among node representations, making them more powerful.
28
+
29
+ # 3 METHODOLOGY
30
+
31
+ # 3.1 PROPERTIES OF GRAPH POOLING
32
+
33
+ Consider a graph $\mathcal { G } = ( A , X )$ represented by its adjacency matrix $\pmb { A } \in \{ 0 , 1 \} ^ { n \times n }$ and node feature matrix $\ b { X } \in \mathbb { R } ^ { n \times d }$ , where $n$ is the number of nodes in $\mathcal { G }$ and $d$ is the dimension of node features. The node features may come from node labels or node degrees. Graph neural networks are known to be powerful in learning good node representation matrix $\pmb { H }$ from $\pmb { A }$ and $\boldsymbol { X }$ :
34
+
35
+ $$
36
+ \pmb { H } = [ h _ { 1 } , h _ { 2 } , . . . . . . . . . , h _ { n } ] ^ { T } = \mathbf { G } \mathbf { N } \mathbf { N } ( \pmb { A } , \pmb { X } ) \in \mathbb { R } ^ { n \times \textit { f } }
37
+ $$
38
+
39
+ where rows of $H , h _ { i } \in \mathbb { R } ^ { f } , i = 1 , 2 , . . . , n$ , are representations of $n$ nodes, and $f$ is the dimension of the node representation obtained from the GNN and depends on the architecture of the GNN. The task that we focus on in this work is to obtain a graph representation vector $_ { h _ { G } }$ from $\pmb { H }$ , which is then fed into a classifier to perform graph classification:
40
+
41
+ $$
42
+ h _ { G } = \operatorname { g } ( [ A ] , H ) \in \mathbb { R } ^ { c }
43
+ $$
44
+
45
+ where $\mathrm { g } ( \cdot )$ is the graph pooling function and $c$ is the dimension of $_ { h _ { G } }$ . Here, $[ A ]$ means that the information from $\pmb { A }$ can be optionally used in graph pooling. For simplicity, we omit it in the following discussion.
46
+
47
+ Note that the function $\mathrm { g } ( \cdot )$ must satisfy two requirements to serve as graph pooling. First, $\mathrm { g } ( \cdot )$ should be able to take $\pmb { H }$ with variable number of rows as the inputs and produce fixed-sized outputs. Specifically, different graphs may have different number of nodes, which means that $n$ is a variable. On the other hand, $c$ , which is the dimension of the graph representation $_ { h _ { G } }$ is supposed to be fixed to fit into the classifier. Second, $\mathrm { g } ( \cdot )$ should output the same $_ { h _ { G } }$ when the order of rows of $\pmb { H }$ changes. This permutation invariance property is necessary to handle isomorphic graphs. To be concrete, if two graph $\mathcal { G } _ { 1 } = ( A _ { 1 } , X _ { 1 } )$ and $\mathcal { G } _ { 2 } = ( A _ { 2 } , X _ { 2 } )$ are isomorphic, GNNs will output the same multi set of node representations. That is, there exists a permutation matrix $P \in \{ 0 , \bar { 1 } \bar \} ^ { n \times n }$ such that $H _ { 1 } = P H _ { 2 }$ , for $\pmb { H } _ { 1 } = \mathbf { G } \mathbf { N } \mathbf { N } ( \pmb { A } _ { 1 } , \pmb { X } _ { 1 } )$ and $H _ { 2 } = \mathrm { G N N } ( A _ { 2 } , X _ { 2 } )$ . However, the graph representation computed by $\mathrm { g } ( \cdot )$ should be the same, i.e., $\begin{array} { r } { \mathrm { g } ( \pmb { H } _ { 1 } ) = \mathrm { g } ( \pmb { H } _ { 2 } ) } \end{array}$ if ${ \cal H } _ { 1 } = { \cal P } { \cal H } _ { 2 }$ .
48
+
49
+ # 3.2 NEURAL POOLING METHOD 1
50
+
51
+ Our first proposed method is called Neural Pooling Method 1. Consider a node representation matrix $\pmb { H }$ obtained following Equation 1 in Section 3.1.
52
+
53
+ ![](images/4a464ce1dec9d058abdf8c5f8e85f74243f223cbe400ccb32842325b50311b2a.jpg)
54
+ Figure 1: Illustration of our proposed Neural Pooling Method 1. This is an example for a graph $\mathcal { G }$ with 8 nodes. GNNs can learn representations for each node and graph pooling processes node representations into a graph representation vector.
55
+
56
+ $\pmb { H }$ is passed through a Fully Connected Neural Network Layer $( F C L ^ { 1 } )$ to obtain $H ^ { \prime }$ as:
57
+
58
+ $$
59
+ \pmb { H } ^ { \prime } = F C L ^ { 1 } ( \pmb { H } ) \in \mathbb { R } ^ { n \times \textit { f } ^ { \prime } } \mathrm { \bf ~ w h e r e ~ } f ^ { \prime } < f
60
+ $$
61
+
62
+ After this $H ^ { \prime }$ is again passed through a second Fully Connected Neural Network Layer $( F C L ^ { 2 } )$ to obtain $Q$ as:
63
+
64
+ $$
65
+ Q = F C L ^ { 2 } ( H ^ { \prime } ) \in \mathbb { R } ^ { n \times 1 }
66
+ $$
67
+
68
+ Finally the graph representation $h _ { G }$ is obtained as:
69
+
70
+ $$
71
+ \pmb { h } _ { G } = \pmb { H } ^ { \prime T } \pmb { Q } \in \mathbb { R } ^ { f ^ { \prime } \times 1 }
72
+ $$
73
+
74
+ where $H ^ { \prime T }$ denotes the transpose of $H ^ { \prime }$ .
75
+
76
+ Neural Pooling Method 1 always outputs an $f ^ { \prime }$ -dimensional graph representation for $\ b { H } \in \mathbb { R } ^ { n \times f }$ , regardless of the value of $\mathbf { n }$ . It is also invariant to permutation so that it outputs the same graph representation, even when the order of rows of $\pmb { H }$ changes.
77
+
78
+ Intuition: The $F C L ^ { 1 }$ performs the role of reducing the dimensionality of the input node representations. The trainable parameters of this $F C L ^ { 1 }$ can be thought of as learning a mapping from the $f$ to the $f ^ { \prime }$ -dimensional space. The $F C L ^ { 2 }$ reduces the $f ^ { \prime }$ -dimensional node representations to a 1 dimensional representation, $Q$ . $\pmb { H } ^ { \prime } \in \mathbb { R } ^ { n \times \ f ^ { \prime } }$ can be viewed as $H ^ { \prime } = [ l _ { 1 } , l _ { 2 } , \ldots \ldots , l _ { f ^ { \prime } } ] .$ , where $l _ { j }$ $\in \mathbb { R } ^ { n }$ , $j { = } 1 , 2 , . . . , f ^ { \prime }$ . The vector $l _ { j }$ encodes the spatial distribution of the $j$ -th feature in the graph. Based on this view, $H ^ { \prime T } \pmb { Q }$ is able to capture the topology information and $Q$ can be thought of as roughly encoding the position of nodes by learning the weights according to which the $j$ -th feature is aggregated across the nodes.
79
+
80
+ Neural Pooling Method 1 hence, leverages the ability of neural networks to learn the topological structure as well as correlation among the node representations in $\pmb { H }$ . It captures the essential features and connections between underlying data. It also reduces the dimensionality of $\pmb { H }$ , and results in an accurate representation of the input graph.
81
+
82
+ # 3.3 NEURAL POOLING METHOD 2
83
+
84
+ Our second proposed method is called Neural Pooling Method 2. Consider a node representation matrix $\pmb { H }$ obtained following Equation 1 in Section 3.1.
85
+
86
+ ![](images/550267784e0cc753e84314e02422fdc4a7e97d7ea04f2d5dfefc8ec628a99301.jpg)
87
+ Figure 2: Illustration of our proposed Neural Pooling Method 2. This is an example for a graph $\mathcal { G }$ with 8 nodes. GNNs can learn representations for each node and graph pooling processes node representations into a graph representation vector.
88
+
89
+ $\pmb { H }$ is passed through a Fully Connected Neural Network Layer $( F C L ^ { 1 } )$ to obtain $H ^ { \prime \prime }$ as:
90
+
91
+ $$
92
+ \pmb { H } ^ { \prime \prime } = F C L ^ { 1 } ( \pmb { H } ) \in \mathbb { R } ^ { n \times \textit { f } ^ { \prime \prime } } \mathrm { \bf ~ w h e r e ~ } f ^ { \prime \prime } < f
93
+ $$
94
+
95
+ After this $H ^ { \prime \prime }$ is again passed through a second Fully Connected Neural Network Layer $( F C L ^ { 2 } )$ to obtain $H ^ { \prime }$ as:
96
+
97
+ $$
98
+ \pmb { H } ^ { \prime } = F C L ^ { 2 } ( \pmb { H } ^ { \prime \prime } ) \in \mathbb { R } ^ { n \times \textit { f } ^ { \prime } } \mathrm { w h e r e } \ f ^ { \prime } < f ^ { \prime \prime }
99
+ $$
100
+
101
+ Finally the graph representation $h _ { G }$ is obtained as:
102
+
103
+ $$
104
+ \pmb { h } _ { G } = \mathrm { F l a t t e n } ( \pmb { H } ^ { \prime T } \pmb { H } ^ { \prime } ) \in \mathbb { R } ^ { f ^ { 2 } \times 1 }
105
+ $$
106
+
107
+ where $H ^ { \prime T }$ denotes the transpose of $H ^ { \prime }$ .
108
+
109
+ Intuition: The $F C L ^ { 1 }$ performs the role of reducing the dimensionality of the input node representations. The trainable parameters of this $F C L ^ { 1 }$ can be thought of as learning a mapping from the $f$ to the $f ^ { \prime \prime }$ -dimensional space. The $F C L ^ { 2 }$ further reduces the $f ^ { \prime \prime }$ -dimensional node representations to a $f ^ { \prime }$ dimensional representation. $\pmb { H } ^ { \prime } \in \mathbb { R } ^ { n \times \textit { f } ^ { \prime } }$ can be viewed as $H ^ { \prime } = [ l _ { 1 } , l _ { 2 } , \dots \dots , l _ { f ^ { \prime } } ]$ , where $\boldsymbol { l } _ { j } \in \mathbb { R } ^ { n }$ , $j { = } 1 , 2 , . . . , f ^ { \prime }$ . The vector $l _ { j }$ encodes the spatial distribution of the $j$ -th feature in the graph. Based on this view, ${ \pmb { H } } ^ { \prime T } { \pmb { H } } ^ { \prime }$ is able to capture the topology information.
110
+
111
+ Similar to the previous method, Neural Pooling Method 2 satisfies both the conditions of graph pooling which is that it always outputs an $f ^ { \prime 2 }$ -dimensional graph representation for $H \in \mathbb { R } ^ { \breve { n } \times ^ { \bullet } } $ , regardless of the value of $n$ . It is also invariant to permutation so that it outputs the same graph representation when the order of rows of $\pmb { H }$ changes.
112
+
113
+ # 4 EXPERIMENTAL SETUP
114
+
115
+ We perform experiments on graph classification tasks in the bio-informatics and social network domains to demonstrate the effectiveness and superiority of our proposed methods, namely Neural Pooling Methods 1 and 2. Details of datasets and parameter settings are described below.
116
+
117
+ # 4.1 DATASETS
118
+
119
+ We use nine graph classification datasets from (Yanardag & Vishwanathan, 2015), including four bioinformatics datasets and five social network datasets. Only bioinformatics datasets come with node labels. For the social network datasets, we use one-hot encoding of node degrees as features. The details of the datasets are summarized in Table 1 and Table 2.
120
+
121
+ • MUTAG (Debnath et al., 1991) is a bioinformatics dataset of 188 graphs representing nitro compounds. The task is to classify each graph by determining whether the compound is mutagenic aromatic or heteroaromatic.
122
+ • PTC (Toivonen et al., 2003) is a bioinformatics dataset of 344 graphs representing chemical compounds. Each node comes with one of 19 discrete node labels. The task is to predict the rodent carcinogenicity for each graph.
123
+ PROTEINS (Borgwardt et al., 2005) is a bioinformatics dataset of 1,113 graph structures of proteins. Nodes in the graphs refer to secondary structure elements (SSEs) and have discrete node labels indicating whether they represent a helix, sheet or turn. And edges mean that two nodes are neighbors along the amino-acid sequence or in space. The task is to predict the protein function for each graph.
124
+ NCI1 (Wale et al., 2008) is a bioinformatics dataset of 4,110 graphs representing chemical compounds. The graph classification label is decided by anti-cancer screens for ability to suppress or inhibit the growth of a panel of human tumor cell lines.
125
+ • COLLAB is a scientific collaboration dataset of 5,000 graphs corresponding to egonetworks.The dataset is derived from 3 public collaboration datasets (Leskovec et al., 2005). Each ego-network contains different researchers from each field and is labeled by the corresponding field. The three fields are High Energy Physics, Condensed Matter Physics, and Astro Physics.
126
+ IMDB-BINARY is a movie collaboration dataset of 1,000 graphs representing egonetworks for actors/actresses. The dataset is derived from collaboration graphs on Action and Romance genres. In each graph, nodes represent actors/actresses and edges simply mean they collaborate the same movie. The graphs are labeled by the corresponding genre and the task is to identify the genre for each graph.
127
+ IMDB-MULTI is multi-class version of IMDB-BINARY. It contains 1,500 ego-networks and has three extra genres, namely, Comedy, Romance and Sci-Fi.
128
+ • REDDIT-BINARY is a dataset of 2,000 graphs where each graph represents an online discussion thread. Nodes in a graph correspond to users appearing in the corresponding discussion thread and an edge means that one user responded to another. TrollXChromosomes and atheism are discussion-based subreddits, forming two classes to be classified.
129
+
130
+ Table 1: Details of bioinformatics datasets
131
+
132
+ <table><tr><td>Name</td><td>MUTAG</td><td>PTC PROTEINS</td><td>NCI1</td></tr><tr><td># graphs</td><td>188 344</td><td>1113</td><td>4110</td></tr><tr><td># classes</td><td>2 2</td><td>2</td><td>2</td></tr><tr><td># nodes(max)</td><td>28 109</td><td>620</td><td>111</td></tr><tr><td># nodes(avg.)</td><td>18.0 25.6</td><td>39.1</td><td>29.9</td></tr></table>
133
+
134
+ Table 2: Details of social network datasets
135
+
136
+ <table><tr><td>Name</td><td>COLLAB IMDB-B</td><td>IMDB-M</td><td>RDT-B</td><td>RDT-M5K</td></tr><tr><td># graphs</td><td>5000 1000</td><td>1500</td><td>2000</td><td>5000</td></tr><tr><td># classes</td><td>3 2</td><td>3</td><td>2</td><td>5</td></tr><tr><td># nodes(max)</td><td>492 136</td><td>89</td><td>3783</td><td>3783</td></tr><tr><td># nodes(avg.)</td><td>74.5 19.8</td><td>13.0</td><td>429.6</td><td>508.5</td></tr></table>
137
+
138
+ • REDDIT-MULTI5K is a similar dataset as REDDIT- BINARY, which contains 5,000 graphs. The difference lies in that REDDIT-MULTI5K crawled data from five different subreddits, namely, worldnews, videos, AdviceAnimals, aww and mildlyinteresting. And the task is to identify the subreddit of each graph instead of determining the type of subreddits.
139
+
140
+ # 4.2 TRAINING AND EVALUATION
141
+
142
+ Following (Yanardag & Vishwanathan, 2015; Niepert et al., 2016), model performance is evaluated using 10-fold cross-validation and reported as the average and standard deviation of validation accuracies across the 10 folds. For GNNs, we follow the same training process in (Xu et al., 2019). The GNN has 5 layers. Each multi-layer perceptron (MLP) has 2 layers with batch normalization (Ioffe & Szegedy, 2015). Dropout (Srivastava et al., 2014) is applied in the classifiers. The Adam (Kingma & Ba, 2015) optimizer is used with the learning rate initialized as 0.01 and decayed by 0.5 every 50 epochs. The number of total epochs is selected according to the best cross-validation accuracy. We tune the number of hidden units (16, 32, 64) and the batch size (32, 128) using grid search.
143
+
144
+ # 4.3 BASELINES
145
+
146
+ We compare our methods with various other graph pooling methods on the graph classification task, including DIFFPOOL (Ying et al., 2018), SORT-POOL (Zhang et al., 2018), TOPKPOOL (Gao & Ji, 2019), SAGPOOL (Lee et al., 2019), and EIGEN-POOL (Ma et al., 2019b). DIFFPOOL maps nodes to a pre-defined number of clusters but is hard to train. EIGENPOOL involves the computation of eigenvectors, which is slow and expensive. SORTPOOL, SAGPOOL and TOPKPOOL rely on the top-K sorting to select a fixed number (K) of nodes and order them, during which the information from unselected nodes is discarded. We also compare with some recent methods including COVPOOL (Wang et al., 2019a), ATTNPOOL (Girdhar & Ramanan, 2017) as well as second order pooling methods $\mathbf { S O P o o l } _ { b i m a p }$ and SOPoolattention (Wang & Ji, 2020).
147
+
148
+ # 5 RESULTS & DISCUSSION
149
+
150
+ The results of our experiments are summarized in Table 3 and Table 4 .From the results we can see that our methods lead to an improvement in classification accuracy over existing methods and are also more reliable as compared previous works as observed from the lower values of standard deviation.This enhancement in performance is consistent across all the datasets. The results may be attributed to the fact that compared to existing graph pooling methods, our pooling methods are able to use information from all nodes, collect second-order statistics, and leverage the ability of neural networks to learn from underlying data, making them more powerful. The Neural Pooling methods utilize the ability of neural networks to learn the topological structure as well as correlation among the node representations in, capturing essential features and connections between underlying data.
151
+
152
+ Table 3: Comparison results of our proposed methods with other graph pooling methods on bioinformatics datasets. Results shown are the average classification accuracy and standard deviation across 10-fold cross-validation.
153
+
154
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>PTC</td><td rowspan=1 colspan=1>PROTEINS</td><td rowspan=1 colspan=1>MUTAG</td><td rowspan=1 colspan=1>NCI1</td></tr><tr><td rowspan=1 colspan=1>SUM/AVG(Xu et al., 2019)</td><td rowspan=1 colspan=1>64.6 ± 7.0</td><td rowspan=1 colspan=1>76.2 ± 2.8</td><td rowspan=1 colspan=1>89.4 ±5.6</td><td rowspan=1 colspan=1>82.7 ± 1.7</td></tr><tr><td rowspan=1 colspan=1>DIFFPOOL(Ying et al., 2018)</td><td rowspan=1 colspan=1>66.1 ± 7.7</td><td rowspan=1 colspan=1>78.8± 3.1</td><td rowspan=1 colspan=1>94.8± 4.8</td><td rowspan=1 colspan=1>76.6 ± 1.3</td></tr><tr><td rowspan=1 colspan=1>SORTPOOL(Zhang et al., 2018)</td><td rowspan=1 colspan=1>69.5± 6.3</td><td rowspan=1 colspan=1>79.2 ± 3.0</td><td rowspan=1 colspan=1>95.2 ± 3.9</td><td rowspan=1 colspan=1>78.9 ± 2.7</td></tr><tr><td rowspan=1 colspan=1>TOPKPOOL(Gao &amp; Ji, 2019)</td><td rowspan=1 colspan=1>68.4 ± 6.4</td><td rowspan=1 colspan=1>79.1 ± 2.2</td><td rowspan=1 colspan=1>94.7± 3.5</td><td rowspan=1 colspan=1>79.6 ± 1.7</td></tr><tr><td rowspan=1 colspan=1>SAGPOOL(Lee et al., 2019)</td><td rowspan=1 colspan=1>69.0 ± 6.6</td><td rowspan=1 colspan=1>78.4± 3.1</td><td rowspan=1 colspan=1>93.9 ± 3.3</td><td rowspan=1 colspan=1>79.0 ± 2.8</td></tr><tr><td rowspan=1 colspan=1>ATTNPOOL(Girdhar &amp; Ramanan, 2017)</td><td rowspan=1 colspan=1>71.2± 8.0</td><td rowspan=1 colspan=1>77.5± 3.3</td><td rowspan=1 colspan=1>93.2± 5.8</td><td rowspan=1 colspan=1>80.6± 2.1</td></tr><tr><td rowspan=1 colspan=1>EIGENPOOL(Ma et al.,2019b)</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>76.6± 2.3</td><td rowspan=1 colspan=1>80.6± 4.3</td><td rowspan=1 colspan=1>77.0 ± 2.3</td></tr><tr><td rowspan=1 colspan=1>COVPOOL(Wang et al.,2019a)</td><td rowspan=1 colspan=1>73.3 ± 5.1</td><td rowspan=1 colspan=1>80.1 ± 2.2</td><td rowspan=1 colspan=1>95.3 ± 3.7</td><td rowspan=1 colspan=1>83.5 ± 1.9</td></tr><tr><td rowspan=1 colspan=1>SOPOOLattn(Wang &amp; Ji, 2020)</td><td rowspan=1 colspan=1>72.9 ± 6.2</td><td rowspan=1 colspan=1>79.4 ± 3.2</td><td rowspan=1 colspan=1>93.6 ± 4.1</td><td rowspan=1 colspan=1>82.8± 1.4</td></tr><tr><td rowspan=1 colspan=1> SOPOOLbimap(Wang &amp; Ji, 2020)</td><td rowspan=1 colspan=1>75.0 ± 4.3</td><td rowspan=1 colspan=1>80.1 ± 2.7</td><td rowspan=1 colspan=1>95.3 ± 4.4</td><td rowspan=1 colspan=1>83.6 ± 1.4</td></tr><tr><td rowspan=1 colspan=1>Neural Pooling 1(ours)</td><td rowspan=1 colspan=1>74.5 ± 3.7</td><td rowspan=1 colspan=1>80.6 ± 2.7</td><td rowspan=1 colspan=1>94.0 ± 2.3</td><td rowspan=1 colspan=1>83.1 ± 1.2</td></tr><tr><td rowspan=1 colspan=1>Neural Pooling 2(ours)</td><td rowspan=1 colspan=1>76.2 ± 4.2</td><td rowspan=1 colspan=1>79.6± 3.0</td><td rowspan=1 colspan=1>95.5 ± 2.4</td><td rowspan=1 colspan=1>83.4 ± 1.9</td></tr></table>
155
+
156
+ Table 4: Comparison results of our proposed methods with other graph pooling methods on social network datsets. Results shown are the average classification accuracy and standard deviation across 10-fold cross-validation.
157
+
158
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>COLLAB</td><td rowspan=1 colspan=1>RDT-B</td><td rowspan=1 colspan=1>IMDB-B</td><td rowspan=1 colspan=1>IMDB-M</td><td rowspan=1 colspan=1>RDT-M5K</td></tr><tr><td rowspan=1 colspan=1> SUM/AVG</td><td rowspan=1 colspan=1>80.2 ± 1.9</td><td rowspan=1 colspan=1>92.4 ± 2.5</td><td rowspan=1 colspan=1>75.1 ± 5.1</td><td rowspan=1 colspan=1>52.3 ± 2.8</td><td rowspan=1 colspan=1>57.5 ± 1.5</td></tr><tr><td rowspan=1 colspan=1>DIFFPOOL</td><td rowspan=1 colspan=1>75.3 ± 2.2</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>74.4 ± 4.0</td><td rowspan=1 colspan=1>50.1 ± 3.2</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>SORTPOOL</td><td rowspan=1 colspan=1>78.2 ± 1.6</td><td rowspan=1 colspan=1>81.6 ± 4.6</td><td rowspan=1 colspan=1>77.5± 2.7</td><td rowspan=1 colspan=1>53.1 ± 2.9</td><td rowspan=1 colspan=1>48.4± 4.8</td></tr><tr><td rowspan=1 colspan=1>TOPKPOOL</td><td rowspan=1 colspan=1>79.6 ± 2.1</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>77.8 ± 5.1</td><td rowspan=1 colspan=1>53.7 ± 2.8</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>SAGPOOL</td><td rowspan=1 colspan=1>78.9 ± 1.7</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>77.8 ± 2.9</td><td rowspan=1 colspan=1>53.1 ± 2.8</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>ATTNPOOL</td><td rowspan=1 colspan=1>81.8± 2.2</td><td rowspan=1 colspan=1>92.5± 2.3</td><td rowspan=1 colspan=1>77.1 ± 4.4</td><td rowspan=1 colspan=1>53.8 ± 2.5</td><td rowspan=1 colspan=1>57.9 ± 1.7</td></tr><tr><td rowspan=1 colspan=1>COVPOOL</td><td rowspan=1 colspan=1>79.3 ± 1.8</td><td rowspan=1 colspan=1>90.3± 3.6</td><td rowspan=1 colspan=1>72.1± 5.1</td><td rowspan=1 colspan=1>47.8 ± 2.7</td><td rowspan=1 colspan=1>58.4±1.7</td></tr><tr><td rowspan=1 colspan=1>SOPOOLattn</td><td rowspan=1 colspan=1>81.1 ± 1.8</td><td rowspan=1 colspan=1>91.7 ± 2.7</td><td rowspan=1 colspan=1>78.1 ± 4.0</td><td rowspan=1 colspan=1>54.3± 2.6</td><td rowspan=1 colspan=1>58.3 ± 1.4</td></tr><tr><td rowspan=1 colspan=1>SOPOOLbimap</td><td rowspan=1 colspan=1>79.9 ± 1.9</td><td rowspan=1 colspan=1>89.6±3.3</td><td rowspan=1 colspan=1>78.4± 4.7</td><td rowspan=1 colspan=1>54.6± 3.6</td><td rowspan=1 colspan=1>58.4 ± 1.6</td></tr><tr><td rowspan=1 colspan=1>Neural Pooling 1(ours)</td><td rowspan=1 colspan=1>80.5± 1.5</td><td rowspan=1 colspan=1>90.6± 2.3</td><td rowspan=1 colspan=1>79.0 ± 2.3</td><td rowspan=1 colspan=1>55.1± 2.2</td><td rowspan=1 colspan=1>58.5 ± 1.8</td></tr><tr><td rowspan=1 colspan=1>Neural Pooling 2(ours)</td><td rowspan=1 colspan=1>81.0 ± 1.7</td><td rowspan=1 colspan=1>91.5 ± 3.0</td><td rowspan=1 colspan=1>78.5 ± 2.4</td><td rowspan=1 colspan=1>54.4 ± 1.9</td><td rowspan=1 colspan=1>59.1 ± 1.4</td></tr></table>
159
+
160
+ # 6 COMPLEXITY
161
+
162
+ Consider a graph $\mathcal { G } = ( A , X )$ represented by its adjacency matrix $\pmb { A } \in \{ 0 , 1 \} ^ { n \times n }$ and node feature matrix $\ b { X } \in \ b { \mathbb { R } ^ { n } } \times \ b { d }$ , where $n$ is the number of nodes in $\mathcal { G }$ and $d$ is the dimension of node features. Consider, $H = [ h _ { 1 } , h _ { 2 }$ , ........., $\pmb { h } _ { n } ] ^ { T } = \mathbf { G } \mathbf { N } \mathbf { N } ( \pmb { A } , \pmb { X } ) \in \mathbb { R } ^ { n \times \pmb { f } }$ where rows of $\pmb { H }$ , $\boldsymbol { h } _ { i } \in \mathbb { R } ^ { f }$ , $i$ $= 1 , 2 , . . . , n$ , are representations of $n$ nodes. Consider a direct application of second-order graph pooling to obtain the graph representation $h _ { G }$ as:
163
+
164
+ $$
165
+ \pmb { h } _ { G } = \mathrm { F l a t t e n } ( \pmb { H } ^ { T } \pmb { H } ) \in \mathbb { R } ^ { f ^ { 2 } \times 1 }
166
+ $$
167
+
168
+ where $H ^ { T }$ denotes the transpose of $\pmb { H }$
169
+
170
+ However, it causes an explosion in the number of training parameters in the following classifier when $f$ is large, making the learning process harder to converge and easier to overfit. While each layer in a GNN usually has outputs with a small number of hidden units (e.g. 16, 32, 64), it has been pointed out that graph representation learning benefits from using information from outputs of all layers, obtaining better performance and generalization ability. It is usually achieved by concatenating outputs across all layers in a GNN. In this case, $\pmb { H }$ has a large final $f$ , making direct use of secondorder pooling infeasible. For example, if a GNN has 5 layers and each layer’s outputs have 32 hidden units, $f$ becomes $3 2 \times 5 = 1 6 0$ . Suppose $h _ { G }$ is sent into a 1-layer fully-connected classifier for $c$ graph categories in a graph classification task. It results in $1 6 0 ^ { \dot { 2 } } c = 2 \dot { 5 } , 6 0 0 c$ training parameters, which is excessive. We omit the bias term for simplicity. On the other hand, both of our proposed novel graph pooling methods significantly reduce the number of training parameters. In the case of Neural Pooling Method 1, considering the previous example if $f ^ { \prime }$ is chosen to be 64, and $f$ is 160, then the total number of trainable parameters in the $2 ~ F C L s$ and a 1-layer fully-connected $c$ class classifier will be $( 1 6 0 \times 6 4 ) + 6 4 + 6 4 c = 1 0 , 3 0 4 + 6 4 c$ notably reducing the number of parameters as compared to 25, $6 0 0 c$ . In the case of Neural Pooling Method 2, if $f ^ { \prime \bar { \prime } }$ is chosen to be 64, $f ^ { \prime }$ as 32 and $f$ is 160, then the total number of trainable parameters in the $2 \ : F C L s$ and a 1-layer fully-connected $c$ class classifier will be $( 1 6 0 \times 6 4 ) + ( 6 4 \times 3 2 ) + 3 2 2 c = 1 2 , 2 8 8 + 1 0 2 4 c$ again reducing the number of parameters when compared to $2 5 , 6 0 0 c$ .
171
+
172
+ # 7 CONCLUSION
173
+
174
+ In this work, we propose to perform graph representation learning with Neural Pooling, by pointing out that Neural Pooling can naturally solve the challenges of graph pooling. Neural Pooling is more powerful than existing graph pooling methods, since it is capable of using all node information, collecting second-order statistics that encode feature correlations and topology information and leverage the ability of neural networks to learn from underlying data, making them more powerful. Our proposed methods solve the practical problems incurred by directly using second-order pooling with GNNs. To demonstrate the effectiveness and superiority of our methods, we perform experiments on graph classification tasks in the bio-informatics and social network domains to demonstrate the effectiveness and superiority of our proposed methods. Experimental results show that our methods improve the performance significantly and consistently. An interesting future work direction could be to extend our methods for hierarchical graph pooling, where the output is a is a pseudo graph with fewer nodes than the input graph. It is used to build hierarchical GNNs, where hierarchical graph pooling is used several times between GNN layers to gradually decrease the number of nodes.
175
+
176
+ # REFERENCES
177
+
178
+ KM Borgwardt, Stefan Schonauer, SVN Vishwanathan, Alexander Smola, and HP Kriegel. Protein ¨ function prediction via graph kernels. Bioinformatics, 21 Suppl 1:i47–56, 01 2005.
179
+
180
+ Y-Lan Boureau, Jean Ponce, and Yann LeCun. A theoretical analysis of feature pooling in visual recognition. In Johannes Furnkranz and Thorsten Joachims (eds.), ¨ Proceedings of the 27th International Conference on Machine Learning (ICML-10), pp. 111–118, Haifa, Israel, June 2010. Omnipress. URL http://www.icml2010.org/papers/638.pdf.
181
+
182
+ Asim Kumar Debnath, Rosa L Lopez de Compadre, Gargi Debnath, Alan J Shusterman, and Corwin Hansch. Structure-activity relationship of mutagenic aromatic and heteroaromatic nitro compounds. correlation with molecular orbital energies and hydrophobicity. Journal of medicinal chemistry, 34(2):786–797, 1991.
183
+
184
+ Michael Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on ¨ graphs with fast localized spectral filtering. In Daniel D. Lee, Masashi Sugiyama, Ulrike von Luxburg, Isabelle Guyon, and Roman Garnett (eds.), Advances in Neural Information Processing Systems 29: Annual Conference on Neural Information Processing Systems 2016, December 5- 10, 2016, Barcelona, Spain, pp. 3837–3845, 2016.
185
+
186
+ David K Duvenaud, Dougal Maclaurin, Jorge Iparraguirre, Rafael Bombarell, Timothy Hirzel, Alan Aspuru-Guzik, and Ryan P Adams. Convolutional networks on graphs for learning molecular fingerprints. In C. Cortes, N. D. Lawrence, D. D. Lee, M. Sugiyama, and R. Garnett (eds.), Advances in Neural Information Processing Systems 28, pp. 2224–2232. Curran Associates, Inc., 2015.
187
+
188
+ Wenqi Fan, Yao Ma, Qing Li, Yuan He, Eric Zhao, Jiliang Tang, and Dawei Yin. Graph neural networks for social recommendation. In The World Wide Web Conference, WWW ’19, pp. 417–426, New York, NY, USA, 2019. Association for Computing Machinery. ISBN 9781450366748. doi: 10.1145/3308558.3313488. URL https://doi.org/10.1145/3308558.3313488.
189
+
190
+ Hongchang Gao, Jian Pei, and Heng Huang. Conditional random field enhanced graph convolutional neural networks. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, KDD ’19, pp. 276–284, New York, NY, USA, 2019. Association for Computing Machinery. ISBN 9781450362016. doi: 10.1145/3292500.3330888. URL https://doi.org/10.1145/3292500.3330888.
191
+
192
+ Hongyang Gao and Shuiwang Ji. Graph u-nets. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9- 15 June 2019, Long Beach, California, USA, volume 97 of Proceedings of Machine Learning Research, pp. 2083–2092. PMLR, 2019. URL http://proceedings.mlr.press/v97/ gao19a.html.
193
+
194
+ Justin Gilmer, Samuel S. Schoenholz, Patrick F. Riley, Oriol Vinyals, and George E. Dahl. Neural message passing for quantum chemistry. In Doina Precup and Yee Whye Teh (eds.), Proceedings of the 34th International Conference on Machine Learning, ICML 2017, Sydney, NSW, Australia, 6-11 August 2017, volume 70 of Proceedings of Machine Learning Research, pp. 1263–1272. PMLR, 2017. URL http://proceedings.mlr.press/v70/gilmer17a.html.
195
+
196
+ Rohit Girdhar and Deva Ramanan. Attentional pooling for action recognition. In Isabelle Guyon, Ulrike von Luxburg, Samy Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett (eds.), Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, 4-9 December 2017, Long Beach, CA, USA, pp. 34–45, 2017. URL http://papers.nips.cc/paper/ 6609-attentional-pooling-for-action-recognition.
197
+
198
+ Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 1024–1034. Curran Associates, Inc., 2017. URL http://papers.nips.cc/paper/ 6703-inductive-representation-learning-on-large-graphs.pdf.
199
+
200
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In Francis R. Bach and David M. Blei (eds.), Proceedings of the 32nd International Conference on Machine Learning, ICML 2015, Lille, France, 6-11 July 2015, volume 37 of JMLR Workshop and Conference Proceedings, pp. 448–456. JMLR.org, 2015. URL http://proceedings.mlr.press/v37/ioffe15.html.
201
+
202
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Yoshua Bengio and Yann LeCun (eds.), 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings, 2015. URL http: //arxiv.org/abs/1412.6980.
203
+
204
+ Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net, 2017. URL https: //openreview.net/forum?id $=$ SJU4ayYgl.
205
+
206
+ Junhyun Lee, Inyeop Lee, and Jaewoo Kang. Self-attention graph pooling. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, volume 97 of Proceedings of Machine Learning Research, pp. 3734–3743. PMLR, 2019. URL http://proceedings. mlr.press/v97/lee19c.html.
207
+
208
+ Jure Leskovec, Jon Kleinberg, and Christos Faloutsos. Graphs over time: densification laws, shrinking diameters and possible explanations. In Proceedings of the eleventh ACM SIGKDD international conference on Knowledge discovery in data mining, pp. 177–187, 2005.
209
+
210
+ Jianxin Ma, Peng Cui, Kun Kuang, Xin Wang, and Wenwu Zhu. Disentangled graph convolutional networks. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, volume 97 of Proceedings of Machine Learning Research, pp. 4212–4221. PMLR, 2019a. URL http://proceedings.mlr.press/v97/ma19a.html.
211
+
212
+ Yao Ma, Suhang Wang, Charu C. Aggarwal, and Jiliang Tang. Graph convolutional networks with eigenpooling. KDD ’19, pp. 723–731, New York, NY, USA, 2019b. Association for Computing Machinery. ISBN 9781450362016. doi: 10.1145/3292500.3330982. URL https://doi. org/10.1145/3292500.3330982.
213
+
214
+ Mathias Niepert, Mohamed Ahmed, and Konstantin Kutzkov. Learning convolutional neural networks for graphs. In Maria-Florina Balcan and Kilian Q. Weinberger (eds.), Proceedings of the 33nd International Conference on Machine Learning, ICML 2016, New York City, NY, USA, June 19-24, 2016, volume 48 of JMLR Workshop and Conference Proceedings, pp. 2014–2023. JMLR.org, 2016. URL http://proceedings.mlr.press/v48/niepert16.html.
215
+
216
+ Nitish Srivastava, Geoffrey E. Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. J. Mach. Learn. Res., 15(1): 1929–1958, 2014. URL http://dl.acm.org/citation.cfm?id=2670313.
217
+
218
+ Hannu Toivonen, Ashwin Srinivasan, Ross D. King, Stefan Kramer, and Christoph Helma. Statistical evaluation of the Predictive Toxicology Challenge 2000–2001. Bioinformatics, 19(10): 1183–1193, 07 2003. ISSN 1367-4803. doi: 10.1093/bioinformatics/btg130. URL https: //doi.org/10.1093/bioinformatics/btg130.
219
+
220
+ Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Li ´ o, and Yoshua \` Bengio. Graph attention networks. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $=$ rJXMpikCZ.
221
+
222
+ Nikil Wale, Ian A Watson, and George Karypis. Comparison of descriptor spaces for chemical compound retrieval and classification. Knowledge and Information Systems, 14(3):347–375, 2008.
223
+
224
+ Qilong Wang, Jiangtao Xie, Wangmeng Zuo, Lei Zhang, and Peihua Li. Deep cnns meet global covariance pooling: Better representation and generalization. CoRR, abs/1904.06836, 2019a. URL http://arxiv.org/abs/1904.06836.
225
+
226
+ Xiao Wang, Houye Ji, Chuan Shi, Bai Wang, Yanfang Ye, Peng Cui, and Philip S Yu. Heterogeneous graph attention network. In The World Wide Web Conference, WWW ’19, pp. 2022–2032, New York, NY, USA, 2019b. Association for Computing Machinery. ISBN 9781450366748. doi: 10.1145/3308558.3313562. URL https://doi.org/10.1145/3308558.3313562.
227
+
228
+ Z. Wang and S. Ji. Second-order pooling for graph neural networks. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2020.
229
+
230
+ Keyulu Xu, Chengtao Li, Yonglong Tian, Tomohiro Sonobe, Ken-ichi Kawarabayashi, and Stefanie Jegelka. Representation learning on graphs with jumping knowledge networks. In Jennifer G. Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on
231
+
232
+ Machine Learning, ICML 2018, Stockholmsmassan, Stockholm, Sweden, July 10-15, 2018 ¨ , volume 80 of Proceedings of Machine Learning Research, pp. 5449–5458. PMLR, 2018. URL http://proceedings.mlr.press/v80/xu18c.html.
233
+
234
+ Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id $=$ ryGs6iA5Km.
235
+
236
+ Pinar Yanardag and S.V.N. Vishwanathan. Deep graph kernels. In Proceedings of the 21th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD ’15, pp. 1365–1374, New York, NY, USA, 2015. Association for Computing Machinery. ISBN 9781450336642. doi: 10.1145/2783258.2783417. URL https://doi.org/10.1145/ 2783258.2783417.
237
+
238
+ Zhitao Ying, Jiaxuan You, Christopher Morris, Xiang Ren, William L. Hamilton, and Jure Leskovec. Hierarchical graph representation learning with differentiable pooling. In Samy Bengio, Hanna M. Wallach, Hugo Larochelle, Kristen Grauman, Nicolo Cesa-Bianchi, and Roman Garnett (eds.), \` Advances in Neural Information Processing Systems 31: Annual Conference on Neural Information Processing Systems 2018, NeurIPS 2018, 3-8 December 2018, Montreal, Canada ´ , pp. 4805–4815, 2018.
239
+
240
+ Muhan Zhang, Zhicheng Cui, Marion Neumann, and Yixin Chen. An end-to-end deep learning architecture for graph classification. AAAI, 2018.
md/train/Z2vksUFuVst/Z2vksUFuVst.md ADDED
@@ -0,0 +1,344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Conservative Offline Distributional Reinforcement Learning
2
+
3
+ Yecheng Jason Ma, Dinesh Jayaraman, Osbert Bastani University of Pennsylvania {jasonyma, dineshj, obastani}@seas.upenn.edu
4
+
5
+ # Abstract
6
+
7
+ Many reinforcement learning (RL) problems in practice are offline, learning purely from observational data. A key challenge is how to ensure the learned policy is safe, which requires quantifying the risk associated with different actions. In the online setting, distributional RL algorithms do so by learning the distribution over returns (i.e., cumulative rewards) instead of the expected return; beyond quantifying risk, they have also been shown to learn better representations for planning. We propose Conservative Offline Distributional Actor Critic (CODAC), an offline RL algorithm suitable for both risk-neutral and risk-averse domains. CODAC adapts distributional RL to the offline setting by penalizing the predicted quantiles of the return for out-of-distribution actions. We prove that CODAC learns a conservative return distribution—in particular, for finite MDPs, CODAC converges to an uniform lower bound on the quantiles of the return distribution; our proof relies on a novel analysis of the distributional Bellman operator. In our experiments, on two challenging robot navigation tasks, CODAC successfully learns risk-averse policies using offline data collected purely from risk-neutral agents. Furthermore, CODAC is state-of-the-art on the D4RL MuJoCo benchmark in terms of both expected and risk-sensitive performance. Code is available at: https://github.com/JasonMa2016/CODAC
8
+
9
+ # 1 Introduction
10
+
11
+ In many applications of reinforcement learning, actively gathering data through interactions with the environment can be risky and unsafe. Offline (or batch) reinforcement learning (RL) avoids this problem by learning a policy solely from historical data (called observational data) [9, 22, 23].
12
+
13
+ A shortcoming of most existing approaches to offline RL [11, 46, 20, 21, 48, 18] is that they are designed to maximize the expected value of the cumulative reward (which we call the return) of the policy. As a consequence, they are unable to quantify risk and ensure that the learned policy acts in a safe way. In the online setting, there has been recent work on distributional RL algorithms [7, 6, 27, 38, 17], which instead learn the full distribution over future returns. They can use this distribution to plan in a way that avoids taking risky, unsafe actions. Furthermore, when coupled with deep neural network function approximation, they can learn better state representations due to the richer distributional learning signal $\lVert \rVert 2 6 \rVert$ , enabling them to outperform traditional RL algorithms even on the risk-neutral, expected return objective [4, 7, 6, 47, 14].
14
+
15
+ We propose Conservative Offline Distributional Actor-Critic (CODAC), which adapts distributional RL to the offline setting. A key challenge in offline RL is accounting for high uncertainty on out-of-distribution (OOD) state-action pairs for which observational data is limited $\pm \sqrt { 2 3 } \sqrt { 2 0 } ]$ ; the value estimates for these state-action pairs are intrinsically high variance, and may be exploited by the policy without correction due to the lack of online data gathering and feedback. We build on conservative $Q$ -learning $\pmb { \left. 2 1 \right. }$ , which penalizes $Q$ values for OOD state-action pairs to ensure that the learned $Q$ -function lower bounds the true $Q$ -function. Analogously, CODAC uses a penalty to ensure that the quantiles of the learned return distribution lower bound those of the true return distribution. Crucially, the lower bound is data-driven and selectively penalizes the quantile estimates of state-actions that are less frequent in the offline dataset; see Figure 1.
16
+
17
+ We prove that for finite MDPs, CODAC converges to an estimate of the return distribution whose quantiles uniformly lower bound the quantiles of the true return distribution; in addition, this data-driven lower bound is tight up to the approximation error in estimating the quantiles using finite data. Thus, CODAC obtains a uniform lower bound on all integrations of the quantiles, including the standard RL objective of expected return, the risk-sensitive conditional-value-at-risk (CVaR) objective $\pmb { \Vert 3 5 \Vert }$ , as well as many other risk-sensitive objectives. We additionally prove that CODAC expands the gap in quantile estimates between in-distribution and OOD actions, thus avoiding overconfidence when extrapolating to OOD actions $\pmb { \mathbb { D } }$ .
18
+
19
+ Our theoretical guarantees rely on novel techniques for analyzing the distributional Bellman operator, which is challenging since it acts on the infinite-dimensional function space of return distributions (whereas the traditional
20
+
21
+ ![](images/76192742e57ca7417188924db6dc1141f1cc9a9de88268ae200008b9ef91309e.jpg)
22
+ Figure 1: CODAC obtains conservative estimates of the true return quantiles (black); it penalizes out-of-distribution actions, $\mu ( a \mid s )$ , more heavily than indistribution actions, $\pi _ { \hat { \beta } } ( a \mid s )$ .
23
+
24
+ Bellman operator acts on a finite-dimensional vector space). We provide several novel results that may be of independent interest; for instance, our techniques can be used to bound the error of the fixed-point of the empirical distributional Bellman operator; see Appendix A.6.
25
+
26
+ Finally, to obtain a practical algorithm, CODAC builds on existing distributional RL algorithms by integrating conservative return distribution estimation into a quantile-based actor-critic framework.
27
+
28
+ In our experiments, we demonstrate the effectiveness of CODAC on both risk-sensitive and riskneutral RL. First, on two novel risk-sensitive robot navigation tasks, we show that CODAC successfully learns risk-averse policies using offline datasets collected purely from a risk-neutral agent, a challenging task that all our baselines fail to solve. Next, on the D4RL Mujoco suite $\tilde { \left[ 1 0 \right] }$ , a popular offline RL benchmark, we show that CODAC achieves state-of-art results on both the original risk-neutral version as well a modified risk-sensitive version $\boxed { 4 3 }$ . Finally, we empirically show that CODAC computes quantile lower-bounds and gap-expanded quantiles even on high-dimensional continuous-control problems, validating our key theoretical insights into the effectiveness of CODAC.
29
+
30
+ Related work. There has been growing interest in offline (or batch) RL [22, 23]. The key challenge in offline RL is to avoid overestimating the value of out-of-distribution (OOD) actions rarely taken in the observational dataset $\overline { { 1 4 0 } } , \overline { { 4 4 } } , \overline { { 2 0 } } ]$ . The problem is that policy learning optimizes against the value estimates; thus, even if the estimation error is i.i.d., policy optimization biases towards taking actions with high variance value estimates, since some of these values will be large by random chance. In risk-sensitive or safety-critical settings, these actions are exactly the ones that should be avoided.
31
+
32
+ One solution is to constrain the learned policy to take actions similar to the ones in the dataset (similar to imitation learning)—e.g., by performing support matching $\lVert \overline { { 4 6 } } \rVert$ or distributional matching [20, 12]. However, these approaches tend to perform poorly when data is gathered from suboptimal policies. An alternative is to regularize the $Q$ -function estimates to be conservative at OOD actions [21, 48, 18]. CODAC builds on these approaches, but obtains conservative estimates of all quantile values of the return distribution rather than just the expected return. Traditionally, the literature on off-policy evaluation (OPE) $\left\| 3 2 \right\| \left. 1 6 \right. , \left\| 3 9 \right\| \left. 2 5 \right. \left. 3 7 \right\|$ aims to estimate the expected return of a policy using precollected offline data; CODAC proposes an OPE procedure amenable to all objectives that can be expressed as integrals of the return quantiles. Consequently, our fine-grained approach not only enables risk-sensitive policy learning, but also improves performance on risk-neutral domains.
33
+
34
+ In particular, CODAC builds on recent works on distributional RL [4, 7, 6, 47], which parameterize and estimate the entire return distribution instead of just a point estimate of the expected return (i.e., the $Q$ -function) $ { \mathbb { I } } 2 9 . { \left| 2 8 \right| }$ . Distributional RL algorithms have been shown to achieve state-of-art performance on Atari and continuous control domains [14, 3]; intuitively, they provide richer training signals that stabilize value network training $\boxed { \boxed { 4 } }$ . Existing distributional RL algorithms parameterize the policy return distribution in many different ways, including canonical return atoms $\pmb { \mathbb { H } }$ , the expectiles $\pmb { \mathbb { B } } 6 \mathbf { I }$ , the moments $\pmb { \triangleright }$ , and the quantiles [7, 6, 47]. CODAC builds on the quantile approach due to its suitability for risk-sensitive policy optimization. The quantile representation provides an unified framework for optimizing different objectives of interest $\textcircled { 7 }$ , such as the riskneutral expected return, and a family of risk-sensitive objectives representable by the quantiles; this family includes, for example, the conditional-value-at-risk (CVaR) return [35, 5, 38, 17], the Wang measure $\boxed { \boxplus 5 } \boxed { }$ , and the cumulative probability weighting (CPW) metric $\pmb { \left. 4 2 \right. }$ . Recent work has provided theoretical guarantees on learning CVaR policies $\overline { { \| 1 7 \| } }$ ; however, their approach cannot provide bounds on the quantiles of the estimated return distribution, which is significantly more challenging since there is no closed-form expression for the Bellman update on the return quantiles.
35
+
36
+ Finally, there has been some recent work adapting distributional RL to the offline setting [1, 43]. First, REM $\pmb { \mathbb { \left[ 1 \right] } }$ builds on QR-DQN $\textcircled { 7 }$ , an online distributional RL algorithm; however, REM can be applied to regular DQN $\sqrt { 2 9 }$ and does not directly utilize the distributional aspect of QR-DQN. The closest work to ours is ORAAC $\textcircled { 1 4 3 }$ , which uses distributional RL to learn a CVaR policy in the offline setting. ORAAC uses imitation learning to avoid OOD actions and stay close to the data distribution. As discussed above, imitation learning strategies can perform poorly unless the dataset comes from an optimal policy; in our experiments, we find that CODAC significantly outperforms ORAAC. Furthermore, unlike ORAAC, we provide theoretical guarantees on our approach.
37
+
38
+ # 2 Background
39
+
40
+ Offline RL. Consider a Markov Decision Process (MDP) $\lVert 3 3 \rVert$ $( S , { \mathcal { A } } , P , R , \gamma )$ , where $s$ is the state space, $\mathcal { A }$ is the action space, $P ( s ^ { \prime } \mid s , a )$ is the transition distribution, $\ \cdot$ is the reward distribution, and $\gamma \in ( 0 , 1 )$ is the discount factor, and consider a stochastic policy $\pi ( a \mid$ $s ) : \mathcal { S } \Delta ( \mathcal { A } )$ . A rollout using $\pi$ from state $s$ using initial action $a$ is the random sequence $\xi = ( ( s _ { 0 } , a _ { 0 } , r _ { 0 } ) , ( s _ { 1 } , a _ { 1 } , r _ { 1 } ) , \ldots )$ such that $s _ { 0 } ~ = ~ s$ , $a _ { 0 } ~ = ~ a$ , $a _ { t } \sim \pi ( \cdot \mid s _ { t } )$ (for $t > 0$ ), $r _ { t } ~ \sim$ $R ( \cdot \mid s _ { t } , a _ { t } )$ , and $s _ { t + 1 } \sim P ( \cdot \mid s _ { t } , a _ { t } )$ ; we denote the distribution over rollouts by $D ^ { \pi } ( \xi \mid s , a )$ . The $Q$ -function $Q ^ { \pi } : S \times \mathcal { A } \mathbb { R }$ of $\pi$ is its expected discounted cumulative return $Q ^ { \pi } ( s , a ) =$ $\begin{array} { r l } { } & { { } \underset { - } { \mathbb { E } } _ { D ^ { \pi } ( \xi | s , a ) } [ \sum _ { t = 0 } ^ { \infty } \overset { \cdot } { \gamma } { } ^ { t } r _ { t } ] } \end{array}$ . Assuming the rewards satisfy $r _ { t } \in [ R _ { \operatorname* { m i n } } , R _ { \operatorname* { m a x } } ]$ , then we have $Q ^ { \pi } ( s , a ) \in$ $[ V _ { \operatorname* { m i n } } , V _ { \operatorname* { m a x } } ] \subseteq [ \dot { R } _ { \operatorname* { m i n } } / ( 1 - \gamma ) , R _ { \operatorname* { m a x } } / ( 1 - \gamma ) ]$ .
41
+
42
+ A standard goal of reinforcement learning (RL), which we call risk-neutral RL, is to learn the optimal policy $\pi ^ { * }$ such that $Q ^ { \pi ^ { * } } ( s , a ) \geq Q ^ { \pi } ( s , a )$ for all $s \in S , a \in A$ and all $\pi$ .
43
+
44
+ In offline RL, the learning algorithm only has access to a fixed dataset $\mathcal { D } : = \{ ( s , a , r , s ^ { \prime } ) \}$ , where $r \sim R ( \cdot \mid s , a )$ and $s ^ { \prime } \sim \bar { P } ( \cdot \mid s , a )$ . The goal is to learn the optimal policy without any interaction with the environment. Though we do not assume that $\mathcal { D }$ necessarily comes from a single behavior policy, we define the empirical behavior policy to be $\begin{array} { r } { \hat { \pi } _ { \beta } ( a \mid s ) : = \frac { \dot { \sum _ { s ^ { \prime } , a ^ { \prime } \in \mathcal { D } } } \mathbb { 1 } ( s ^ { \prime } = s , a ^ { \prime } = a ) } { \sum _ { s ^ { \prime } \in \mathcal { D } } \mathbb { 1 } ( s ^ { \prime } = s ) } } \end{array}$ . With slight abuse of notation, we write $( s , a , r , s ^ { \prime } ) \sim \mathcal { D }$ to denote a uniformly random sample from the dataset. Also, in this paper, we broadly refer to actions not drawn from ${ \hat { \pi } } _ { \beta } ( \cdot \mid s )$ (i.e., low probability density) as out-of-distribution (OOD).
45
+
46
+ Fitted $Q$ -evaluation (FQE) [9, 34] uses $Q$ -learning for offline RL, which leverages the fact that $Q ^ { \pi } = \tau ^ { \pi } Q ^ { \pi }$ is the unique fixed point of the Bellman operator $\mathcal { T } ^ { \pi } : \mathbb { R } ^ { | \mathcal { S } | | \mathcal { A } | } \mathbb { R } ^ { | \bar { \mathcal { S } } | | \mathcal { A } | }$ defined by
47
+
48
+ $$
49
+ \begin{array} { r } { \mathcal { T } ^ { \pi } Q ( s , a ) = \mathbb { E } _ { R ( r \mid s , a ) } [ r ] + \gamma \cdot \mathbb { E } _ { P ^ { \pi } ( s ^ { \prime } , a ^ { \prime } \mid s , a ) } [ Q ( s ^ { \prime } , a ^ { \prime } ) ] , } \end{array}
50
+ $$
51
+
52
+ where $P ^ { \pi } ( s ^ { \prime } , a ^ { \prime } | s , a ) = P ( s ^ { \prime } \mid s , a ) \pi ( a ^ { \prime } \mid s ^ { \prime } )$ . In the offline setting, we do not have access to $\tau ^ { \pi }$ ; instead, FQE uses an approximation ${ \hat { \mathcal { T } } } ^ { \pi }$ obtained by replacing $R$ and $P$ in $\mathcal { T } ^ { \pi }$ with estimates $\hat { R }$ and $\hat { P }$ based on $\mathcal { D }$ . Then, we can estimate $Q ^ { \pi }$ by starting from an arbitrary $\hat { Q } ^ { 0 }$ and iteratively computing
53
+
54
+ $$
55
+ \hat { Q } ^ { k + 1 } : = \underset { Q } { \arg \operatorname* { m i n } } \mathcal { L } ( \hat { Q } , \hat { T } ^ { \pi } \hat { Q } ^ { k } ) \quad \mathrm { w h e r e } \quad \mathcal { L } ( Q , Q ^ { \prime } ) = \mathbb { E } _ { \mathcal { D } ( s , a ) } \left[ ( Q ( s , a ) - Q ^ { \prime } ( s , a ) ) ^ { 2 } \right] .
56
+ $$
57
+
58
+ Assuming we search over the space of all possible $Q$ (i.e., do not use function approximation), then the minimizer is $\hat { Q } ^ { k + 1 } = \hat { T } ^ { \pi } \hat { Q } ^ { k }$ , so $\hat { Q } ^ { k } = ( \hat { T } ^ { \pi } ) ^ { k } Q ^ { 0 }$ . If $\hat { \mathcal { T } } ^ { \pi } = \mathcal { T } ^ { \pi }$ , then $\textstyle \operatorname* { l i m } _ { k \to \infty } { \hat { Q } } ^ { k } = Q ^ { \pi }$ .
59
+
60
+ Distributional RL. In distributional RL, the goal is to learn the distribution of the discounted cumulative rewards (i.e., returns) $\boxed { 4 }$ . Given a policy $\pi$ , we denote its return distribution as the random variable $\begin{array} { r } { Z ^ { \pi } ( s , a ) = \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r _ { t } } \end{array}$ , which is a function of a random rollout $\xi \sim D ^ { \pi } ( \cdot \mid s , a )$
61
+
62
+ note that $Z ^ { \pi }$ includes three sources of randomness: (1) the reward $R ( \cdot \mid s , a )$ , (2) the transition $\textstyle P ( \cdot \mid s , a )$ , and (3) the policy $\pi ( \cdot \mid s )$ . Also, note that $Q ^ { \pi } ( s , a ) = \mathbb { E } _ { D ^ { \pi } ( \xi \mid s , a ) } [ Z ^ { \pi } ( s , a ) ]$ . Analogous to $Q$ -function Bellman operator, the distributional Bellman operator for $\pi$ is
63
+
64
+ $$
65
+ \begin{array} { r } { { \mathcal T } ^ { \pi } Z ( s , a ) : = r + \gamma Z ( s ^ { \prime } , a ^ { \prime } ) \quad \mathrm { w h e r e } \quad r \sim R ( \cdot \mid s , a ) , s ^ { \prime } \sim P ( \cdot \mid s , a ) , a ^ { \prime } \sim \pi ( \cdot \mid s ^ { \prime } ) , } \end{array}
66
+ $$
67
+
68
+ where $\underline { { \underline { { D } } } }$ indicates equality in distribution. As with $Q ^ { \pi } , Z ^ { \pi }$ is the unique fixed point of $\mathcal { T } ^ { \pi }$ in Eq. 1. Next, let $F _ { Z ( s , a ) } ( x ) : [ V _ { \mathrm { m i n } } , V _ { \mathrm { m a x } } ] \to [ 0 , 1 ]$ be the cumulative density function (CDF) for return distribution $Z ( s , a )$ , and $F _ { R ( s , a ) }$ be the CDF of $R ( \cdot \mid s , a )$ Then, we have the following equality, which captures how the distributional Bellman operator $\tau ^ { \pi }$ operates on the CDF $F _ { Z ( s , a ) }$ [17]:
69
+
70
+ $$
71
+ F _ { \mathcal { T } ^ { \pi } Z ( s , a ) } ( x ) = \sum _ { s ^ { \prime } , a ^ { \prime } } P ^ { \pi } ( s ^ { \prime } , a ^ { \prime } \mid s , a ) \int F _ { Z ( s ^ { \prime } , a ^ { \prime } ) } \left( \frac { x - r } { \gamma } \right) d F _ { R ( s , a ) } ( r ) .
72
+ $$
73
+
74
+ Let $X$ and $Y$ be two random variables. Then, the quantile function (i.e., inverse CDF) $F _ { X } ^ { - 1 }$ of $X$ is $F _ { X } ^ { - 1 } ( \tau ) : = \operatorname* { i n f } \{ x \in \mathbb { R } \mid \tau \leq F _ { X } ( x ) \} .$ , and the $p$ -Wasserstein distance between $X$ and $Y$ is $\begin{array} { r } { W _ { p } ( X , Y ) = ( \int _ { 0 } ^ { 1 } \lvert F _ { Y } ^ { - 1 } ( \tau ) - F _ { X } ^ { - 1 } ( \tau ) \rvert ^ { p } d \tau ) ^ { 1 / p } } \end{array}$ . Then, the distributional Bellman operator $\mathcal { T } ^ { \pi }$ is a $\gamma$ -contraction in the $W _ { p }$ [4]—i.e., letting $\begin{array} { r } { \bar { d } _ { p } ( Z _ { 1 } , Z _ { 2 } ) : = \operatorname* { s u p } _ { s , a } W _ { p } ( Z _ { 1 } ( s , a ) , Z _ { 2 } ( s , a ) ) } \end{array}$ be the largest Wasserstein distance over $( s , a )$ , and $\mathcal { Z } = \{ Z : \mathcal { S } \times \mathcal { A } \to \mathcal { P } ( \mathbb { R } ) \ | \ \forall ( s , a ) \ . \mathbb { E } [ | Z ( s , a ) | ^ { p } ] < \infty \}$ be the space of distributions over $\mathbb { R }$ with bounded $p$ -th moment, then
75
+
76
+ $$
77
+ \bar { d } _ { p } ( \mathcal { T } ^ { \pi } Z _ { 1 } , \mathcal { T } ^ { \pi } Z _ { 2 } ) \leq \gamma \bar { d } _ { p } ( Z _ { 1 } , Z _ { 2 } ) \qquad ( \forall Z _ { 1 } , Z _ { 2 } \in \mathcal { Z } ) .
78
+ $$
79
+
80
+ As a result, $Z ^ { \pi }$ may be obtained by iteratively applying $\tau ^ { \pi }$ to an initial distribution $Z$ .
81
+
82
+ As before, in the offline setting, we can approximate $\tau ^ { \pi }$ by ${ \hat { \tau } } ^ { \pi }$ using $\mathcal { D }$ . Then, we can compute $Z ^ { \pi }$ (represented as $F _ { Z ( s , a ) } ^ { - 1 }$ ; see below) by starting from an arbitrary ${ \hat { Z } } ^ { 0 }$ , and iteratively computing
83
+
84
+ $$
85
+ \hat { Z } ^ { k + 1 } = \underset { Z } { \arg \operatorname* { m i n } } \mathcal { L } _ { p } ( Z , \hat { T } ^ { \pi } \hat { Z } ^ { k } ) \quad \mathrm { w h e r e } \quad \mathcal { L } _ { p } ( Z , Z ^ { \prime } ) = \mathbb { E } _ { \mathcal { D } ( s , a ) } \left[ W _ { p } ( Z ( s , a ) , Z ^ { \prime } ( s , a ) ) ^ { p } \right] .
86
+ $$
87
+
88
+ We call this procedure fitted distributional evaluation $( F D E )$ .
89
+
90
+ One distributional RL algorithmic framework is quantile-based distributional RL [7, 6, 47, 27, 38, 43], where the return distribution $Z$ is represented by its quantile function $F _ { Z ( s , a ) } ^ { - 1 } ( \tau ) : [ 0 , 1 ] \to \mathbb { R }$ . Given a distribution $g ( \tau )$ over $[ 0 , 1 ]$ , the distorted expectation of $Z$ is $\begin{array} { r } { \Phi _ { g } ( Z ( s , a ) ) = \int _ { 0 } ^ { 1 } F _ { Z ( s , a ) } ^ { - 1 } ( \tau ) g ( \tau ) d \tau } \end{array}$ , and the corresponding policy is $\begin{array} { r } { \pi _ { g } ( s ) : = \arg \operatorname* { m a x } _ { a } \Phi _ { g } ( Z ( s , a ) ) } \end{array}$ [7]. If $g = \mathrm { U n i f o r m } ( [ 0 , 1 ] )$ , then $Q ^ { \pi } ( s , a ) = \bar { \Phi _ { g } } ( Z ( s , \bar { a } ) )$ ; alternatively, $g = \operatorname { U n i f o r m } ( [ 0 , \xi ] )$ corresponds to the CVaR [35, 5, 6] objective, where only the bottom $\xi$ -percentile of the return is considered. Additional risk-sensitive objectives are also compatible. For example, CPW $\pmb { \mathbb { \mathbb { \mathbb { \mathbb { \mathbb { \Psi } } } } } }$ amounts to $g ( \tau ) = \tau ^ { \beta } / ( \tau ^ { \beta } + ( 1 - \tau ) ^ { \beta } ) ^ { \frac { 1 } { \beta } }$ , and Wang $\boxed { 4 5 }$ has $g ( \tau ) = F _ { \cal N } ( F _ { \cal N } ^ { - 1 } ( \tau ) + \beta )$ , where $F _ { \mathcal { N } }$ is the standard Gaussian CDF.
91
+
92
+ A drawback of FDE is that it does not account for estimation error, especially for pairs $( s , a )$ that rarely appear in the given dataset $\mathcal { D }$ ; thus, $\hat { Z } ^ { k } ( s , a )$ may be an overestimate of $Z ^ { k } ( s , a )$ [12, 20, 21], even in distributional RL (since the learned distribution does not include randomness in the dataset) $\boxed { 1 4 } \boxed { 3 }$ . Importantly, since we act by optimizing with respect to $\hat { Z } ^ { k } ( s , a )$ , the optimization algorithm will exploit these errors, biasing towards actions with higher uncertainty, which is the opposite of what is desired. In Section $\textcircled { 3 }$ we propose and analyze a penalty designed to avoid this issue.
93
+
94
+ # 3 Conservative offline distributional policy evaluation
95
+
96
+ We describe our algorithm for computing a conservative estimate of $Z ^ { \pi } ( s , a )$ , and provide theoretical guarantees for finite MDPs. In particular, we modify Eq. 4 to include a penalty term:
97
+
98
+ $$
99
+ \tilde { Z } ^ { k + 1 } = \underset { Z } { \arg \operatorname* { m i n } } \alpha \cdot \mathbb { E } _ { U ( \tau ) , \mathcal { D } ( s , a ) } \left[ c _ { 0 } ( s , a ) \cdot F _ { Z ( s , a ) } ^ { - 1 } ( \tau ) \right] + \mathcal { L } _ { p } ( Z , \hat { T } ^ { \pi } \tilde { Z } ^ { k } )
100
+ $$
101
+
102
+ for some state-action dependent scale factor $c _ { 0 }$ ; here, $U = \mathrm { U n i f o r m } ( [ 0 , 1 ] )$ . This objective adapts the conservative penalty in prior work $\left[ 2 1 \right]$ to the distributional RL setting; in particular, the first term in the objective is a penalty that aims to shrink the quantile values for out-of-distribution (OOD) actions compared to those of in-distribution actions; intuitively, $c _ { 0 } ( s , a )$ should be larger for OOD actions. For now, we let $c _ { 0 }$ be arbitrary; we describe our choice in Section 4. $\alpha \in \mathbb { R } _ { > 0 }$ is a hyperparameter controlling the magnitude of the penalty term with respect to the usual FDE objective. We call this iterative algorithm conservative distribution evaluation $( C D E )$ .
103
+
104
+ ![](images/818c7e37b648f95f76603f525bd2bbdf997d895493501e11bf9b97c1ce6624f1.jpg)
105
+ Figure 2: Overview of our theoretical results.
106
+
107
+ Next, we analyze theoretical properties of CDE in the setting of finite MDPs; Figure 2 overviews these results. First, we prove that CDE iteratively obtains conservative quantile estimates (Lemma 3.4) and defines a contraction operator on return distributions (Lemma $\textcircled { 3 . 5 }$ Then, our main result (Theorem $\boxed { 3 . 6 }$ is that CDE converges to a fixed point $\tilde { Z } ^ { \pi }$ whose quantile function lower bounds that of the true returns $Z ^ { \pi }$ . We also prove that CDE is gap-expanding (Theorem $3 . 8 )$ —i.e., it is more conservative for actions that are rare in $\mathcal { D }$ . These results translate to RL objectives computed by integrating the return quantiles, including expected and CVaR returns (Corollaries 3.7 & 3.9).
108
+
109
+ We begin by describing our assumptions on the MDP and dataset. First, we assume that our dataset $\mathcal { D }$ has nonzero coverage of all actions for states in the dataset $[ \sqrt { 2 3 } , \sqrt { 2 1 } ]$ .
110
+
111
+ Assumption 3.1. For all $s \in \mathcal { D }$ and $a \in { \mathcal { A } }$ , we have ${ \hat { \pi } } _ { \beta } ( a \mid s ) > 0$
112
+
113
+ This assumption is only needed by our theoretical analysis to avoid division-by-zero and ensure that all estimates are well-defined; alternatively, we could assign a very low value ${ \hat { \pi } } _ { \beta } ( a \mid s ) : = \epsilon$ for all actions not visited at state $s$ in the offline dataset and renormalize ${ \hat { \pi } } _ { \beta } ( a \mid s )$ accordingly. Next, we impose regularity conditions on the fixed point $Z ^ { \pi }$ of the distributional Bellman operator $\mathcal { T } ^ { \pi }$ .
114
+
115
+ Assumption 3.2. For all $s \in S$ and $a \in { \mathcal { A } }$ , $F _ { Z ^ { \pi } \left( s , a \right) }$ is smooth. Furthermore, there exists $\zeta \in \mathbb { R } _ { > 0 }$ such that for all $s \in S$ and $a \in { \mathcal { A } }$ , $F _ { Z ^ { \pi } \left( s , a \right) }$ is $\zeta$ -strongly monotone—i.e., we have $F _ { Z ^ { \pi } ( s , a ) } ^ { \prime } ( x ) \geq \zeta$
116
+
117
+ The smoothness assumption ensures that the $p$ th moments of $Z ^ { \pi } ( s , a )$ are bounded (since $Z ^ { \pi } \in \mathbf { \pi }$ $[ V _ { \operatorname* { m i n } } , V _ { \operatorname* { m a x } } ]$ is also bounded), whnsure convergence of n ensures that . Next, we assu $Z ^ { \pi } \in { \mathcal { Z } }$ . The monotonicitthe search space in sumption is includes all $F _ { Z ^ { \pi } \left( s , a \right) } ^ { - 1 } .$ $( 5 )$ possible functions (i.e., no function approximation).
118
+
119
+ Assumption 3.3. The search space of the minimum over $Z$ in $( 5 )$ is over all smooth functions $F _ { Z ( s , a ) }$ (for all $s \in S$ and $a \in { \mathcal { A } }$ ) with support on $[ V _ { \operatorname* { m i n } } , V _ { \operatorname* { m a x } } ]$ .
120
+
121
+ This assumption is required for us to analytically characterize the solution $\tilde { Z } ^ { k + 1 }$ of the CDE objective.
122
+ Finally, we also assume $p > 1$ (i.e., we use the $p$ -Wasserstein distance for some $p > 1$ ).
123
+
124
+ Now, we describe our key results. Our first result characterizes the CDE iterates $\tilde { Z } ^ { k + 1 }$ ; importantly, if $c _ { 0 } ( s , a ) > 0$ , then these iterates encode successively more conservative quantile estimates.
125
+
126
+ Lemma 3.4. For all $s \in \mathcal { D }$ , $a \in \mathcal { A } , k \in \mathbb { N } .$ , and $\tau \in [ 0 , 1 ]$ , we have
127
+
128
+ $$
129
+ F _ { \tilde { Z } ^ { k + 1 } ( s , a ) } ^ { - 1 } ( \tau ) = F _ { \tilde { T } ^ { \pi } \tilde { Z } ^ { k } ( s , a ) } ^ { - 1 } ( \tau ) - c ( s , a ) \ w h e r e \ c ( s , a ) = | \alpha p ^ { - 1 } c _ { 0 } ( s , a ) | ^ { 1 / ( p - 1 ) } \cdot \mathrm { s i g n } ( c _ { 0 } ( s , a ) ) .
130
+ $$
131
+
132
+ We give a proof in Appendix $\mathbf { A . l } ;$ roughly speaking, it follows by setting the gradient of $\textcircled{5}$ equal to zero, relying on results from the calculus of variations to handle the fact that $\stackrel { - } { F } _ { Z \left( s , a \right) } ^ { - 1 }$ is a function.
133
+
134
+ Next, we define the CDE operator $\tilde { \mathcal { T } } ^ { \pi } = \mathcal { O } _ { c } \hat { \mathcal { T } } ^ { \pi }$ to be the composition of ${ \hat { \mathcal { T } } } ^ { \pi }$ with the shift operator $\mathcal { O } _ { c } : \mathcal { Z } \mathcal { Z }$ defined by $F _ { \mathcal { O } _ { c } Z ( s , a ) } ^ { - 1 } ( \tau ) = F _ { Z ( s , a ) } ^ { - 1 } ( \tau ) - c ( s , a )$ T; thus, Lemma 3.4 says $\tilde { Z } ^ { k + \bar { 1 } } = \tilde { T } ^ { \pi } \tilde { Z } ^ { k }$ . Now, we show that $\tilde { \tau } ^ { \pi }$ is a contraction in the maximum Wasserstein distance $\bar { d } _ { p }$ .
135
+
136
+ Lemma 3.5. $\tilde { \mathcal { T } } ^ { \pi }$ is a $\gamma$ -contraction in $\bar { d } _ { p }$ , so $\tilde { Z } ^ { k }$ converges to a unique fixed point $\tilde { Z } ^ { \pi }$
137
+
138
+ The first part follows since ${ \hat { \mathcal { T } } } ^ { \pi }$ is a $\gamma$ -contraction in $\bar { d } _ { p }$ [4, $\textcircled { 7 }$ , and $\mathcal { O } _ { c }$ is a non-expansion in $\bar { d } _ { p }$ , so by composition, $\tilde { \mathcal { T } } ^ { \pi }$ is a $\gamma$ -contraction in $\bar { d } _ { p }$ ; the second follows by the Banach fixed point theorem.
139
+
140
+ Now, our first main theorem says that the fixed point $\tilde { Z } ^ { \pi }$ of $\tilde { \mathcal { T } } ^ { \pi }$ is a conservative estimate of $Z ^ { \pi }$ at all quantiles $\tau$ —i.e., CDE computes quantile estimates that lower bound the quantiles of the true return; furthermore, it says that this lower bound is tight.
141
+
142
+ Theorem 3.6. For any $\delta \in \mathbb { R } _ { > 0 }$ , $c _ { 0 } ( s , a ) > 0$ , with probability at least $1 - \delta$ ,
143
+
144
+ $$
145
+ \begin{array} { r l } & { F _ { Z ^ { \pi } ( s , a ) } ^ { - 1 } ( \tau ) \geq F _ { \tilde { Z } ^ { \pi } ( s , a ) } ^ { - 1 } ( \tau ) + ( 1 - \gamma ) ^ { - 1 } \underset { s ^ { \prime } , a ^ { \prime } } { \operatorname* { m i n } } \{ c ( s ^ { \prime } , a ^ { \prime } ) - \Delta ( s ^ { \prime } , a ^ { \prime } ) \} , } \\ & { F _ { Z ^ { \pi } ( s , a ) } ^ { - 1 } ( \tau ) \leq F _ { \tilde { Z } ^ { \pi } ( s , a ) } ^ { - 1 } ( \tau ) + ( 1 - \gamma ) ^ { - 1 } \underset { s ^ { \prime } , a ^ { \prime } } { \operatorname* { m a x } } \{ c ( s ^ { \prime } , a ^ { \prime } ) - \Delta ( s ^ { \prime } , a ^ { \prime } ) \} } \end{array}
146
+ $$
147
+
148
+ for all sufficie $s \in \mathcal { D }$ $a \in { \mathcal { A } } ,$ $\tau \in [ 0 , 1 ]$ $\begin{array} { r } { \Delta ( s , a ) = \frac { 1 } { \zeta } \sqrt { \frac { 5 | S | } { n ( s , a ) } \log \frac { 4 | S | | A | } { \delta } } } \end{array}$ rmore, for . $\alpha$ ntly large (i.e., ↵ maxs,a{ p·(s,a)p1c (s,a) } $F _ { Z ^ { \pi } ( s , a ) } ^ { - 1 } ( \tau ) \geq F _ { \tilde { Z } ^ { \pi } ( s , a ) } ^ { - 1 } ( \tau ) .$
149
+
150
+ We give a proof in Appendix $\boxed { \mathbf { A . 2 } }$ The first inequality says that the quantile estimates computed by CDE form a lower bound on the true quantiles; this bound is not vacuous as long as $\alpha$ satisfies the given condition. Furthermore, the second inequality states that this lower bound is tight.
151
+
152
+ Many RL objectives (e.g., expected or CVaR return) are distorted expectations (i.e, integrals of the return quantiles). We can extend Theorem $3 . 6$ to obtain conservative estimates for all such objectives:
153
+
154
+ Corollary 3.7. For any $\delta \in \mathbb { R } _ { > 0 }$ , $c _ { 0 } ( s , a ) > 0$ , $\alpha$ sufficiently large, and $g ( \tau )$ , with probability at least $1 - \delta$ , for all $s \in \mathcal { D }$ , $a \in { \mathcal { A } }$ , we have $\Phi _ { g } ( Z ^ { \pi } ( s , a ) ) \geq \Phi _ { g } ( \tilde { Z } ^ { \pi } ( s , a ) )$ .
155
+
156
+ Choosing $g = { \mathrm { U n i f o r m } } ( [ 0 , 1 ] )$ gives $Q ^ { \pi } ( s , a ) \geq \tilde { Q } ^ { \pi } ( s , a ) .$ —i.e., a lower bound on the $Q$ -function. CQL $\pmb { \mathbb { Z } } 1 \mathbf { l }$ obtains a similar lower-bound; thus, CDE generalizes CQL to other objectives—e.g., it can be used in conjunction with any distorted expectation objective (e.g., CVaR, Wang, CPW, etc.) for risk-sensitive offline RL.
157
+
158
+ Note that Theorem $\boxed { 3 . 6 }$ does not preclude the possibility that the lower bounds are more conservative for good actions (i.e., ones for which $\hat { \pi } _ { \beta } ( a \mid \bar { s } )$ is larger). We prove that under the choice1
159
+
160
+ $$
161
+ c _ { 0 } ( s , a ) = { \frac { \mu ( a \mid s ) - { \hat { \pi } } _ { \beta } ( a \mid s ) } { { \hat { \pi } } _ { \beta } ( a \mid s ) } }
162
+ $$
163
+
164
+ for some $\mu ( a \mid s ) \neq { \hat { \pi } } _ { \beta } ( a \mid s )$ , then $\tilde { \mathcal { T } } ^ { \pi }$ is gap-expanding—i.e., the difference in quantile values between in-distribution and out-of-distribution actions is larger under $\tilde { \tau } ^ { \pi }$ than under $\mathcal { T } ^ { \pi }$ . Intuitively, $c _ { 0 } ( s , a )$ is large for actions $a$ with higher probability under $\mu$ than under $\hat { \pi } _ { \beta }$ (i.e., an OOD action).
165
+
166
+ Theorem 3.8. For $p = 2$ , $\alpha$ sufficiently large, and $c _ { 0 }$ as in $( ^ { \dag } )$ , for all $s \in S$ and $\tau \in [ 0 , 1 ]$ ,
167
+
168
+ $$
169
+ \begin{array} { r } { \mathbb { E } _ { \hat { \pi } _ { \beta } ( a \vert s ) } F _ { \tilde { Z } ^ { \pi } ( s , a ) } ^ { - 1 } ( \tau ) - \mathbb { E } _ { \mu ( a \vert s ) } F _ { \tilde { Z } ^ { \pi } ( s , a ) } ^ { - 1 } ( \tau ) \geq \mathbb { E } _ { \hat { \pi } _ { \beta } ( a \vert s ) } F _ { Z ^ { \pi } ( s , a ) } ^ { - 1 } ( \tau ) - \mathbb { E } _ { \mu ( a \vert s ) } F _ { Z ^ { \pi } ( s , a ) } ^ { - 1 } ( \tau ) . } \end{array}
170
+ $$
171
+
172
+ As before, the gap-expansion property implies gap-expansion of integrals of the quantiles—i.e.:
173
+
174
+ Corollary 3.9. For $p = 2$ , $\alpha$ sufficiently large, $c _ { 0 }$ as in $\textcircled { 6 }$ , and any $g ( \tau )$ , for all $s \in S$
175
+
176
+ $$
177
+ \begin{array} { r } { \mathbb { E } _ { \hat { \pi } _ { \beta } ( a | s ) } \Phi _ { g } \big ( \tilde { Z } ^ { \pi } ( s , a ) \big ) - \mathbb { E } _ { \mu ( a | s ) } \Phi _ { g } \big ( \tilde { Z } ^ { \pi } ( s , a ) \big ) \geq \mathbb { E } _ { \hat { \pi } _ { \beta } ( a | s ) } \Phi _ { g } \big ( Z ^ { \pi } ( s , a ) \big ) - \mathbb { E } _ { \mu ( a | s ) } \Phi _ { g } \big ( Z ^ { \pi } ( s , a ) \big ) . } \end{array}
178
+ $$
179
+
180
+ Together, Corollaries $\underline { { \boldsymbol { \left| 3 . 7 \right| } } } \& \boxed { 3 . 9 }$ say that CDE provides conservative lower bounds on the return quantiles while being less conservative for in-distribution actions.
181
+
182
+ Finally, we briefly discuss the condition on $\alpha$ in Theorems $3 . 6 \ : \& \ : 3 . 8 .$ In general, $\alpha$ can be taken to be small as long as $\Delta ( s , a )$ is small for all $s \in S$ and $a \in { \mathcal { A } }$ , which in turn holds as long as $n ( s , a )$ is large—i.e., the dataset $\mathcal { D }$ has wide coverage.
183
+
184
+ ![](images/142f1926c99155859d31045ab575b1c477b26a6df08a0856e9ab15d348af434e.jpg)
185
+ Figure 3: 2D visualization of evaluation trajectories on the Risky PointMass environment. The red region is risky, the solid blue circles indicate initial states, and the blue lines are trajectories. CODAC-C is the only algorithm that successfully avoids the risky region.
186
+
187
+ # 4 Conservative offline distributional actor critic
188
+
189
+ Next, we incorporate the distributional evaluation algorithm in Section 3 into an actor-critic framework. Following $\overrightarrow { \vert 2 1 \vert }$ , we propose a min-max objective where the inner loop chooses the current policy to maximize the CDE objective, and the outer loop minimizes the CDE objective for this policy:
190
+
191
+ $$
192
+ \hat { Z } ^ { k + 1 } = \underset { Z } { \arg \operatorname* { m i n } } \underset { \mu } { \operatorname* { m a x } } \left\{ \alpha \cdot \mathbb { E } _ { U ( \tau ) } \left[ \mathbb { E } _ { \mathcal { D } ( s ) , \mu ( a \mid s ) } F _ { Z ( s , a ) } ^ { - 1 } ( \tau ) - \mathbb { E } _ { \mathcal { D } ( s , a ) } F _ { Z ( s , a ) } ^ { - 1 } ( \tau ) \right] + \mathcal { L } _ { p } ( Z , \hat { T } ^ { \pi ^ { k } } \hat { Z } ^ { k } ) \right\}
193
+ $$
194
+
195
+ where we have used $c _ { 0 }$ as in $^ { ( 6 ) }$ . We can interpret $\mu$ as an actor policy, the first term as the objective for $\mu$ , and the overall objective as an actor-critic algorithm $\textcircled { 8 }$ . In this framework, a natural choice for $\mu$ is a maximum entropy policy $\mu ( a \mid s ) \propto \exp ( Q ( s , a ) )$ [49]. Then, our objective becomes
196
+
197
+ $$
198
+ ^ { \mathrm { ~ 1 ~ } } = \arg \operatorname* { m i n } _ { Z } \left\{ \alpha \cdot \mathbb { E } _ { U ( \tau ) } \left[ \mathbb { E } _ { \mathcal { D } ( s ) } \log \sum _ { a } \exp ( F _ { Z ( s , a ) } ^ { - 1 } ( \tau ) ) - \mathbb { E } _ { \mathcal { D } ( s , a ) } F _ { Z ( s , a ) } ^ { - 1 } ( \tau ) \right] + \mathcal { L } _ { p } ( Z , \hat { T } ^ { \pi ^ { k } } \hat { Z } ^ { k } ) \right\} ,
199
+ $$
200
+
201
+ where $U = { \mathrm { U n i f o r m } } ( [ 0 , 1 ] )$ ; we provide a derivation in Appendix B. We call this strategy conservative offline distributional actor critic (CODAC). To optimize over $Z$ , we represent the quantile function as a DNN $G _ { \theta } ( \tau ; s , a ) \approx F _ { Z ( s , a ) } ^ { - 1 } ( \tau )$ . The main challenge is optimizing the term $\mathcal { L } _ { p } ( Z , \hat { T } ^ { \pi } \hat { Z } ^ { k } ) = W _ { p } ( Z , \hat { T } ^ { \pi } \hat { Z } ^ { k } ) ^ { p }$ . We do so using distributional temporal-differences (TD) [6]. For a sample $( s , a , r , s ^ { \prime } ) \tilde { } \sim \mathcal { D }$ and $\smash { \dot { a ^ { \prime } } \sim \pi ( \cdot \mid s ^ { \prime } ) }$ and random quantiles $\tau , \tau ^ { \prime } \sim U$ , we have
202
+
203
+ $$
204
+ \mathcal { L } _ { p } ( Z , \hat { \mathcal { T } } ^ { \pi } \hat { Z } ^ { k } ) \approx \mathcal { L } _ { \kappa } ( \delta ; \tau ) \qquad \mathrm { w h e r e } \qquad \delta = r + \gamma G _ { \theta ^ { \prime } } ( \tau ^ { \prime } ; s ^ { \prime } , a ^ { \prime } ) - G _ { \theta } ( \tau ; s , a ) .
205
+ $$
206
+
207
+ Here, $\delta$ is the distributional TD error, $\theta ^ { \prime }$ are the parameters of the target $Q$ -network $\pmb { \Vert 3 0 }$ , and
208
+
209
+ $$
210
+ \mathcal { L } _ { \kappa } ( \delta ; \tau ) = \left\{ \begin{array} { l l } { | \tau - \mathbb { 1 } ( \delta < 0 ) | \cdot \delta ^ { 2 } / ( 2 \kappa ) } & { \mathrm { i f ~ } | \delta | \leq \kappa } \\ { | \tau - \mathbb { 1 } ( \delta < 0 ) | \cdot ( | \delta | - \kappa / 2 ) } & { \mathrm { o t h e r w i s e } \ . } \end{array} \right.
211
+ $$
212
+
213
+ is the $\tau$ -Huber quantile regression loss at threshold $\kappa$ [15]; then, $\mathbb { E } _ { U ( \tau ) } \mathcal { L } _ { \kappa } ( \delta ; \tau )$ is an unbiased estimator of the Wasserstein distance that can be optimized using stochastic gradient descent (SGD) $\boxed { 1 9 }$ . With this strategy, our overall objective can be optimized using any off-policy actorcritic method $\pm \boxed { 1 3 } \boxed { 1 1 }$ ; we use distributional soft actor-critic (DSAC) $| \widetilde { | 2 7 | }$ , which replaces the $Q$ -network in SAC $\textcircled { 1 3 } \textcircled { }$ with a quantile distributional critic network $\perp \parallel$ . We provide the full CODAC pseudocode in Algorithm 1 of Appendix B.
214
+
215
+ # 5 Experiments
216
+
217
+ We show that CODAC achieves state-of-the-art results on both risk-sensitive (Sections 5.1 &5.2) and risk-neutral (Section 5.3) offline RL tasks, including our risky robot navigation and D4RL [10] We also show that our lower bound (Theorem $\underline { { \overline { { 3 . 6 } } } }$ and gap-expansion (Theorem $\boxed { 3 . 8 }$ results approximately hold in practice, (Section 5.4), validating our theory on CODAC’s effectiveness. We provide additional details (e.g., environment descriptions, hyperparameters, and additional results) in Appendix C.
218
+
219
+ # 5.1 Risky robot navigation
220
+
221
+ Table 1: Risky robot navigation quantitative evaluation. CODAC-C achieves the best performance on most metrics and is the only method that learns risk-averse behavior. This table is reproduced with standard deviations in Table 6 in Appendix C.
222
+
223
+ <table><tr><td rowspan="2">Algorithm</td><td colspan="4">Risky PointMass</td><td colspan="4">Risky Ant</td></tr><tr><td>Mean</td><td>Median</td><td>CVaR0.1</td><td>Violations</td><td>Mean</td><td>Median</td><td>CVaRo.1</td><td>Violations</td></tr><tr><td>DSAC (Online)</td><td>-7.69</td><td>-3.82</td><td>-49.9</td><td>94</td><td>-866.1</td><td>-833.3</td><td>-1422.7</td><td>2247</td></tr><tr><td>CODAC-C (Ours)</td><td>-6.05</td><td>-4.89</td><td>-14.73</td><td>0.0</td><td>-456.0</td><td>-433.4</td><td>-686.6</td><td>347.8</td></tr><tr><td>CODAC-N (Ours)</td><td>-8.60</td><td>-4.05</td><td>-51.96</td><td>108.3</td><td>-432.7</td><td>-395.1</td><td>-847.1</td><td>936.0</td></tr><tr><td>ORAAC</td><td>-10.67</td><td>-4.55</td><td>-64.12</td><td>138.7</td><td>-788.1</td><td>-795.3</td><td>-1247.2</td><td>1196</td></tr><tr><td>CQL</td><td>-7.51</td><td>-4.18</td><td>-43.44</td><td>93.4</td><td>-967.8</td><td>-858.5</td><td>-1887.3</td><td>1854.3</td></tr></table>
224
+
225
+ Tasks. We consider an Ant robot whose goal is to navigate from a random initial state to the green circle as quickly as possible (see Figure 4 for a visualization). Passing through the red circle triggers a high cost with small probability, introducing risk. A risk-neutral agent may pass through the red region, but a risk-aware agent should not. We also consider a PointMass variant for illustrative purposes.
226
+
227
+ ![](images/e1bc4e34e6fe671f4b34cffd4d482a7b0d2b35ae1cb7e759adcf766b3b556726.jpg)
228
+ Figure 4: Risky Ant.
229
+
230
+ We construct an offline dataset that is the replay buffer of a riskneutral distributional SAC $\lVert 2 7 \rVert$ agent. Intuitively, this choice matches the practical goals of offline RL, where data is gathered from a diverse range of sources with no assumptions on their quality and risk tolerance levels. [23] See Appendix C.1 for details on the environments and datasets.
231
+
232
+ Approaches. We consider two variants of CODAC: (i) CODAC-N, which maximizes the expected return and (ii) CODAC-C, which optimizes the $\mathrm { C V a R } _ { 0 . 1 }$ objective. We compare to Offline RiskAverse Actor Critic (ORAAC) $\boxed { \boxplus 3 }$ , a state-of-the-art offline risk-averse RL algorithm that combines a distributional critic with an imitation-learning based policy to optimize a risk-sensitive objective, and to Conservative Q-Learning (CQL) [21], a state-of-art offline RL algorithm that is non-distributional.
233
+
234
+ Results. We evaluate each approach using 100 test episodes, reporting the mean, median, and $\mathrm { C V a R } _ { 0 . 1 }$ (i.e., average over bottom 10 episodes) returns, and the total number of violations (i.e., time steps spent inside the risky region), all averaged over 5 random seeds. We also report the performance of the online DSAC agent used to collect data. See Appendix C for details. Results are in Table 1.
235
+
236
+ Performance of CODAC. CODAC-C consistently outperforms the other approaches on the $\mathrm { C V a R } _ { 0 . 1 }$ return, as well as the number of violations, demonstrating that CODAC-C is able to avoid risky actions. It is also competitive in terms of mean return due to its high $\mathrm { C V a R } _ { 0 . 1 }$ performance, but performs slightly worse on median return, since it is not designed to optimize this objective. Remarkably, on Risky PointMass, CODAC-C learns a safe policy that completely avoids the risky region (i.e., zero violations), even though such behavior is absent in the dataset. In Appendix $\underline { { \mathbf { \overline { { C . 1 } } } } }$ we also show that CODAC can successfully optimize alternative risk-sensitive objectives such as Wang and CPW.
237
+
238
+ Comparison to ORAAC. While ORAAC also optimizes the CVaR objective, it uses imitation learning to regularize the learned policy to stay close to the empirical behavior policy. However, the dataset contains many sub-optimal trajectories generated early in training, and is furthermore risk-neutral. Thus, imitating the behavioral policy encourages poor performance. In practice, a key use of offline RL is to leverage large datasets available for training, and such datasets will rarely consist of data from a single, high-quality behavioral policy. Our results demonstrate that CODAC is significantly better suited to learned in these settings compared to ORAAC.
239
+
240
+ Comparison to CQL. On Risky PointMass, CQL learns a risky policy with poor tail-performance, indicated by its high median performance but low $\mathrm { C V a R } _ { 0 . 1 }$ performance. Interestingly, its mean performance is also poor; intuitively, the mean is highly sensitive to outliers that may not be present in the training dataset. On Risky Ant, possibly due to the added challenge of high-dimensionality, CQL performs poorly on all metrics, failing to reach the goal and to avoid the risky region. As expected, these results show that accounting for risk is necessary in risky environments.
241
+
242
+ Qualitative analysis. In Figure 3, we show the 100 evaluation rollouts from each policy on Risky PointMass. As can be seen, CODAC-C extrapolates a safe policy that distances itself from the risky region before proceeding to the goal; in contrast, all other agents traverse the risky region. For Ant, we include plots of the trajectories of trained agents in Appendix C.1, and videos in the supplement.
243
+
244
+ Table 2: D4RL results. CODAC achieves the best overall performance in both risk-sensitive (Left) and risk-neutral (Right) variants of the benchmark. These tables are reproduced with standard deviations in Tables 7 & 9 in Appendix C.
245
+
246
+ <table><tr><td rowspan="2"></td><td rowspan="2">Algorithm</td><td colspan="2">Medium</td><td colspan="2">Mixed</td></tr><tr><td>Mean</td><td>CVaR0.1</td><td>Mean</td><td>CVaR0.1</td></tr><tr><td>Ceeeca</td><td>CQL</td><td>33.2</td><td>-15.0</td><td>214.1</td><td>12.0</td></tr><tr><td></td><td>ORAAC</td><td>361.4</td><td>91.3</td><td>307.1</td><td>118.9</td></tr><tr><td></td><td>CODAC-N</td><td>338</td><td>-41</td><td>347.7</td><td>149.2</td></tr><tr><td></td><td>CODAC-C</td><td>335</td><td>-27</td><td>396.4</td><td>238.5</td></tr><tr><td>Jaddoh</td><td>CQL</td><td>877.9</td><td>693.0</td><td>189.2</td><td>-21.4</td></tr><tr><td></td><td>ORAAC</td><td>1007.1</td><td>767.6</td><td>876.3</td><td>524.9</td></tr><tr><td></td><td>CODAC-N</td><td>993.7</td><td>952.5</td><td>1483.9</td><td>1457.6</td></tr><tr><td></td><td>CODAC-C</td><td>1014.0</td><td>976.4</td><td>1551.2</td><td>1449.6</td></tr><tr><td>Aaaaka</td><td>CQL</td><td>1524.3</td><td>1343.8</td><td>74.3</td><td>-64.0</td></tr><tr><td></td><td>ORAAC</td><td>1134.1</td><td>663.0</td><td>222.0</td><td>-69.6</td></tr><tr><td></td><td>CODAC-N</td><td>1537.3</td><td>1158.8</td><td>358.7</td><td>106.4</td></tr><tr><td></td><td>CODAC-C</td><td>1120.8</td><td>902.3</td><td>450.0</td><td>261.4</td></tr></table>
247
+
248
+ <table><tr><td>Dataset</td><td>BCQ</td><td>MOPO</td><td>CQL</td><td>ORAAC</td><td>CODAC</td></tr><tr><td>halfcheetah-random</td><td>2.2</td><td>35.4</td><td>35.4</td><td>13.5</td><td>34.6</td></tr><tr><td>hopper-random</td><td>10.6</td><td>11.7</td><td>10.8</td><td>9.8</td><td>11.0</td></tr><tr><td>walker2d-random</td><td>4.9</td><td>13.6</td><td>7.0</td><td>3.2</td><td>18.7</td></tr><tr><td>halfcheetah-medium</td><td>40.7</td><td>42.3</td><td>44.4</td><td>41.0</td><td>46.3</td></tr><tr><td>walker2d-medium</td><td>53.1</td><td>17.8</td><td>79.2</td><td>27.3</td><td>82.0</td></tr><tr><td>hopper-medium</td><td>54.5</td><td>28.0</td><td>58.0</td><td>1.48</td><td>70.8</td></tr><tr><td>halfcheetah-mixed</td><td>38.2</td><td>53.1</td><td>46.2</td><td>30.0</td><td>44.1</td></tr><tr><td>hopper-mixed</td><td>33.1</td><td>67.5</td><td>48.6</td><td>16.3</td><td>100.2</td></tr><tr><td>walker2d-mixed</td><td>15.0</td><td>39.0</td><td>26.7</td><td>28</td><td>33.2</td></tr><tr><td>halfcheetah-med-exp</td><td>64.7</td><td>63.3</td><td>62.4</td><td>24.0</td><td>70.4</td></tr><tr><td>walker2d-med-exp</td><td>57.5</td><td>44.6</td><td>98.7</td><td>28.2</td><td>106.0</td></tr><tr><td>hopper-med-exp</td><td>110.9</td><td>23.7</td><td>111.0</td><td>18.2</td><td>112.0</td></tr></table>
249
+
250
+ # 5.2 Risk-sensitive D4RL
251
+
252
+ Tasks. Next, we consider stochastic D4RL $\boxed { 4 3 }$ . The original D4RL benchmark $\pmb { \mathbb { I O } }$ consists of datasets collected by SAC agents of varying performance (Mixed, Medium, and Expert) on the Hopper, Walker2d, and HalfCheetah MuJoCo environments $\pmb { \mathbb { E } } \mathbf { \overline { { 4 D } } }$ ; stochastic D4RL relabels the rewards to represent stochastic robot damage for behaviors such as unnatural gaits or high velocities; see Appendix $\boxed { C . 2 }$ The Expert dataset consists of rollouts from a fixed SAC agent trained to convergence; the Medium dataset is constructed the same way except the agent is trained to only achieve $50 \%$ of the expert agent’s return. The Mixed dataset is the replay buffer of the Medium agent.
253
+
254
+ Results. In Table $\bigstar$ (Left), we report the mean and $\mathrm { C V a R } _ { 0 . 1 }$ returns on test episodes from each approach, averaged over 5 random seeds. We show results on the Expert dataset in Appendix $\underline { { \vec { \mathbf { C } . 2 } } }$ CODAC still achieves the strongest performance. As can be seen, CODAC-C and CODAC-N outperform both CQL and ORAAC on most datasets. Surprisingly, CODAC-N is quite effective on the $\mathrm { C V a R } _ { 0 . 1 }$ metric despite its risk-neutral objective; a likely explanation is that for these datasets, mean and CVaR performance are highly correlated. Furthermore, we observe that directly optimizing CVaR may lead to unstable training, potentially since CVaR estimates have higher variance. This instability occurs for both CODAC-C and ORAAC—on Walker2d-Medium, they perform worse than the risk-neutral algorithms. Overall, CODAC-C outperforms CODAC-N in terms of $\mathrm { C V a R } _ { 0 . 1 }$ on about half of the datasets, and often improves mean performance as well. Next, while ORAAC is generally effective on Medium datasets, it performs poorly on Mixed datasets; these results mirror the ones in Section $\boxed { 5 . 1 }$ Finally, CQL’s performance varies drastically across datasets; we hypothesize that learning the full distribution helps stabilize training in CODAC. In Appendix C.2, we also qualitatively analyze the behavior learned by CODAC compared to the baselines, demonstrating that the better CVaR performance CODAC obtains indeed translates to safer locomotion behaviors.
255
+
256
+ # 5.3 Risk-neutral D4RL
257
+
258
+ Task. Next, we show that CODAC is effective even when the goal is to optimize the standard expected return. To this end, we evaluate CODAC-N on the popular D4RL Mujoco benchmark [10].
259
+
260
+ Baselines. We compare to state-of-art algorithms benchmarked in [10] and $\pm 8 \mathbb { I }$ , including BatchConstrained Q-Learning (BCQ), Model-Based Offline Policy Optimization (MOPO) $\pm \boxed { 4 8 }$ , and CQL. We also include ORAAC as an offline distributional RL baseline. We have omitted less competitive baselines included in $\pmb { \mathbb { I O } }$ from the main text; a full comparison is included in Appendix C.3.
261
+
262
+ Results. Results for non-distributional approaches are directly taken from $\boxed { 1 0 }$ ; for ORAAC and CODAC, we evaluate them using 10 test episodes in the environment, averaged over 5 random seeds. As shown in Table 2 (Right), CODAC achieves strong performance across all 12 datasets, obtaining state-of-art results on 5 datasets (walker2d-random, hopper-medium, hopper-mixed, halfcheetahmedium-expert, and walker2d-medium-expert), demonstrating that performance improvements from distributional learning also apply in the offline setting. Note that CODAC’s advantage is not solely due to distributional RL—ORAAC also uses distributional RL, but in most cases underperforms prior state-of-the-art, These results suggest that CODAC’s use of a conservative penalty is critical for it to achieve strong performance.
263
+
264
+ # 5.4 Analysis of Theoretical Insights
265
+
266
+ We perform additional experiments to validate that our theoretical insights in Section $\textcircled { 3 }$ hold in practice, suggesting that they help explain CODAC’s empirical performance.
267
+
268
+ Table 3: Monte-Carlo estimate vs. critic prediction. The CODACpredicted expected and $\mathrm { C V a R } _ { 0 . 1 }$ return is a lower bound on a MC estimate of the true value.
269
+
270
+ <table><tr><td rowspan="2">Regular</td><td colspan="2">Walker2d-Medium</td><td colspan="2">Walker2d-Mixed</td><td colspan="2">Walker2d-Medium-Expert</td></tr><tr><td>MC Return</td><td>Q-Estimate</td><td>MC Return</td><td>Q-Estimate</td><td>MC Return</td><td>Q-Estimate</td></tr><tr><td>CODAC</td><td>240.2</td><td>55.7</td><td>127.1</td><td>97.6</td><td>370.</td><td>39.7</td></tr><tr><td>CQL</td><td>247.2</td><td>53.0</td><td>124.5</td><td>-45.2</td><td>369.7</td><td>116.4</td></tr><tr><td>ORAAC</td><td>245.2</td><td>302.2</td><td>118.2</td><td>7.70×105</td><td>68.2</td><td>322.2</td></tr><tr><td>Stochastic</td><td>Walker2d-Medium MC CVaR0.1</td><td>Z-Estimate</td><td>Walker2d-Mixed MC CVaR0.1</td><td>Z-Estimate</td><td>Walker2d-Medium-Expert MC CVaR0.1</td><td>Z-Estimate</td></tr><tr><td>CODAC</td><td>185.7</td><td>204.2</td><td>85.6</td><td>59.9</td><td>265.3</td><td>-127.8</td></tr><tr><td>ORAAC</td><td>201.9</td><td>367.6</td><td>50.9</td><td>1.54×106</td><td>199.5</td><td>343.5</td></tr></table>
271
+
272
+ Lower bound. We show that in practice, CODAC obtains conservative estimates of the $Q$ and CVaR objectives across different dataset
273
+
274
+ types (i.e., Medium vs. Mixed vs. Medium-Expert). Given an initial state $s _ { 0 }$ , we obtain a Monte Carlo (MC) estimate of $Q$ and CVaR for $( s _ { 0 } , \pi ( s _ { 0 } ) )$ based on sampled rollouts from $s _ { 0 }$ , and compare them to the values predicted by the critic. In Table $\triangledown$ we show results averaged over 10 random $s _ { 0 }$ and with $1 0 0 \mathrm { M C }$ samples for each $s _ { 0 }$ . CODAC obtains conservative estimates for both $Q$ and $\mathrm { C V a R }$ ; in contrast, ORAAC overestimates these values, especially on Mixed datasets, and CQL only obtains conservative estimates for $Q$ , not CVaR.
275
+
276
+ Gap-Expansion. Next, we verify that CODAC’s quantile estimates expand their gap between in-distribution and out-of-distribution actions. We use the D4RL
277
+
278
+ Table 4: Gap-expansion: CODAC expands the quantile gap and obtains higher returns than an ablation without the conservative penalty.
279
+
280
+ <table><tr><td rowspan="2"></td><td colspan="2">HalfCheetah-Medium-Expert</td><td rowspan="2">Hopper-Medium-Expert Positive Gap %</td><td rowspan="2">Return</td><td colspan="2">Walker2d-Medium-Expert</td></tr><tr><td>Positive Gap %</td><td>Return</td><td>Positive Gap %</td><td>Return</td></tr><tr><td>CODAC</td><td>95.3</td><td>93.6</td><td>91.3</td><td>111.9</td><td>91.1</td><td>111.3</td></tr><tr><td>CODAC w.o. Penalty</td><td>4.7</td><td>12.1</td><td>8.7</td><td>25.8</td><td>8.9</td><td>5.9</td></tr></table>
281
+
282
+ Medium-Expert datasets where CODAC uniformly performs well, making them ideal for understanding the source of CODAC’s empirical performance. We train “CODAC w.o. Penalty”, a non-conservative variant of CODAC (i.e., $\alpha = 0$ ), and use its actor as $\mu$ and its critic as $F _ { Z ^ { \pi } } ^ { - 1 }$ . Next, for each dataset, we randomly sample 1000 state-action pairs and 32 quantiles $\tau$ , resulting in 32000 $( s , a , \tau )$ tuples; for each one, we compute the quantile gaps for CODAC and CODAC w.o. Penalty. In Table $\textcircled { 4 }$ we show the percentage of tuples where each CODAC variant has a larger quantile gap, along with their average return. As can be seen, CODAC has a larger gap for more than $9 0 \%$ of the tuples on all datasets, as well as significantly higher returns. These results show that gap-expansion holds in practice and suggest that it helps CODAC achieve good performance.
283
+
284
+ # 6 Conclusion
285
+
286
+ We have introduced Conservative Offline Distributional Actor-Critic (CODAC), a general purpose offline distributional reinforcement learning algorithm. We have proven that CODAC obtains conservative estimates of the return quantile, which translate into lower bounds on $Q$ and CVaR values. In our experiments, CODAC outperforms prior approaches on both stochastic, risk-sensitive offline RL benchmarks, as well as traditional, risk-neutral benchmarks.
287
+
288
+ One limitation of our work is that CODAC has hyperparameters that must be tuned (in particular, the penalty magnitude $\alpha$ ). As in prior work, we choose these hyperparameters by evaluate online rollouts in the environment. Designing better hyperparameter selection strategies for offline RL is an important direction for future work. Finally, we do not foresee any societal impacts or ethical concerns for our work, other than the usual risks around algorithms for improving robotics capabilities.
289
+
290
+ # Acknowledgments and Disclosure of Funding
291
+
292
+ This work is funded in part by an Amazon Research Award, gift funding from NEC Laboratories America, NSF Award CCF-1910769, and ARO Award W911NF-20-1-0080. The U.S. Government is authorized to reproduce and distribute reprints for Government purposes notwithstanding any copyright notation herein.
293
+
294
+ # References
295
+
296
+ [1] Rishabh Agarwal, Dale Schuurmans, and Mohammad Norouzi. An optimistic perspective on offline reinforcement learning. In International Conference on Machine Learning, pages 104–114. PMLR, 2020.
297
+ [2] Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
298
+ [3] Gabriel Barth-Maron, Matthew W Hoffman, David Budden, Will Dabney, Dan Horgan, Dhruva Tb, Alistair Muldal, Nicolas Heess, and Timothy Lillicrap. Distributed distributional deterministic policy gradients. arXiv preprint arXiv:1804.08617, 2018.
299
+ [4] Marc G Bellemare, Will Dabney, and Rémi Munos. A distributional perspective on reinforcement learning. In International Conference on Machine Learning, pages 449–458. PMLR, 2017.
300
+ [5] Yinlam Chow, Mohammad Ghavamzadeh, Lucas Janson, and Marco Pavone. Risk-constrained reinforcement learning with percentile risk criteria. The Journal of Machine Learning Research, 18(1):6070–6120, 2017.
301
+ [6] Will Dabney, Georg Ostrovski, David Silver, and Rémi Munos. Implicit quantile networks for distributional reinforcement learning. In International conference on machine learning, pages 1096–1105. PMLR, 2018.
302
+ [7] Will Dabney, Mark Rowland, Marc Bellemare, and Rémi Munos. Distributional reinforcement learning with quantile regression. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018.
303
+ [8] Thomas Degris, Martha White, and Richard S Sutton. Off-policy actor-critic. arXiv preprint arXiv:1205.4839, 2012.
304
+ [9] Damien Ernst, Pierre Geurts, and Louis Wehenkel. Tree-based batch mode reinforcement learning. Journal of Machine Learning Research, 6:503–556, 2005.
305
+ [10] Justin Fu, Aviral Kumar, Ofir Nachum, George Tucker, and Sergey Levine. D4rl: Datasets for deep data-driven reinforcement learning. arXiv preprint arXiv:2004.07219, 2020.
306
+ [11] Scott Fujimoto, Herke Hoof, and David Meger. Addressing function approximation error in actor-critic methods. In International Conference on Machine Learning, pages 1587–1596. PMLR, 2018.
307
+ [12] Scott Fujimoto, David Meger, and Doina Precup. Off-policy deep reinforcement learning without exploration. In International Conference on Machine Learning, pages 2052–2062. PMLR, 2019.
308
+ [13] Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Offpolicy maximum entropy deep reinforcement learning with a stochastic actor. In International Conference on Machine Learning, pages 1861–1870. PMLR, 2018.
309
+ [14] 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 Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018.
310
+ [15] Peter J. Huber. Robust Estimation of a Location Parameter. The Annals of Mathematical Statistics, 35(1):73 – 101, 1964.
311
+ [16] Nan Jiang and Lihong Li. Doubly robust off-policy value evaluation for reinforcement learning, 2016.
312
+ [17] Ramtin Keramati, Christoph Dann, Alex Tamkin, and Emma Brunskill. Being optimistic to be conservative: Quickly learning a cvar policy. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 4436–4443, 2020.
313
+ [18] Rahul Kidambi, Aravind Rajeswaran, Praneeth Netrapalli, and Thorsten Joachims. Morel: Model-based offline reinforcement learning. arXiv preprint arXiv:2005.05951, 2020.
314
+ [19] Roger Koenker and Kevin F Hallock. Quantile regression. Journal of economic perspectives, z15(4):143–156, 2001.
315
+ [20] Aviral Kumar, Justin Fu, George Tucker, and Sergey Levine. Stabilizing off-policy q-learning via bootstrapping error reduction. arXiv preprint arXiv:1906.00949, 2019.
316
+ [21] Aviral Kumar, Aurick Zhou, George Tucker, and Sergey Levine. Conservative q-learning for offline reinforcement learning. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 1179–1191. Curran Associates, Inc., 2020.
317
+ [22] Sascha Lange, Thomas Gabel, and Martin Riedmiller. Batch reinforcement learning. In Reinforcement learning, pages 45–73. Springer, 2012.
318
+ [23] Sergey Levine, Aviral Kumar, George Tucker, and Justin Fu. Offline reinforcement learning: Tutorial, review, and perspectives on open problems. arXiv preprint arXiv:2005.01643, 2020.
319
+ [24] 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.
320
+ [25] Qiang Liu, Lihong Li, Ziyang Tang, and Dengyong Zhou. Breaking the curse of horizon: Infinite-horizon off-policy estimation. arXiv preprint arXiv:1810.12429, 2018.
321
+ [26] Clare Lyle, Marc G Bellemare, and Pablo Samuel Castro. A comparative analysis of expected and distributional reinforcement learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 4504–4511, 2019.
322
+ [27] Xiaoteng Ma, Qiyuan Zhang, Li Xia, Zhengyuan Zhou, Jun Yang, and Qianchuan Zhao. Distributional soft actor critic for risk sensitive learning. arXiv preprint arXiv:2004.14547, 2020.
323
+ [28] 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, pages 1928–1937. PMLR, 2016.
324
+ [29] 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.
325
+ [30] 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.
326
+ [31] Thanh Tang Nguyen, Sunil Gupta, and Svetha Venkatesh. Distributional reinforcement learning via moment matching, 2020.
327
+ [32] Doina Precup. Eligibility traces for off-policy policy evaluation. Computer Science Department Faculty Publication Series, page 80, 2000.
328
+ [33] Martin L Puterman. Markov decision processes: discrete stochastic dynamic programming. John Wiley & Sons, 2014.
329
+ [34] Martin Riedmiller. Neural fitted q iteration–first experiences with a data efficient neural reinforcement learning method. In European Conference on Machine Learning, pages 317–328. Springer, 2005.
330
+ [35] R Tyrrell Rockafellar and Stanislav Uryasev. Conditional value-at-risk for general loss distributions. Journal of banking & finance, 26(7):1443–1471, 2002.
331
+ [36] Mark Rowland, Robert Dadashi, Saurabh Kumar, Rémi Munos, Marc G Bellemare, and Will Dabney. Statistics and samples in distributional reinforcement learning. In International Conference on Machine Learning, pages 5528–5536. PMLR, 2019.
332
+ [37] Simon P. Shen, Yecheng Jason Ma, Omer Gottesman, and Finale Doshi-Velez. State relevance for off-policy evaluation, 2021.
333
+ [38] Yichuan Charlie Tang, Jian Zhang, and Ruslan Salakhutdinov. Worst cases policy gradients. arXiv preprint arXiv:1911.03618, 2019.
334
+ [39] Philip Thomas and Emma Brunskill. Data-efficient off-policy policy evaluation for reinforcement learning. In International Conference on Machine Learning, pages 2139–2148. PMLR, 2016.
335
+ [40] Sebastian Thrun and Anton Schwartz. Issues in using function approximation for reinforcement learning. In Proceedings of the Fourth Connectionist Models Summer School, pages 255–263. Hillsdale, NJ, 1993.
336
+ [41] 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. IEEE, 2012.
337
+ [42] Amos Tversky and Daniel Kahneman. Advances in prospect theory: Cumulative representation of uncertainty. Journal of Risk and uncertainty, 5(4):297–323, 1992.
338
+ [43] Núria Armengol Urpí, Sebastian Curi, and Andreas Krause. Risk-averse offline reinforcement learning. arXiv preprint arXiv:2102.05371, 2021.
339
+ [44] Hado Van Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double q-learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 30, 2016.
340
+ [45] Shaun S Wang. A class of distortion operators for pricing financial and insurance risks. Journal of risk and insurance, pages 15–36, 2000.
341
+ [46] Yifan Wu, George Tucker, and Ofir Nachum. Behavior regularized offline reinforcement learning. arXiv preprint arXiv:1911.11361, 2019.
342
+ [47] Derek Yang, Li Zhao, Zichuan Lin, Tao Qin, Jiang Bian, and Tieyan Liu. Fully parameterized quantile function for distributional reinforcement learning. arXiv preprint arXiv:1911.02140, 2019.
343
+ [48] Tianhe Yu, Garrett Thomas, Lantao Yu, Stefano Ermon, James Y Zou, Sergey Levine, Chelsea Finn, and Tengyu Ma. Mopo: Model-based offline policy optimization. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 14129–14142. Curran Associates, Inc., 2020.
344
+ [49] Brian D Ziebart, Andrew L Maas, J Andrew Bagnell, and Anind K Dey. Maximum entropy inverse reinforcement learning. In Aaai, volume 8, pages 1433–1438. Chicago, IL, USA, 2008.
md/train/aJh-lFL2dFJ21/aJh-lFL2dFJ21.md ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Discriminative Recurrent Sparse Auto-Encoders
2
+
3
+ Jason Tyler Rolfe & Yann LeCun Courant Institute of Mathematical Sciences, New York University 719 Broadway, 12th Floor New York, NY 10003 {rolfe, yann}@cs.nyu.edu
4
+
5
+ # Abstract
6
+
7
+ We present the discriminative recurrent sparse auto-encoder model, comprising a recurrent encoder of rectified linear units, unrolled for a fixed number of iterations, and connected to two linear decoders that reconstruct the input and predict its supervised classification. Training via backpropagation-through-time initially minimizes an unsupervised sparse reconstruction error; the loss function is then augmented with a discriminative term on the supervised classification. The depth implicit in the temporally-unrolled form allows the system to exhibit far more representational power, while keeping the number of trainable parameters fixed.
8
+
9
+ From an initially unstructured network the hidden units differentiate into categorical-units, each of which represents an input prototype with a well-defined class; and part-units representing deformations of these prototypes. The learned organization of the recurrent encoder is hierarchical: part-units are driven directly by the input, whereas the activity of categorical-units builds up over time through interactions with the part-units. Even using a small number of hidden units per layer, discriminative recurrent sparse auto-encoders achieve excellent performance on MNIST.
10
+
11
+ # 1 Introduction
12
+
13
+ Deep networks complement the hierarchical structure in natural data (Bengio, 2009). By breaking complex calculations into many steps, deep networks can gradually build up complicated decision boundaries or input transformations, facilitate the reuse of common substructure, and explicitly compare alternative interpretations of ambiguous input (Lee, Ekanadham, & $\mathrm { N g }$ , 2008; Zeiler, Taylor, & Fergus, 2011). Leveraging these strengths, deep networks have facilitated significant advances in solving sensory problems like visual classification and speech recognition (Dahl, et al., 2012; Hinton, Osindero, & Teh, 2006; Hinton, et al., 2012).
14
+
15
+ Although deep networks have traditionally used independent parameters for each layer, they are equivalent to recurrent networks in which a disjoint set of units is active on each time step. The corresponding representations are sparse, and thus invite the incorporation of powerful techniques from sparse coding (Glorot, Bordes, & Bengio, 2011; Lee, Ekanadham, & Ng, 2008; Olshausen & Field, 1996, 1997; Ranzato, et al., 2006). Recurrence opens the possibility of sharing parameters between successive layers of a deep network.
16
+
17
+ This paper introduces the Discriminative Recurrent Sparse Auto-Encoder model (DrSAE), comprising a recurrent encoder of rectified linear units (ReLU; Coates & Ng, 2011; Glorot, Bordes, & Bengio, 2011; Jarrett, et al., 2009; Nair & Hinton, 2010; Salinas & Abbott, 1996), connected to two linear decoders that reconstruct the input and predict its supervised classification. The recurrent encoder is unrolled in time for a fixed number of iterations, with the input projecting to each resulting layer, and trained using backpropagation-through-time (Rumelhart, et al., 1986). Training initially minimizes an unsupervised sparse reconstruction error; the loss function is then augmented with a discriminative term on the supervised classification. In its temporally-unrolled form, the network can be seen as a deep network, with parameters shared between the hidden layers. The temporal depth allows the system to exhibit far more representational power, while keeping the number of trainable parameters fixed.
18
+
19
+ Interestingly, experiments show that DrSAE does not just discover more discriminative “parts” of the form conventionally produced by sparse coding. Rather, the hidden units spontaneously differentiate into two types: a small number of categorical-units and a larger number of part-units. The categorical-units have decoder bases that look like prototypes of the input classes. They are weakly influenced by the input and activate late in the dynamics as the result of interaction with the part-units. In contrast, the part-units are strongly influenced by the input, and encode small transformations through which the prototypes of categorical-units can be reshaped into the current input. Categorical-units compete with each other through mutual inhibition and cooperate with relevant part-units. This can be interpreted as a representation of the data manifold in which the categoricalunits are points on the manifold, and the part-units are akin to tangent vectors along the manifold.
20
+
21
+ # 1.1 Prior work
22
+
23
+ The encoder architecture of DrSAE is modeled after the Iterative Shrinkage and Threshold Algorithm (ISTA), a proximal method for sparse coding (Chambolle, et al., 1998; Daubechies, Defrise, & De Mol, 2004). Gregor & LeCun (2010) showed that the sparse representations computed by ISTA can be efficiently approximated by a structurally similar encoder with a less restrictive, learned parameterization. Rather than learn to approximate a precomputed optimal sparse code, the LISTA autoencoders of Sprechmann, Bronstein, & Sapiro (2012a,b) are trained to directly minimize the sparse reconstruction loss function. DrSAE extends LISTA autoencoders with a non-negativity constraint, which converts the shrink nonlinearity of LISTA into a rectified linear operator; and introduces a unified classification loss, as previously used in conjunction with traditional sparse coders (Bradley & Bagnell, 2008; Mairal, et al., 2009; Mairal, Bach, & Ponce, 2012) and other autoencoders (Boureau, et al., 2010; Ranzato & Szummer, 2008).
24
+
25
+ DrSAEs resemble the structure of deep sparse rectifier neural networks (Glorot, Bordes, & Bengio, 2011), but differ in that the parameter matrices at each layer are tied (Bengio, BoulangerLewandowski, & Pascanu, 2012), the input projects to all layers, and the outputs are normalized. DrSAEs are also reminiscent of the recurrent neural networks investigated by Bengio & Gingras (1996), but use a different nonlinearity and a heavily regularized loss function. Finally, they are similar to the recurrent networks described by Seung (1998), but have recurrent connections amongst the hidden units, rather than between the hidden units and the input units, and introduce classification and sparsification losses.
26
+
27
+ # 2 Network architecture
28
+
29
+ In the following, we use lower-case bold letters to denote vectors, upper-case bold letters to denote matrices, superscripts to indicate iterative copies of a vector, and subscripts to index the columns (or rows, if explicitly specified by the context) of a matrix or (without boldface) the elements of a vector. We consider discriminative recurrent sparse auto-encoders (DrSAEs) of rectified linear units with the architecture shown in figure 1:
30
+
31
+ $$
32
+ \mathbf { z } ^ { t + 1 } = \operatorname* { m a x } \left( 0 , \mathbf { E } \cdot \mathbf { x } + \mathbf { S } \cdot \mathbf { z } ^ { t } - \mathbf { b } \right)
33
+ $$
34
+
35
+ for $t = 1 , \dots , T$ , where $n$ -dimensional vector $\mathbf { z } ^ { t }$ is the activity of the hidden units at iteration $t$ , $m$ - dimensional vector $\mathbf { x }$ is the input, and $\mathbf { z } ^ { t = 0 } = 0$ . Unlike traditional recurrent autoencoders (Bengio, Boulanger-Lewandowski, & Pascanu, 2012), the input projects to every iteration. We call the $n \times m$ parameter matrix $\mathbf { E }$ the encoding matrix, and the $n \times n$ parameter matrix $\mathbf { S }$ the explaining-away matrix. The $n$ -element parameter vector $\mathbf { b }$ contains a bias term. The parameters also include the $m \times n$ decoding matrix $\mathbf { D }$ and the $l \times n$ classification matrix $\mathbf { C }$ .
36
+
37
+ We pretrain DrSAEs using stochastic gradient descent on the unsupervised loss function
38
+
39
+ $$
40
+ L ^ { U } = \frac { 1 } { 2 } \cdot \left| \left| \mathbf { x } - \mathbf { D } \cdot \mathbf { z } ^ { T } \right| \right| _ { 2 } ^ { 2 } + \lambda \cdot \left| \left| \mathbf { z } ^ { T } \right| \right| _ { 1 } ,
41
+ $$
42
+
43
+ ![](images/1ba60893b6cd95c8d4e0a6060501776e9c9e97a64c1c46b358b1e97dcd45297c.jpg)
44
+ Figure 1: The discriminative recurrent sparse auto-encoder (DrSAE) architecture. $\mathbf { z } ^ { t }$ is the hidden representation after iteration $t$ of $T$ , and is initialized to $\mathbf { z } ^ { 0 } = 0$ ; $\mathbf { x }$ is the input; and $\mathbf { y }$ is the supervised classification. Overbars denote approximations produced by the network, rather than the true input. E, S, D, and $\mathbf { b }$ are learned parameters.
45
+
46
+ with the magnitude of the columns of $\mathbf { D }$ bounded by 1,1 and the magnitude of the rows of $\mathbf { E }$ bounded by $\textstyle { \frac { 1 . 2 5 } { T } }$ .2 We then add in the supervised classification loss function
47
+
48
+ $$
49
+ L ^ { S } = \mathrm { l o g i s t i c } _ { y } \left( \mathbf { C } \cdot \frac { \mathbf { z } ^ { T } } { | | \mathbf { z } ^ { T } | | } \right) ,
50
+ $$
51
+
52
+ where the multinomial logistic loss function is defined by
53
+
54
+ $$
55
+ \mathrm { l o g i s t i c } _ { y } ( { \bf z } ) = z _ { y } - \log \left( \sum _ { i } e ^ { z _ { i } } \right) ,
56
+ $$
57
+
58
+ and $y$ is the index of the desired class.3 Starting with the parameters learned by the unsupervised pretraining, we perform discriminative fine-tune by stochastic gradient descent on $L ^ { U } + \dot { L } ^ { S }$ , with the magnitude of the rows of $\mathbf { C }$ bounded by 5.4 The learning rate of each matrix is scaled down by the number of times it is repeated in the network, and the learning rate of the classification matrix is scaled down by a factor of 5, to keep the effective learning rate consistent amongst the parameter matrices.
59
+
60
+ We train DrSAEs with $T = 1 1$ recurrent iterations (ten nontrivial passes through the explainingaway matrix S)5 and 400 hidden units on the MNIST dataset of $2 8 \times 2 8$ grayscale handwritten digits (LeCun, et al., 1998), with each input normalized to have $\ell _ { 2 }$ magnitude equal to 1. We use a training set of 50,000 elements, and a validation set of 10,000 elements to perform early-stopping. Encoding, decoding, and classification matrices learned via this procedure are depicted in figure 2.
61
+
62
+ The dynamics of equation 1 are inspired by the Learned Iterative Shrinkage and Thresholding Algorithm (LISTA) (Gregor & LeCun, 2010), an efficient approximation to the sparse coding Iterative Shrinkage and Threshold Algorithm (ISTA) (Chambolle, et al., 1998; Daubechies, Defrise, & De
63
+
64
+ ![](images/6b685c9769fce56001f6d528bf3ecefa5b6271c57437781fdad6c1b1ecbf80c4.jpg)
65
+ Figure 2: The hidden units differentiate into spatially localized part-units, which have well-aligned encoders and decoders; and global prototype categorical-units, which have poorly aligned encoders and decoders. A subset of the rows of encoding matrix $\mathbf { E }$ (a) and the columns of decoding matrix D (b), and all rows of the classification matrix $\mathbf { C }$ (c) after training. The first row of (a,b) shows the most categorical units; the last row contains the least categorical units; and the middle row evenly steps through the remaining units in order of categoricalness. Gray pixels denote connections with weight 0; darker pixels indicate more positive connections.
66
+
67
+ Mol, 2004). ISTA is an algorithm for minimizing the $\ell _ { 1 }$ -regularized reconstruction loss function $L ^ { U }$ of equation 2 with respect to ${ \mathbf z } ^ { T }$ . It is defined by the iterative step
68
+
69
+ $$
70
+ { \bf z } ^ { t + 1 } = h _ { \alpha \cdot \lambda } \left( \alpha \cdot { \bf D } ^ { \top } \cdot { \bf x } + \left( { \bf I } - \alpha \cdot { \bf D } ^ { \top } \cdot { \bf D } \right) \cdot { \bf z } ^ { t } \right) ,
71
+ $$
72
+
73
+ where $\left[ h _ { \theta } ( \mathbf { x } ) \right] _ { i } = { \mathrm { s i g n } } \left( x _ { i } \right) \cdot { \mathrm { m a x } } \left( 0 , | x _ { i } | - \theta \right)$ and $\alpha$ is a small step-size parameter. With nonnegative units, ISTA is equivalent to projected gradient descent of $L ^ { U }$ of equation 2. As the number of iterations $T \to \infty$ , a DrSAE defined by equation 1 becomes a non-negative version of ISTA if it satisfies the restrictions:
74
+
75
+ $$
76
+ { \bf E } = \alpha \cdot { \bf D } ^ { \top } , \qquad { \bf S } = { \bf I } - \alpha \cdot { \bf D } ^ { \top } \cdot { \bf D } , \qquad b _ { i } = \alpha \cdot \lambda , \quad \mathrm { ~ a n d ~ } \quad z _ { i } ^ { t } \geq 0 ,
77
+ $$
78
+
79
+ where the positive scale factor $\alpha$ is less than the maximal eigenvalue of $\mathbf { D } ^ { \top } \cdot \mathbf { D }$ , and $\mathbf { I }$ is the $n \times n$ identity matrix.
80
+
81
+ As in LISTA, but unlike ISTA, the encoding matrix $\mathbf { E }$ and explaining-away matrix S in a DrSAE are independent of the decoding matrix $\mathbf { D }$ . Connections from the input to the hidden units, and recurrent connections between the hidden units, are all-to-all, so the network structure is agnostic to permutations of the input. DrSAEs can also be understood as deep, feedforward networks with the parameter matrices tied between the layers.
82
+
83
+ # 3 Analysis of the hidden unit representation
84
+
85
+ Discriminative fine-tuning naturally induces the hidden units of a DrSAE to differentiate into a hierarchy-like continuum. On one extreme are part-units, which perform an ISTA-like sparse coding computation; on the other are categorical-units, which use a sophisticated form of pooling to integrate over matching part-units, and implement winner-take-all dynamics amongst themselves. Converging lines of evidence indicate that these two groups use distinct computational mechanisms and serve different representational roles.
86
+
87
+ In the ISTA algorithm, each row of the encoding matrix $\mathbf { E } _ { i }$ (which we sometimes call the encoder of unit $i$ ) is proportional to the corresponding column of the decoding matrix $\mathbf { D } _ { i }$ (which we call the decoder of unit $i$ ), and each row $( \mathbf { S } - \mathbf { I } ) _ { i }$ is proportional to $\left( \mathbf { D } _ { i } \right) ^ { \top } \cdot \bar { \mathbf { D } }$ , as in equation 4. As a result, the angle between $\mathbf { E } _ { i }$ and $\mathbf { D } _ { i }$ , and the angle between the rows of $\mathbf { S } - \mathbf { I }$ and $\mathbf { D } ^ { \top } \cdot \mathbf { D }$ , are both simple measures of the degree to which a unit’s dynamics follow the ISTA algorithm, and thus perform sparse coding.6 These quantities are equal to 0 in the case of perfect ISTA, and grow larger as the network diverges from ISTA. Of these two angles, the explaining-away matrix comparison is more difficult to interpret, since a distortion of any one unit’s decoding column $\mathbf { D } _ { i }$ will affect all rows of $\mathbf { D } ^ { \top } \cdot \mathbf { D }$ , whereas the angle between the encoder row $\mathbf { E } _ { i }$ and decoder column $\mathbf { D } _ { i }$ only depends upon a single unit. For this reason, we use the angle between the encoder row and decoder column as a measure of the position of each unit on the part/categorical continuum.
88
+
89
+ ![](images/86af5b007186604e48419daa5cda075306d95ffc27e1b7c5feb6c357aa149449.jpg)
90
+ Figure 3: The hidden units differentiate into two populations after discriminative fine-tuning. The magnitude of row $( \mathbf { S } - \mathbf { I } ) _ { i }$ (a,b,e) and $\mathbf { C } _ { i }$ (c,d), versus the angle between encoder row and decoder column, for each unit from networks using 11 (a,c,e) and 2 (b,d,f) iterations. All plots are from discriminatively fine-tuned networks except (a,b), which are only subject to unsupervised pretraining. We call the dense cloud in the bottom-left part-units, and the tail extending to the top-right categorical-units.
91
+
92
+ Figure 3 plots, for each unit $i$ , the magnitude of row $( \mathbf { S } - \mathbf { I } ) _ { i }$ and column $\mathbf { C } _ { i }$ , versus the angle between row $\mathbf { E } _ { i }$ and column $\mathbf { D } _ { i }$ . Before discriminative fine-tuning, there are no categorical-units; the angle between the encoder row and decoder column is small and the incoming recurrent connections are weak for all units, as in figure 3(a,b). After discriminative fine-tuning, there remains a dense cloud of points for which the angle between the encoder row and decoder column is very small, and the incoming recurrent and outgoing classification connections are weak. Abutting this is an extended tail of points that have a larger angle between the encoder row and decoder column, and stronger incoming recurrent and outgoing classification connections. We call units composing the dense cloud part-units, since they have ISTA-compatible connections, while we refer to those making up the extended tail as categorical-units, since they have strong connections to the classification output.7 When trained on MNIST, part-units have localized, pen stroke-like decoders, as can be seen in the bottom rows of figure 2(a,b). Categorical-units, in contrast, tend to have whole-digit prototype-like decoders, as in the top rows of figure 2(a,b). Discriminative fine-tuning induces the differentiation of categorical-units regardless of the depth of the encoder.
93
+
94
+ # 3.1 Part-units
95
+
96
+ Examination of the relationship between the elements of $\mathbf { S } - \mathbf { I }$ and $\mathbf { D } ^ { \top } \cdot \mathbf { D }$ confirms that partunits with an encoder-decoder angle less than 0.5 radians abide by ISTA, and so perform sparse coding on the residual input after the categorical-unit prototypes are subtracted out. The prominent diagonals with matching slopes in figure 4(a,b), which plot the value of $S _ { i , j } - \delta _ { i , j }$ versus $\mathbf { D } _ { i } \cdot \mathbf { D } _ { j }$ for connections between part-units, and from categorical-units to part-units, respectively, demonstrate that part-units receive ISTA-consistent connections from all units. The fidelity of these connections to the ISTA ideal is not strongly dependent upon whether the afferent units are ISTA-compliant partunits, or ISTA-ignoring categorical-units. As a result, the part-units treat the categorical-units as if they were also participating in the reconstruction of the input, and only attempt to reconstruct the residual input not explained by the categorical-unit prototypes.
97
+
98
+ As can be seen in figure 4(c), the degree to which the encoder conforms to the ISTA algorithm is strongly correlated with the degree to which the explaining-away matrix matches the ISTA algorithm. Figure 5 shows the decoders associated with the strongest recurrent connections to three representative part-units. As expected, the decoders of these afferent units tend to be strongly aligned or anti-aligned with their target’s decoder, and include both part-units and categorical-units.
99
+
100
+ # 3.2 Categorical-units
101
+
102
+ In contrast, the recurrent connections to categorical-units with an encoder-decoder angle greater than 0.7 radians are not strongly correlated with the values predicted by ISTA. Rather than analyzing connections to the categorical-units only based upon their destination, it is more informative to consider them organized by their source. Part-units are compatible with categorical-units of certain classes,8 and not with others, as shown by figure 6(a). Part-units generally have positive connections to categorical-units with parallel prototypes, independent of offset, and negative connections to categorical-units with orthogonal prototypes, as shown in figure 7(a). This corresponds to a sophisticated form of pooling (Jarrett, et al., 2009), with a single categorical-unit drawing excitation from a large collection of parallel but not necessarily perfectly aligned part-units, as in figure 6(c). It is also suggestive of the standard Hubel and Wiesel model of complex cells in primary visual cortex (Hubel & Wiesel, 1962). ISTA would instead predict a connection proportional to the inner product, which is zero for orthogonal prototypes and negative for anti-aligned prototypes.
103
+
104
+ Part-units use sparse coding dynamics, and so are not disproportionately suppressed by categoricalunits that represent any particular class. However, each part-unit is itself compatible with (i.e., has positive connections to) categorical-units of only a subset of the classes. As a result, the categorical
105
+
106
+ ![](images/8a7eda654d6effc337db33920084369f97675c71adbfe73004cec8d0e6a94241.jpg)
107
+ Figure 4: Part-units have connections consistent with ISTA. The actual connection weights $\mathbf { S } - \mathbf { I }$ versus the ISTA-predicted weights $\mathbf { D } ^ { \top } \cdot \mathbf { D }$ , for connections from part-units to part-units (a) and categorical-units to part-units (b); and the angle between the rows of $\mathbf { S } - \mathbf { I }$ and the ISTA-ideal $\mathbf { D } ^ { \top } \cdot \mathbf { D }$ versus the angle between the encoder rows and decoder columns (c). Units are considered part-units if the angle between their encoder and decoder is less than 0.5 radians, and categoricalunits if the angle between their encoder and decoder is greater than 0.7 radians.
108
+
109
+ # Dest Source units
110
+
111
+ ![](images/d8a3bfa30cd4c07193df41cebfa91ff08d99a2b404d8b7c215d515d77c538ad0.jpg)
112
+ Figure 5: Part-units receive ISTA-compatible connections and thus perform sparse coding on the residual input after the contribution of the categorical-units is subtracted out. The decoders of the twenty units with the strongest explaining-away connections $\lvert S _ { i , j } - \delta _ { i , j } \rvert$ to three typical part-units, sorted by connection magnitude. The left-most column depicts the decoder of the recipient partunit. The bars above the decoders in the remaining columns indicate the strength of the connections. Black bars are used for positive connections, and white bars for negative connections.
113
+
114
+ units and thus the class chosen are determined by the part-unit activations. In particular, only a subset of the possible deformations implemented by part-unit decoders are freely available for each prototype, since part-units with a strong negative connection to a categorical-unit will tend to silence it, and so cannot be used to transform the prototype of that categorical-unit.
115
+
116
+ Categorical-units implement winner-take-all-like dynamics amongst themselves, as shown in figure 6(b), with negative connections to most other categorical-units. Positive total self-connections $S _ { i , i }$ facilitate the integration of inputs over time.
117
+
118
+ ![](images/ebdbb5665711a05abd37ab51c84152b10c5ab15ac4729d6fc9f029629ce4d25c.jpg)
119
+
120
+ Dest Source units
121
+
122
+ ![](images/00264b46e1d05b476812510d277021bfc8d82e2cd578be8bbca94e825c6b6ab1.jpg)
123
+ Figure 6: Categorical-units execute a sophisticated form of pooling over part-units, and have winnertake-all dynamics amongst themselves. The decoders of the categorical-units receiving the twenty strongest connections $| \bar { S } _ { i , j } - \delta _ { i , j } |$ from representative part-units (a) and categorical-units (b), and the decoders of the part-units sending the twenty strongest projections to representative categoricalunits (c). The connections are sorted first by the class of their destination, and then by the magnitude of the connection. The left-most column depicts the decoder of the source (a,b) or destination (c) unit. The bars above the decoders in the remaining columns indicate the strength of the connections. Black bars are used for positive connections, and white bars for negative connections.
124
+
125
+ When activated, the categorical-units make a much larger contribution to the reconstruction than any single part-unit, as can be seen in figure 7(b). Since, the projections from categorical-units to part-units are consistent with ISTA, the magnitude of the categorical-unit contribution to the reconstruction need not be tightly regulated. The part-units adjust accordingly to accommodate whatever residual is left by the categorical-units.
126
+
127
+ The units form a rough hierarchy, with part-units on the bottom and categorical-units on the top. Categorical-units receive strong recurrent connections, as shown in figure 3(c,d) implying that their activity is more determined by other hidden units and less by the input (since the magnitude of the input connections is bounded), and thus they are higher in the hierarchy. As shown in figure 7(c), part-units receive most of their input from other part-units; categorical-units receive a larger fraction of their input from other categorical-units. Whereas part-units have well-structured encoders and are generally activated directly by the input on the first iteration, categorical-units are more likely to first achieve a non-zero activation on the second iteration, as shown in figure 7(d), suggesting that they require stimulation from part-units. The immediate response of part-units in contrast to the gradual refinement of categorical-units is apparent in figure 8, which shows the optimal decoding matrix for selected units, inferred from their observed activity at each iteration.
128
+
129
+ # 4 Performance
130
+
131
+ The comparison of MNIST classification performance in table 1 demonstrates the power of the hierarchical representation learned by DrSAEs. Rather than learn to minimize the sum of equations 2 and 3, Gregor & LeCun (2010) train the LISTA encoder to approximate the code generated by a traditional sparse coder. While they do not report classification performance using LISTA, Gregor and LeCun do evaluate MNIST classification error using the related learned coordinate descent algorithm. Sprechmann, Bronstein, & Sapiro (2012a,b) extend this approach by training a LISTA auto-encoder to reconstruct the input directly, using loss functions similar to equation 2. Although they identify the possibility of using regularization dependent upon supervised information, Sprechmann and colleagues do not consider a parameterized classifier operating on a common hidden representation. Instead, they train a separate encoder for each class, and classify each input based upon the encoder with the lowest sparse coding error. DrSAEs significantly outperform these other techniques based upon a LISTA encoder.
132
+
133
+ ![](images/a0d2e3c8660c876eebcb5a3fe4f837795b83af3d5ebb13bac60f723cad7949eb.jpg)
134
+ Figure 7: Statistics of connections indicate the presence of a rough hierarchy, with categorical-units on the top integrating over part-units on the bottom. Average explaining-away connection weight $S _ { i j }$ , binned by alignment between decoders, for connections from part-units to categorical-units (a). If no units fall in a given bin, the average is set to zero. Average final value of a unit $z _ { i } ^ { t = T }$ , given that $z _ { i } ^ { t = T } > 0$ , versus the angle between the encoder row $E _ { i }$ and decoder column $D _ { i }$ (b). Average angle between encoder row $E _ { j }$ and decoder column $D _ { j }$ of afferents to unit $i$ , weighted by the strength of the connection to unit $i$ , versus the angle between encoder row $E _ { i }$ and decoder column $D _ { i }$ (c). Probability that $z _ { i } ^ { 1 } = 0$ and $z _ { i } ^ { 2 } > 0$ , versus the angle between the encoder row $E _ { i }$ and decoder column $D _ { i }$ (d). Average value of the decoder column $\overline { { D _ { i } } }$ versus the angle between the encoder row $E _ { i }$ and the decoder column $D _ { i }$ (e).
135
+
136
+ DrSAEs also perform well compared to other techniques using encoders related to LISTA. Deep sparse rectifier neural networks (Glorot, Bordes, & Bengio, 2011) combine discriminative training with an encoder similar to LISTA, but do not tie the parameters between the layers and only allow the input to project to the first layer. Differentiable sparse coding (Bradley & Bagnell, 2008) and supervised dictionary learning (Mairal, et al., 2009) also train discriminatively, but effectively use an infinite-depth ISTA-like encoder, and are thus much less computationally efficient than DrSAEs. Supervised dictionary learning achieves performance statistically indistinguishable from DrSAEs using a contrastive loss function. A similar technique achieves MNIST classification error as low as $0 . 5 4 \%$ when the dataset is augmented with shifted copies of the inputs (Mairal, Bach, & Ponce, 2012).
137
+
138
+ ![](images/d37ffd9dd4a358263dea0b74a2f56fb4ee0e3c1416987f4e767a6ebf8387ea41.jpg)
139
+ Figure 8: Part-units (a) respond to the input quickly, while the activity of categorical-units (b) refines slowly. Columns of the optimal decoding matrices $\mathbf { D } ^ { t }$ minimizing the input reconstruction error $| | \mathbf { x } - \mathbf { D } ^ { t } \cdot \mathbf { z } ^ { t } | | _ { 2 } ^ { 2 }$ from the hidden representation $\mathbf { z } ^ { t }$ for $t = 1 , \dots , T$ . The first and last columns show the corresponding encoder and decoder for the chosen representative units. Intermediate columns represent successive iterations $t$ .
140
+
141
+ Table 1: MNIST classification error rate $( \% )$ for pixel-permutation-agnostic encoders without boosting-like augmentations. The first column indicates the size of each layer in the specified encoder, separated by hyphens. Exponents specify the number of recurrent iterations; asterisks denote repetition to convergence. $1 0 \times ( \cdots )$ indicates that a separate encoder is trained for each input class; $4 5 \times ( \cdots )$ indicates that a separate encoder is trained for each pairwise binary classification problem. Further performance improvements have been reported with regularization techniques such as dropout, architectures that enforce translation-invariance, and datasets augmented by deformations, as discussed in the main text.
142
+
143
+ <table><tr><td>LISTA auto-encoder,10 × (289-1005) (Sprechmann,Bronstein,&amp; Sapiro,2012a)</td><td></td><td>3.76(5.98 with 289 hidden units)</td></tr><tr><td>Learned coordinate descent, 784-78450-10 (Gregor &amp; LeCun, 2010)</td><td>2.29</td><td></td></tr><tr><td>Differentiable sparse coding,180-256*-10 (Bradley &amp; Bagnell, 2008)</td><td>1.30</td><td>1.20(1.16 with tanh nonlinearity)</td></tr><tr><td>Deep sparse rectifier neural network 784-1000-1000-1000-10 (Glorot, Bordes,&amp; Bengio,2011)</td><td></td><td></td></tr><tr><td>Deep belief network, 784-500-500-2000-10 (Hinton, et al.,2012)</td><td></td><td>1.18(0.92 with dropout)</td></tr><tr><td>Discriminative recurrent sparse auto-encoder1.08(1.21 with 2OO hidden units) 784-40011-10</td><td></td><td></td></tr><tr><td>Supervised dictionary learning, 45 × (784-24*) to 45 × (784-96*) (Mairal, et al., 2009)</td><td></td><td>1.05(3.56 without contrastive loss)</td></tr></table>
144
+
145
+ Additional regularizations and boosting-like techniques can further improve performance of networks with LISTA-like encoders. Recent examples include dropout, which trains and then averages over a large set of random subnetworks formed by removing a constant fraction of the hidden units from the original network (Goodfellow, et al., 2013; Hinton, et al., 2012). Deep belief networks and deep Boltzmann machines fine-tuned with dropout are the current state-of-the-art for pixelpermutation-agnostic handwritten digit recognition (Hinton, et al., 2012), and can achieve MNIST classification error as low as $0 . 7 9 \%$ with a carefully tuned network structure and multi-step training procedure. Deep convex networks, which iteratively refine the classification by successively training a stack of classifiers, with the output of the $i - 1 \mathrm { s t }$ classifier provided as input to the ith classifier, can achieve an MNIST error of $0 . 8 3 \%$ (Deng & Yu, 2011). Regularizing by explicit modeling of the data manifold, and then minimizing the square of the Jacobian of the output along the tangent bundle around the training datapoints, can reduce MNIST error to $0 . 8 1 \%$ (Rifai, et al., 2011). Further performance improvements are possible if translation invariance is built directly into the network via a convolutional architecture, and deformations of the inputs are included in the training set (LeCun, et al., 1998), yielding error as low as $0 . 2 3 \%$ (Ciresan, Meier, & Schmidhuber, 2012). These regularizations and augmentations are potentially compatible with DrSAE, but we defer their exploration to future work.
146
+
147
+ Recurrence is essential to the performance of DrSAEs. If the number of recurrent iterations is decreased from eleven to two, MNIST classification error in a network with 400 hidden units increases from $1 . 0 8 \%$ to $1 . 3 2 \%$ . With only 200 hidden units, MNIST classification error increases from $1 . 2 1 \%$ to $1 . 4 9 \%$ , although the hidden units still differentiate into part-units and categorical-units, as shown in figure 3(d,f).
148
+
149
+ # 5 Discussion
150
+
151
+ It is widely believed that natural stimuli, such as images and sounds, fall near a low-dimensional manifold within a higher-dimensional space (the manifold hypothesis) (Bengio, Courville, & Vincent, 2012; Lee, Pedersen, & Mumford, 2003; Olshausen & Field, 2004). The low-dimensional data manifold provides an intuitively compelling and empirically effective basis for classification (Rifai, et al., 2011; Simard, LeCun, & Denker, 1993; Simard, et al., 1998). The continuous deformations that define the data manifold usually preserve identity, whereas even relatively small invalid transformations may change the class of a stimulus. For instance, the various handwritten renditions of the digit 3 in in the last column of figure 9(c) barely overlap, and so the Euclidean distance between them in pixel space is greater than that to the nearest 8 formed by closing both loops. Nevertheless, smooth deformations of one 3 into another correspond to relatively short trajectories along the data manifold,9 whereas the transformation of a 3 into an 8 requires a much longer path within the data manifold. A prohibitive amount of data is required to fully characterize the data manifold (Narayanan & Mitter, 2010), so it is often approximated by the set of linear submanifolds tangent to the data manifold at the observed datapoints, known as the tangent spaces (Ekanadham, Tranchina, & Simoncelli, 2011; Rifai, et al., 2011; Simard, et al., 1998). DrSAEs naturally and efficiently form a tangent space-like representation, consisting of a point on the data manifold indicated by the categorical-units, and a shift within the tangent space specified by the part-units.
152
+
153
+ Before discriminative fine-tuning, DrSAEs perform a traditional part-based decomposition, familiar from sparse coding, as shown in figure 9(a). The decoding matrix columns are class-independent, local pen strokes, and many units make a comparable, small contribution to the reconstruction. After discriminative fine-tuning, the hidden units differentiate into sparse coding local part-units, and global prototype categorical-units that integrate over them. As shown in figure 9(b,c), the input is decomposed into a prototype, corresponding to a point on the data manifold; and a set of deformations from this prototype along the data manifold, corresponding to shifts within the tangent space. The same prototype can be used for very different inputs, as demonstrated in figure 9(c), since the space of deformations is rich enough to encompass diverse transformations without moving off the data manifold. Even when the prototype is very different from the input, all steps along the reconstruction trajectories in figure 9(b,c) are recognizable as members of the same class.
154
+
155
+ ![](images/815d811883a7548dd70eef919d5830df8c435def4315e0fb608db63af6b1fa8a.jpg)
156
+ Figure 9: Discriminative recurrent sparse auto-encoders decompose the input into a prototype and deformations along the data manifold. The progressive reconstruction of selected inputs by the hidden representation before (a) or after (b,c) discriminative fine-tuning. The columns from left to right depict either the components of the reconstruction (top row of each pair), or the partial reconstruction induced by the first $n$ parts (bottom row of each pair). Parts are added to the reconstruction in order of decreasing contribution magnitude; smoother transformations are possible with an optimized sequence. The last two columns show the final reconstruction with all parts (Fin), and the original input (Inp). Bars above the decoding matrix columns indicate the scale factor/hidden unit activity associated with the column.
157
+
158
+ The prototypes learned by the categorical-units for each class are not simply the average over the elements of the class, as depicted in figure 10. Each class includes many possible input variations, so its average is blurry. The prototypes, in contrast, are sharp, and look like representative elements of the appropriate class. Many categorical-units are available for each class, as shown in figure 6. Not all categorical-units correspond to full prototypes; some capture global transformations of a prototype, such as rotations (Simard, et al., 1998).
159
+
160
+ Consistent with prototypes for the non-negative MNIST inputs, the decoding matrix columns of the categorical-units are generally positive, as shown in figure 7(e). In contrast, the decoders of the part-units are approximately mean-zero and so cannot serve as prototypes themselves. Rather, they shift and transform prototypes, moving activation from one region in the image to another, as demonstrated in figure 9(b,c).
161
+
162
+ ![](images/2cd78929f9980503c60d6401d6a40b3fe114a72ef36523bed79dff855d64bac5.jpg)
163
+ Figure 10: The prototypes learned by categorical-units resemble representative instances of the appropriate class, and are sharper than the average over all members of the class in the dataset. The left-most column in each group depicts the average over all elements of each of the ten MNIST digit classes. The other columns show the decoders of the associated units with the largest-magnitude columns in the classification matrix C. Bars above the decoders indicate the angle between the encoder and the decoder for the displayed unit. The most prototypical unit always makes the strongest contribution to the classification, and has a large (but not necessarily the largest) angle between its encoder and decoder. Some units that make large contributions to the classification represent global transformations, such as rotations, of a prototype (Simard, et al., 1998).
164
+
165
+ Discrepancies between the prototype and the input due to transformations along the data manifold are explained by class-consistent part-units, and only serve to further activate the categorical-units of that class, as in figure 6(a,c). Discrepancies between the prototype and the input due to deformations orthogonal to the data manifold are explained by class-incompatible part-units, and serve to suppress the categorical-units of that class, both directly and via activation of incompatible categorical-units.
166
+
167
+ If the wrong prototype is turned on, the residual input will generally contain substantial unexplained components. Part-units obey ISTA-like dynamics and thus function as a sparse coder on the residual input, so part-units that match the unexplained components of the input will be activated. These partunits will have positive connections to categorical-units with compatible prototypes, and so will tend to activate categorical-units associated with the true class (so long as the unexplained components of the input are diagnostic). The spuriously activated categorical-unit will not be able to sustain its activity, since few compatible part-units will be required to capture the residual input.
168
+
169
+ The classification approach used by DrSAEs is different from one based upon a traditional sparse coding decomposition: it projects into the space of deviations from a prototype, which is not the same as the space of prototype-free parts, as is clear from figure 9(a,b). For instance, a 5 can easily be constructed using the parts of a 6, making it difficult to distinguish the two. Indeed, the first seven progressive reconstruction steps of the 6 in figure 9(a) could just as easily be used to produce a 5. However, starting from a 6 prototype, the parts required to break the bottom loop are outside the data manifold of the 6 class, and so will tend to change the active prototype.
170
+
171
+ DrSAEs naturally learn a hierarchical representation within a recurrent network, thereby implementing a deep network with parameter sharing between the layers.
172
+
173
+ # References
174
+
175
+ Bengio, Y. (2009). Learning deep architectures for AI. Foundations and Trends in Machine Learning, 2(1), 1–127.
176
+ Bengio, Y., Boulanger-Lewandowski, N., & Pascanu, R. (2012). Advances in optimizing recurrent networks. arXiv:1212.0901v2 [cs.LG]
177
+ Bengio, Y., Courville, A., & Vincent, P. (2012). Representation learning: A review and new perspectives. arXiv:1206.5538 [cs.LG]
178
+ Bengio, Y., & Gingras, F. (1996). Recurrent neural networks for missing or asynchronous data. In D. Touretzky, M. Mozer, & M. Hasselmo (Eds.) Advances in Neural Information Processing Systems (NIPS 8) (pp. 395–401).
179
+ Bradley, D. M., & Bagnell, J. A. (2008). Differentiable sparse coding. In D. Koller, D. Schuurmans, Y. Bengio, & L. Bottou (Eds.) Advances in Neural Information Processing Systems (NIPS 21) (pp. 113–120).
180
+ Boureau, Y., Bach, F., LeCun, L., & Ponce, J. (2010). Learning mid-level features for recognition In Proceedings of the 23rd IEEE Conference on Computer Vision and Pattern Recognition (CVPR 2010).
181
+ Chambolle, A., De Vore, R. A., Lee, N. Y., & Lucier, B. J. (1998). Nonlinear wavelet image processing: Variational problems, compression, and noise removal through wavelet shrinkage. IEEE Transactions on Image Processing, 7(3), 319–335.
182
+ Ciresan, D., Meier, U., & Schmidhuber, J. (2012). Multi-column deep neural networks for image classification. In Proceedings of the 25th IEEE Conference on Computer Vision and Pattern Recognition (CVPR 2012) (pp. 3642–3649).
183
+ Coates, A., & Ng, A. Y. (2011). The importance of encoding versus training with sparse coding and vector quantization L. Getoor & T. Scheffer (Eds.) Proceedings of the 28th International Conference on Machine Learning (ICML 2011) (pp. 921–928).
184
+ Dahl, G. E., Yu, D., Deng, L., & Acero, A. (2012). Context-dependent pre-trained deep neural networks for large-vocabulary speech recognition. IEEE Transactions on Audio, Speech, and Language Processing, 20(1), 30–42.
185
+ Daubechies, I., Defrise, M., & De Mol, C. (2004). An iterative thresholding algorithm for linear inverse problems with a sparsity constraint. Communications on Pure and Applied Mathematics, 57(11), 1413–1457.
186
+ Ekanadham, C., Tranchina, D., & Simoncelli, E. P. (2011). Recovery of sparse translation-invariant signals with continuous basis pursuit. IEEE Transactions on Signal Processing, 59(10), 4735– 4744.
187
+ Glorot, X., Bordes, A., & Bengio, Y. (2011). Deep sparse rectifier neural networks. In G. Gordon, D. Dunson, & M. Dudik (Eds.) JMLR W&CP: Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics (AISTATS 2011) (pp. 315–323).
188
+ Goodfellow, I. J., Warde-Farley, D., Mirza, M., Courville, A., & Bengio, Y. (2013). Maxout networks arXiv:1302.4389v3 [stat.ML]
189
+ Gregor, K., & LeCun, Y. (2010). Learning fast approximations of sparse coding. In J. Furnkranz ¨ & T. Joachims (Eds.) Proceedings of the 27th International Conference on Machine Learning (ICML 2010) (pp. 399–406).
190
+ Hinton, G. E., Osindero, S., & Teh, Y. W. (2006). A fast learning algorithm for deep belief nets. Neural Computation, 18(7), 1527–1554.
191
+ Hinton, G. (2010). A practical guide to training restricted Boltzmann machines (UTML TR 2010- 003, version 1). Toronto, Canada: University of Toronto, Department of Computer Science.
192
+ Hinton, G. E., Srivastava, N., Krizhevsky, A., Sutskever, I., & Salakhutdinov, R. R. (2012). Improving neural networks by preventing co-adaptation of feature detectors arXiv:1207.0580v1 [cs.NE]
193
+ Hubel, D. H., & Wiesel, T. N. (1962). Receptive fields, binocular interaction and functional architecture in the cat’s visual cortex. The Journal of Physiology, 160(1), 106–154.
194
+ Jarrett, K., Kavukcuoglu, K., Ranzato, M. A., & LeCun, Y. (2009). What is the best multi-stage architecture for object recognition? In Proceedings of the 12th International Conference on Computer Vision (ICCV 2009) (pp. 2146–2153).
195
+ LeCun, Y., Bottou, L., Bengio, Y., & Haffner, P. (1998). Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11), 2278–2324.
196
+ Lee, A. B., Pedersen, K. S., & Mumford, D. (2003). The nonlinear statistics of high-contrast patches in natural images. International Journal of Computer Vision, 54(1), 83–103.
197
+ Lee, H., Ekanadham, C., & Ng, A. (2008). Sparse deep belief net model for visual area V2. In J. C. Platt, D. Koller, Y. Singer & S. Roweis (Eds.) Advances in Neural Information Processing Systems (NIPS 20), (pp. 873–880).
198
+ Mairal, J., Bach, F., Ponce, J., Sapiro, G., & Zisserman, A. (2009). Supervised dictionary learning. In D. Koller, D. Schuurmans, Y. Bengio, & L. Bottou (Eds.) Advances in Neural Information Processing Systems (NIPS 21) (pp. 1033–1040).
199
+ Mairal, J., Bach, F., & Ponce, J. (2012). Task-driven dictionary learning. IEEE Transactions on Pattern Analysis and Machine Intelligence, 34(4), 791–804.
200
+ Nair, V., & Hinton, G. E. (2010). Rectified linear units improve restricted boltzmann machines. In J. Furnkranz & T. Joachims (Eds.) ¨ Proceedings of the 27th International Conference on Machine Learning (ICML 2010) (pp. 807-814).
201
+ Narayanan, H. & MItter, S. (2010). Sample complexity of testing the manifold hypothesis. In J. Lafferty, C. K. I. Williams, J. Shawe-Taylor, R.S. Zemel, & A. Culotta (Eds.) Advances in Neural Information Processing Systems (NIPS 23) (pp. 1786–1794).
202
+ Olshausen, B. A., & Field, D. J. (1996). Emergence of simple-cell receptive field properties by learning a sparse code for natural images. Nature, 381(6583), 607–609.
203
+ Olshausen, B. A., & Field, D. J. (1997). Sparse coding with an overcomplete basis set: A strategy employed by VI? Vision Research, 37(23), 3311–3326.
204
+ Olshausen, B. A., & Field, D. J. (2004). Sparse coding of sensory inputs. Current opinion in neurobiology, 14(4), 481–487.
205
+ Ranzato M., Poultney, C., Chopra, S., & LeCun, Y. (2006). Efficient learning of sparse representations with an energy-based model. In B. Scholkopf, J. Platt, & T. Hoffman (Eds.) ¨ Advances in Neural Information Processing Systems (NIPS 19), (pp. 1137–1144).
206
+ Ranzato, M., & Szummer, M. (2008). Semi-supervised learning of compact document representations with deep networks In A. McCallum & S. Roweis (Eds.), Proceedings of the 25th Annual International Conference on Machine Learning (ICML 2008) (pp. 792–799).
207
+ Rifai, S., Dauphin, Y., Vincent, P., Bengio, Y., & Muller, X. (2011). The manifold tangent classifier. In J. Shawe-Taylor, R. S. Zemel, P. Bartlett, F. C. N. Pereira, & K. Q. Weinberger (Eds.) Advances in Neural Information Processing Systems (NIPS 24) (pp. 2294–2302).
208
+ Rumelhart, D. E., Hinton, G. E., & Williams, R. J. (1986). Learning internal representations by error propagation. In D. E. Rumelhart, J. L. McClelland, and the PDP Research Group (Eds.), Parallel Distributed Processing: Explorations in the Microstructure of Cognition: Vol. 1. Foundations (pp. 318–362). Cambridge, MA: MIT Press.
209
+ Salinas, E., & Abbott, L. F. (1996). A model of multiplicative neural responses in parietal cortex. Proceedings of the National Academy of Sciences of the United States of America, 93(21), 11956– 11961.
210
+ Seung, H. S. (1998). Learning continuous attractors in recurrent networks. In M. I. Jordan, M. J. Kearns, & S. A. Solla (Eds.) Advances in Neural Information Processing Systems (NIPS 10) (pp. 654–660).
211
+ Simard, P., LeCun, Y., & Denker, J. S. (1993). Efficient pattern recognition using a new transformation distance. In S. J. Hanson, J. D. Cowan, & C. L. Giles (Eds.) Advances in Neural Information Processing Systems (NIPS 5) (pp. 50–58).
212
+ Simard, P., LeCun, Y., Denker, J., & Victorri, B. (1998). Transformation invariance in pattern recognition: Tangent distance and tangent propagation. In G. Orr, & K. Muller (Eds.), Neural networks: Tricks of the trade. Berlin: Springer.
213
+ Sprechmann, P., Bronstein, A., & Sapiro, G. (2012). Learning efficient structured sparse models. In J. Langford & J. Pineau (Eds.) Proceedings of the 29th International Conference on Machine Learning (ICML 12) (pp. 615–622).
214
+ Sprechmann, P., Bronstein, A., & Sapiro, G. (2012). Learning efficient sparse and low rank models. arXiv:1212.3631 [cs.LG]
215
+ Deng, L. & Yu, D. (2011). Deep convex net: A scalable architecture for speech pattern classification. In Proceedings of the 12th Annual Conference of the International Speech Communication Association (INTERSPEECH 2011) (pp. 2285-2288).
216
+ Zeiler, M. D., Taylor, G. W., & Fergus, R. (2011). Adaptive deconvolutional networks for mid and high level feature learning. In Proceedings of the 13th International Conference on Computer Vision (ICCV 2011) (pp. 2018–2025).
md/train/bM3L3I_853/bM3L3I_853.md ADDED
@@ -0,0 +1,304 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ADAFUSE: ADAPTIVE TEMPORAL FUSION NETWORK FOR EFFICIENT ACTION RECOGNITION
2
+
3
+ Yue Meng1∗ Rameswar Panda2,3 Chung-Ching Lin4 Prasanna Sattigeri3 Leonid Karlinsky3 Kate Saenko2,5 Aude Oliva1,2 Rogerio Feris2,3 1Massachusetts Institute of Technology 2MIT-IBM Watson AI Lab 3IBM Research 4Microsoft 5Boston University
4
+
5
+ # ABSTRACT
6
+
7
+ Temporal modelling is the key for efficient video action recognition. While understanding temporal information can improve recognition accuracy for dynamic actions, removing temporal redundancy and reusing past features can significantly save computation leading to efficient action recognition. In this paper, we introduce an adaptive temporal fusion network, called AdaFuse, that dynamically fuses channels from current and past feature maps for strong temporal modelling. Specifically, the necessary information from the historical convolution feature maps is fused with current pruned feature maps with the goal of improving both recognition accuracy and efficiency. In addition, we use a skipping operation to further reduce the computation cost of action recognition. Extensive experiments on Something V1&V2, Jester and Mini-Kinetics show that our approach can achieve about $40 \%$ computation savings with comparable accuracy to state-of-the-art methods. The project page can be found at https://mengyuest.github.io/AdaFuse/
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Over the last few years, video action recognition has made rapid progress with the introduction of a number of large-scale video datasets (Carreira & Zisserman, 2017; Monfort et al., 2018; Goyal et al., 2017). Despite impressive results on commonly used benchmark datasets, efficiency remains a great challenge for many resource constrained applications due to the heavy computational burden of deep Convolutional Neural Network (CNN) models.
12
+
13
+ Motivated by the need of efficiency, extensive studies have been recently conducted that focus on either designing new lightweight architectures (e.g., $\mathrm { R } ( 2 { + } 1 ) \mathrm { D }$ (Tran et al., 2018), S3D (Xie et al., 2018), channel-separated CNNs (Tran et al., 2019)) or selecting salient frames/clips conditioned on the input (Yeung et al., 2016; Wu et al., 2019b; Korbar et al., 2019; Gao et al., 2020). However, most of the existing approaches do not consider the fact that there exists redundancy in CNN features which can significantly save computation leading to more efficient action recognition. In particular, orthogonal to the design of compact models, the computational cost of a CNN model also has much to do with the redundancy of CNN features (Han et al., 2019). Furthermore, the amount of redundancy depends on the dynamics and type of events in the video: A set of still frames for a simple action (e.g. “Sleeping”) will have a higher redundancy comparing to a fast-changed action with rich interaction and deformation (e.g. “Pulling two ends of something so that it gets stretched”). Thus, based on the input we could compute just a subset of features, while the rest of the channels can reuse history feature maps or even be skipped without losing any accuracy, resulting in large computational savings compared to computing all the features at a given CNN layer. Based on this intuition, we present a new perspective for efficient action recognition by adaptively deciding what channels to compute or reuse, on a per instance basis, for recognizing complex actions.
14
+
15
+ In this paper, we propose AdaFuse, an adaptive temporal fusion network that learns a decision policy to dynamically fuse channels from current and history feature maps for efficient action recognition. Specifically, our approach reuses history features when necessary (i.e., dynamically decides which channels to keep, reuse or skip per layer and per instance) with the goal of improving both recognition accuracy and efficiency. As these decisions are discrete and non-differentiable, we rely on a Gumbel Softmax sampling approach (Jang et al., 2016) to learn the policy jointly with the network parameters through standard back-propagation, without resorting to complex reinforcement learning as in (Wu et al., 2019b; Fan et al., 2018; Yeung et al., 2016). We design the loss to achieve both competitive performance and resource efficiency required for action recognition. Extensive experiments on multiple benchmarks show that AdaFuse significantly reduces the computation without accuracy loss.
16
+
17
+ The main contributions of our work are as follows:
18
+
19
+ • We propose a novel approach that automatically determines which channels to keep, reuse or skip per layer and per target instance for efficient action recognition.
20
+ • Our approach is model-agnostic, which allows this to be served as a plugin operation for a wide range of 2D CNN-based action recognition architectures.
21
+ • The overall policy distribution can be seen as an indicator for the dataset characteristic, and the block-level distribution can bring potential guidance for future architecture designs.
22
+ • We conduct extensive experiments on four benchmark datasets (Something-Something V1 (Goyal et al., 2017), Something-Something V2 (Mahdisoltani et al., 2018), Jester (Materzynska et al., 2019) and Mini-Kinetics (Kay et al., 2017)) to demonstrate the superiority of our proposed approach over state-of-the-art methods.
23
+
24
+ # 2 RELATED WORK
25
+
26
+ Action Recognition. Much progress has been made in developing a variety of ways to recognize complex actions, by either applying 2D-CNNs (Karpathy et al., 2014; Wang et al., 2016; Fan et al., 2019) or 3D-CNNs (Tran et al., 2015; Carreira & Zisserman, 2017; Hara et al., 2018). Most successful architectures are usually based on the two-stream model (Simonyan & Zisserman, 2014), processing RGB frames and optical-flow in two separate CNNs with a late fusion in the upper layers (Karpathy et al., 2014) or further combining with other modalities (Asghari-Esfeden et al., 2020; Li et al., 2020a). Another popular approach for CNN-based action recognition is the use of 2D-CNN to extract frame-level features and then model the temporal causality using different aggregation modules such as temporal averaging in TSN (Wang et al., 2016), a bag of features scheme in TRN (Zhou et al., 2018), channel shifting in TSM (Lin et al., 2019), depthwise convolutions in TAM (Fan et al., 2019), non-local neural networks (Wang et al., 2018a), temporal enhancement and interaction module in TEINet (Liu et al., 2020), and LSTMs (Donahue et al., 2015). Many variants of 3D-CNNs such as C3D (Tran et al., 2015; Ji et al., 2013), I3D (Carreira & Zisserman, 2017) and ResNet3D (Hara et al., 2018), that use 3D convolutions to model space and time jointly, have also been introduced for action recognition. SlowFast (Feichtenhofer et al., 2018) employs two pathways to capture temporal information by processing a video at both slow and fast frame rates. Recently, STM (Jiang et al., 2019) proposes new channel-wise convolutional blocks to jointly capture spatio-temporal and motion information in consecutive frames. TEA (Li et al., 2020b) introduces a motion excitation module including multiple temporal aggregation modules to capture both short- and long-range temporal evolution in videos. Gate-Shift networks (Sudhakaran et al., 2020) use spatial gating for spatial-temporal decomposition of 3D kernels in Inception-based architectures.
27
+
28
+ While extensive studies have been conducted in the last few years, limited efforts have been made towards efficient action recognition (Wu et al., 2019b;a; Gao et al., 2020). Specifically, methods for efficient recognition focus on either designing new lightweight architectures that aim to reduce the complexity by decomposing the 3D convolution into 2D spatial convolution and 1D temporal convolution (e.g., $\mathrm { R } ( 2 { + } 1 ) \mathrm { D }$ (Tran et al., 2018), S3D (Xie et al., 2018), channel-separated CNNs (Tran et al., 2019)) or selecting salient frames/clips conditioned on the input (Yeung et al., 2016; Wu et al., 2019b; Korbar et al., 2019; Gao et al., 2020). Our approach is most related to the latter which focuses on conditional computation and is agnostic to the network architecture used for recognizing actions. However, instead of focusing on data sampling, our approach dynamically fuses channels from current and history feature maps to reduce the computation. Furthermore, as feature maps can be redundant or noisy, we use a skipping operation to make it more efficient for action recognition.
29
+
30
+ Conditional Computation. Many conditional computation methods have been recently proposed with the goal of improving computational efficiency (Bengio et al., 2015; 2013; Veit & Belongie, 2018; Wang et al., 2018b; Graves, 2016; Meng et al., 2020; Pan et al., 2021). Several works have been proposed that add decision branches to different layers of CNNs to learn whether to exit the network for faster inference (Figurnov et al., 2017; McGill & Perona, 2017; Wu et al., 2020). BlockDrop (Wu et al., 2018) effectively reduces the inference time by learning to dynamically select which layers to execute per sample during inference. SpotTune (Guo et al., 2019) learns to adaptively route information through finetuned or pre-trained layers. Conditionally parameterized convolutions (Yang et al., 2019) or dynamic convolutions (Chen et al., 2019a; Verelst & Tuytelaars, 2019) have also been proposed to learn specialized convolutional kernels for each example to improve efficiency in image recognition. Our method is also related to recent works on dynamic channel pruning (Gao et al., 2018; Lin et al., 2017) that generate decisions to skip the computation for a subset of output channels. While GaterNet (Chen et al., 2019b) proposes a separate gating network to learn channel-wise binary gates for the backbone network, Channel gating network (Hua et al., 2019) identifies regions in the features that contribute less to the classification result, and skips the computation on a subset of the input channels for these ineffective regions. In contrast to the prior works that focus on only dropping unimportant channels, our proposed approach also reuses history features when necessary to make the network capable for strong temporal modelling.
31
+
32
+ ![](images/a7c02cbc547286d56e1ca47bbc7185e597ef6dbb9ca0fe7a9449a4d8eb37fe39.jpg)
33
+ Figure 1: A conceptual view for adaptive temporal fusion. At time $t$ , the 2D Conv layer computes for those “keep” channels (blue) in feature map $x _ { t }$ , and fuses the "reuse" channels (yellow) from the history feature map $y _ { t - 1 }$ . The downstream 2D Conv layer (not shown here) will process those “reuse” and “keep” channels in $\tilde { y } _ { t }$ . Best viewed in color.
34
+
35
+ # 3 METHODOLOGY
36
+
37
+ In this section, we first show the general approach using 2D-CNN for action recognition. Then we present the concept of adaptive temporal fusion and analyze its computation cost. Finally, we describe the end-to-end optimization and network specifications.
38
+
39
+ Using 2D-CNN for Action Recognition. One popular solution is to first generate frame-wise predictions and then utilize a consensus operation to get the final prediction (Wang et al., 2016). The network takes uniformly sampled $T$ frames $\{ X _ { 1 } . . . X _ { T } \}$ and predicts the un-normalized class score:
40
+
41
+ $$
42
+ P ( X _ { 1 } , . . . , X _ { T } ; \Theta ) = \mathcal { G } \left( \mathcal { F } ( X _ { 1 } ; \Theta ) , \mathcal { F } ( X _ { 2 } ; \Theta ) , . . . , \mathcal { F } ( X _ { T } ; \Theta ) \right)
43
+ $$
44
+
45
+ where $\mathcal { F } ( \cdot ; \Theta )$ is the 2D-CNN with learnable parameters $\Theta$ . The consensus function $\mathcal { G }$ reduces the frame-level predictions to a final prediction. One common practice for $\mathcal { G }$ is the averaging operation.
46
+
47
+ The major drawback is that this cannot capture the order of the frames. The network performs poorly on datasets that contain temporal-related labels (e.g. “turning left”, “moving forward”, etc). LSTM (Hochreiter & Schmidhuber, 1997) can also be used as $\mathcal { G }$ to get the final prediction (Donahue et al., 2015), but it cannot capture low-level features across the frames, as mentioned in Lin et al. (2019). A few works have been recently proposed to model temporal causality using a bag of features scheme in TRN (Zhou et al., 2018), channel shifting in TSM (Lin et al., 2019), depthwise convolutions in TAM (Fan et al., 2019). Different from these methods, in this work, we hypothesis that an inputdependent fusion of framewise features will be beneficial for temporal understanding and efficiency, as the amount of temporal information depends on the dynamics and the type of events in the video. Hence we propose adaptive temporal fusion for action recognition.
48
+
49
+ Adaptive Temporal Fusion. Consider a single 2D convolutional layer: $y _ { t } = \phi ( W _ { x } * x _ { t } + b _ { x } )$ , where $\boldsymbol { x } _ { t } \in \mathbb { R } ^ { c \times h \times w }$ denotes the input feature map at time step $t$ with $c$ channels and spatial dimension $h \times w$ , and $y _ { t } \in \mathbb { R } ^ { c ^ { \prime } \times h ^ { \prime } \times w ^ { \prime } }$ is the output feature map. $\bar { W } _ { x } \in \mathbb { R } ^ { c ^ { \prime } \times k \times k \times c }$ denotes the convolution filters (with kernel size $k \times k )$ ) and $b _ { x } \in \mathbb { R } ^ { c ^ { \prime } }$ is the bias. We use $" * >$ for convolution operation. $\phi ( \cdot )$ is the combination of batchnorm and non-linear functions (e.g. ReLU (Nair & Hinton, 2010)).
50
+
51
+ We introduce a policy network consisting of two fully-connected layers and a ReLU function designed to adaptively select channels for keeping, reusing or skipping. As shown in Figure 1, at time $t$ , we first generate feature vectors $v _ { t - 1 } , v _ { t } \in \mathbb { R } ^ { c }$ from history feature map $x _ { t - 1 }$ and current feature map $x _ { t }$ via global average pooling. Then the policy network predicts:
52
+
53
+ $$
54
+ p _ { t } = g ( v _ { t - 1 } , v _ { t } ; \Theta _ { g } )
55
+ $$
56
+
57
+ where $p _ { t } \in \{ 0 , 1 , 2 \} ^ { c ^ { \prime } }$ is a channel-wise policy (choosing “keep”, “reuse” or “skip”) to generate the output feature map: if $p _ { t } ^ { i } = 0$ , the $i$ -th channel of output feature map will be computed via the normal convolution; if $p _ { t } ^ { i } = 1$ , it will reuse the $i$ -th channel of the feature map $y _ { t - 1 }$ which has been already computed at time $t - 1$ ; otherwise, the $i$ -th channel will be just padded with zeros. Formally, this output feature map can be written as $\tilde { y } _ { t } = f ( y _ { t - 1 } , y _ { t } , p _ { t } )$ where the $i$ -th channel is:
58
+
59
+ $$
60
+ \begin{array} { r } { \tilde { y } _ { t } ^ { i } = \mathbb { 1 } \left[ p _ { t } ^ { i } = 0 \right] \cdot y _ { t } ^ { i } + \mathbb { 1 } \left[ p _ { t } ^ { i } = 1 \right] \cdot y _ { t - 1 } ^ { i } } \end{array}
61
+ $$
62
+
63
+ here $\mathbb { 1 } \left[ \cdot \right]$ is the indicator function. In Figure 1, the policy network instructs the convolution layer to only compute the first and fourth channels, reuses the second channel of the history feature and skips the third channel. Features from varied time steps are adaptively fused along the channel dimension.
64
+
65
+ Adaptive temporal fusion enables the 2D convolution to capture temporal information: its temporal perceptive field grows linearly to the depth of the layers, as more features from different time steps are fused when going deeper in the network. Our novel design can be seen as a general methodology for many state-of-the-art 2D-CNN approaches: if we discard "skip" and use a predefined fixed policy, then it becomes the online temporal fusion in Lin et al. (2019). If the policy only chooses from "skip" and "keep", then it becomes dynamic pruning methods (Gao et al., 2018; Hua et al., 2019). Our design is a generalized approach taking both temporal modelling and efficiency into consideration.
66
+
67
+ Complexity Analysis. To illustrate the efficiency of our framework, we compute the floating point operations (FLOPS), which is a hardware-independent metric and widely used in the field of efficient action recognition1 $\mathrm { W u }$ et al., 2019b; Gao et al., 2020; Meng et al., 2020; Fan et al., 2019). To compute saving from layers before and after the policy network, we add another convolution after $\tilde { y } _ { t }$ with kernel $\bar { W _ { y } } \in \mathbb { R } ^ { c ^ { \prime \prime } \times ^ { \prime } \times k ^ { \prime } \times c ^ { \prime } }$ and bias $b _ { y } \in \mathbb { R } ^ { c ^ { \prime \prime } }$ . The total FLOPS for each convolution will be:
68
+
69
+ $$
70
+ \left\{ \begin{array} { l l } { m _ { x } = c ^ { \prime } \cdot h ^ { \prime } \cdot w ^ { \prime } \cdot \left( k \cdot k \cdot c + 1 \right) } \\ { m _ { y } = c ^ { \prime \prime } \cdot h ^ { \prime \prime } \cdot w ^ { \prime \prime } \cdot \left( k ^ { \prime } \cdot k ^ { \prime } \cdot c ^ { \prime } + 1 \right) } \end{array} \right.
71
+ $$
72
+
73
+ When the policy is applied, only those output channels used in time $t$ or going to be reused in time $t + 1$ need to be computed in the first convolution layer, and only the channels not skipped in time $t$ count for input feature maps for the second convolution layer. Hence the overall FLOPS is:
74
+
75
+ $$
76
+ M = \sum _ { \tau = 0 } ^ { T - 1 } \left[ \frac { 1 } { c ^ { \prime } } \sum _ { i = 0 } ^ { \mathrm { \normalfont ~ c e p ~ a t ~ } \tau \mathrm { \normalfont ~ o r ~ r e s u e ~ a t ~ } \tau + 1 } { \Vert \left[ p _ { \tau } ^ { i } \cdot ( p _ { \tau + 1 } ^ { i } - 1 ) = 0 \right] \cdot m _ { x } + ( 1 - \frac { 1 } { c ^ { \prime } } \sum _ { i = 0 } ^ { c ^ { \prime } - 1 } \widetilde { \mathbb { 1 } ( p _ { \tau } ^ { i } = 2 ) } ) \cdot m _ { y } } \right] .
77
+ $$
78
+
79
+ Thus when the policy network skips more channels or reuses channels that are already computed in the previous time step, the FLOPS for those two convolution layers can be reduced proportionally.
80
+
81
+ Loss functions. We take the average of framewise predictions as the video prediction and minimize:
82
+
83
+ $$
84
+ \mathcal { L } = \sum _ { ( x , y ) \sim D _ { t r a i n } } \left[ - y \log ( P ( x ) ) + \lambda \cdot \sum _ { i = 0 } ^ { B - 1 } M _ { i } \right]
85
+ $$
86
+
87
+ The first term is the cross entropy between one-hot encoded ground truth labels $y$ and predictions $P ( x )$ . The second term is the FLOPS measure for all the $B$ temporal fusion blocks in the network. In this way, our network is learned to achieve both accuracy and efficiency at a trade-off controlled by $\lambda$
88
+
89
+ Discrete policies for “keep”, “reuse” or “skip” shown in Eq. 3 and Eq. 5 make $\mathcal { L }$ non-differentiable hence hard to optimize. One common practice is to use a score function estimator (e.g. REINFORCE (Glynn, 1990; Williams, 1992)) to avoid backpropagating through categorical samplings, but the high variance of the estimator makes the training slow to converge (Wu et al., 2019a; Jang et al., 2016). As an alternative, we use Gumbel-Softmax Estimator to enable efficient end-to-end optimization.
90
+
91
+ Training using Gumbel Softmax Estimator. Specifically, the policy network first generates a logit $q \in \mathbb { R } ^ { 3 }$ for each channel in the output feature map and then we use Softmax to derive a normalized categorical distribution: $\begin{array} { r } { \pi = \{ r _ { i } | r _ { i } = \frac { \exp ( q _ { i } ) } { \exp ( q _ { 0 } ) + \exp ( q _ { 1 } ) + \exp ( q _ { 2 } ) } \} } \end{array}$ . With the Gumbel-Max trick, discrete samples from the distribution $\pi$ can be drawn as (Jang et al., 2016): $\hat { r } = \mathrm { a r g m a x } _ { i } ( \log r _ { i } { + } G _ { i } )$ , where $G _ { i } \ \stackrel { - } { = } \ - \log ( - \log U _ { i } )$ is a standard Gumbel distribution with i.i.d. $U _ { i }$ sampled from a uniform distribution $\mathrm { U n i f } ( 0 , 1 )$ . Since the argmax operator is not differentiable, the Gumbel Softmax distribution is used as a continuous approximation. In forward pass we represent the discrete sample $\hat { r }$ as a one-hot encoded vector and in back-propagation we relax it to a real-valued vector $R = \{ R _ { 0 } , R _ { 1 } , R _ { 2 } \}$ via Softmax as follows:
92
+
93
+ $$
94
+ R _ { i } = \frac { \exp { \left( ( \log { r _ { i } } + G _ { i } ) / \tau \right) } } { \sum _ { j = 1 } ^ { 2 } \exp { \left( ( \log { r _ { j } } + G _ { j } ) / \tau \right) } }
95
+ $$
96
+
97
+ where $\tau$ is a temperature factor controlling the “smooothness” of the distribution: lim $R$ converges to a uniform distribution and $\operatorname* { l i m } _ { \tau 0 } R$ becomes a one-hot vector. We set $\tau = 0 . 6 7$ during the training. Network Architectures and Notations. Our adaptive temporal fusion module can be easily plugged into any existing 2D-CNN models. Specifically, we focus on BN-Inception (Ioffe & Szegedy, 2015), ResNet (He et al., 2016) and EfficientNet (Tan & Le, 2019). For Bn-Inception, we add a policy network between every two consecutive Inception modules. For ResNet/EfficientNet, we insert the policy network between the first and the second convolution layers in each “residual block"/“inverted residual block". We denote our model as AdaFuseMethodBackbone, where the “Backbone” is chosen from{“R18”(ResNet18), “R50”(ResNet50), “Inc”(BN-Inception), “Eff”(EfficientNet)}, and the “Method” can be {“TSN”, “TSM”, “TSM+Last”}. More details can be found in the following section.
98
+
99
+ # 4 EXPERIMENTS
100
+
101
+ We first show AdaFuse can significantly improve the accuracy and efficiency of ResNet18, BNInception and EfficientNet, outperforming other baselines by a large margin on Something-V1. Then on all datasets, AdaFuse with ResNet18 / ResNet50 can consistently outperform corresponding base models. We further propose two instantiations using AdaFuse on TSM (Lin et al., 2019) to compare with state-of-the-art approaches on Something V1 & V2: AdaFuse $^ \mathrm { { T S M } } _ { \mathrm { { R 5 0 } } }$ can save over $40 \%$ FLOPS at a comparable classification score under same amount of computation budget, AdaFuseTSM+LastR50 outperforms state-of-the-art methods in accuracy. Finally, we perform comprehensive ablation studies and quantitative analysis to verify the effectiveness of our adaptive temporal fusion.
102
+
103
+ Datasets. We evaluate AdaFuse on Something-Something V1 (Goyal et al., 2017) & V2 (Mahdisoltani et al., 2018), Jester (Materzynska et al., 2019) and a subset of Kinetics (Kay et al., 2017). Something V1 (98k videos) & V2 (194k videos) are two large-scale datasets sharing 174 human action labels (e.g. pretend to pick something up). Jester (Materzynska et al., 2019) has 27 annotated classes for hand gestures, with $1 1 9 \mathrm { k } / 1 5 \mathrm { k }$ videos in training / validation set. Mini-Kinetics (assembled by Meng et al. (2020)) is a subset of full Kinetics dataset (Kay et al., 2017) containing 121k videos for training and 10k videos for testing across 200 action classes.
104
+
105
+ Implementation details. To make a fair comparison, we carefully follow the training procedure in Lin et al. (2019). We uniformly sample $T = 8$ frames from each video. The input dimension for the network is $2 2 4 \times 2 2 4$ . Random scaling and cropping are used as data augmentation during training (and we further adopt random flipping for Mini-Kinetics). Center cropping is used during inference. All our networks are using ImageNet pretrained weights. We follow a step-wise learning rate scheduler with the initial learning rate as 0.002 and decay by 0.1 at epochs 20 & 40. To train our adaptive temporal fusion approach, we set the efficiency term $\lambda = 0 . 1$ . We train all the models for 50 epochs with a batch-size of 64, where each experiment takes $1 2 \sim 2 4$ hours on 4 Tesla V100 GPUs. We report the number of parameters used in each method, and measure the averaged FLOPS and Top1/Top5 accuracy for all the samples from each testing dataset.
106
+
107
+ Table 1: Action Recognition Results on Something-Something-V1 Dataset. Our proposed method consistently outperforms all other baselines in both accuracy and efficiency.
108
+
109
+ <table><tr><td>Method</td><td>Backbone</td><td>#Params</td><td>FLOPS</td><td>Top1</td><td>Top5</td></tr><tr><td>TSN (Wang et al., 2016)</td><td>ResNet18</td><td>11.2M</td><td>14.6G</td><td>14.8</td><td>38.0</td></tr><tr><td>TSN (Wang et al.,2016)</td><td>BN-Inception</td><td>10.4M</td><td>16.4G</td><td>17.6</td><td>43.5</td></tr><tr><td>CGNet (Hua et al., 2019)</td><td>ResNet18</td><td>11.2M</td><td>11.2G</td><td>13.7</td><td>35.1</td></tr><tr><td>Threshold</td><td>ResNet18</td><td>11.2M</td><td>11.3G</td><td>14.1</td><td>36.6</td></tr><tr><td>Random</td><td>ResNet18</td><td>11.2M</td><td>10.4G</td><td>27.5</td><td>54.2</td></tr><tr><td>LSTM</td><td>ResNet18</td><td>11.7M</td><td>14.7G</td><td>28.4</td><td>56.3</td></tr><tr><td></td><td>ResNet18</td><td>15.6M</td><td>10.3G</td><td>36.9</td><td>65.0</td></tr><tr><td></td><td>BN-Inception</td><td>14.5M</td><td>12.1G</td><td>38.5</td><td>67.8</td></tr></table>
110
+
111
+ Table 2: Action Recognition on Something-Something-V1 using EfficientNet architecture. AdaFuseTSEff- $\dot { \mathbf { x } }$ consistently outperforms all the EfficientNet baselines in both accuracy and efficiency.
112
+
113
+ <table><tr><td>Method</td><td>Backbone</td><td>#Params</td><td>FLOPS</td><td>Top1</td><td>Top5</td></tr><tr><td>TSN</td><td>EfficientNet-b0</td><td>5.3M</td><td>3.1G</td><td>18.0</td><td>44.9</td></tr><tr><td>TSN</td><td>EfficientNet-b1</td><td>7.8M</td><td>5.6G</td><td>19.3</td><td>45.9</td></tr><tr><td>TSN</td><td>EfficientNet-b2</td><td>9.2M</td><td>8.0G</td><td>18.8</td><td>46.0</td></tr><tr><td>TSN</td><td>EfficientNet-b3</td><td>12.0M</td><td>14.4G</td><td>19.3</td><td>46.6</td></tr><tr><td>AdaFuseT</td><td>EfficientNet-b0</td><td>9.3M</td><td>2.8G</td><td>39.0</td><td>68.1</td></tr><tr><td>AdaFuse</td><td>EfficientNet-b1</td><td>12.4M</td><td>4.9G</td><td>40.3</td><td>69.2</td></tr><tr><td>AdaFuse</td><td>EfficientNet-b2</td><td>13.8M</td><td>7.2G</td><td>40.2</td><td>69.5</td></tr><tr><td>AdaFuse</td><td>EfficientNet-b3</td><td>16.6M</td><td>12.9G</td><td>40.7</td><td>69.7</td></tr></table>
114
+
115
+ Adaptive Temporal Fusion improves 2D CNN Performance. On Something V1 dataset, we show AdaFuse ’s improvement upon 2D CNNs by comparing with several baselines as follows:
116
+
117
+ • TSN (Wang et al., 2016): Simply average frame-level predictions as the video-level prediction. • CGNet (Hua et al., 2019): A dynamic pruning method to reduce computation cost for CNNs. • Threshold: We keep a fixed portion of channels base on their activation L1 norms and skip the channels in smaller norms. It serves as a baseline for efficient recognition. • RANDOM: We use temporal fusion with a randomly sampled policy (instead of using learned policy distribution). The distribution is chosen to match the FLOPS of adaptive methods. • LSTM: Update per-frame predictions by hidden states in LSTM and averages all predictions as the video-level prediction.
118
+
119
+ We implement all the methods using publicly available code and apply adaptive temporal fusion in TSN using ResNet18, BN-Inception and EfficientNet backbones, denoting them as AdaFuse $^ { \mathrm { T S N } } _ { \mathrm { R 1 8 } }$ AdaFuse $\mathrm { { } _ { I n c } ^ { T S N } }$ and AdaFuseTSNEff-x respectively $\mathbf { \chi } ^ { * } \mathbf { x } ^ { , * }$ stands for different scales of the EfficientNet backbones). As shown in Table 1, AdaFuse $^ \mathrm { T S N } _ { \mathrm { R 1 8 } }$ uses the similar FLOPS as those efficient methods (“CGNet” and “Threshold”) but has a great improvement in classification accuracy Specifically, AdaFuse $^ { \mathrm { { T S N } } } _ { \mathrm { { R 1 8 } } }$ and AdaFuse $\operatorname { \mathrm { I n c } } _ { \mathrm { I n c } } ^ { \mathrm { T S N } }$ outperform corresponding TSN models by more than $20 \%$ in Top-1 accuracy, while using only $74 \%$ of FLOPS. Interestingly, comparing to TSN, even temporal fusion with a random policy can achieve an absolute gain of $1 2 . 7 \%$ in accuracy, which shows that temporal fusion can greatly improve the action recognition performance of 2D CNNs. Additionally equipped with the adaptive policy, AdaFuse $^ { \mathrm { T S N } } _ { \mathrm { R 1 8 } }$ can get $9 . 4 \%$ extra improvement in classification. LSTM is the most competitive baseline in terms of accuracy, while AdaFuse $^ \mathrm { T S N } _ { \mathrm { R 1 8 } }$ has an absolute gain of $8 . 5 \%$ in accuracy and uses only $70 \%$ of FLOPS. When using a more efficient architecture as shown in Table.2, our approach can still reduce $10 \%$ of the FLOPS while improving the accuracy by a large margin. To further validate AdaFuse being model-agnostic and robust, we conduct extensive experiments using ResNet18 and
120
+
121
+ Table 3: Comparison with TSN using ResNet-18/ResNet-50 backbones. AdaFuse consistently outperforms TSN by a large margin in accuracy while offering significant savings in FLOPs.
122
+
123
+ <table><tr><td>Method</td><td>#Params</td><td colspan="2">SomethingV1</td><td colspan="2">SomethingV2</td><td colspan="2">Jester</td><td colspan="2">Mini-Kinetics</td></tr><tr><td></td><td></td><td>FLOPS</td><td>Top1</td><td>FLOPS</td><td>Top1</td><td>FLOPS</td><td>Top1</td><td>FLOPS</td><td>Top1</td></tr><tr><td>TSNR18 (Wang et al., 2016)</td><td>11.2M</td><td>14.6G</td><td>14.8</td><td>14.6G</td><td>27.3</td><td>14.6G</td><td>82.6</td><td>14.6G</td><td>64.6</td></tr><tr><td>LSTMR18</td><td>11.7M</td><td>14.7G</td><td>28.4</td><td>14.7G</td><td>40.3</td><td>14.7G</td><td>93.5</td><td>14.7G</td><td>67.2</td></tr><tr><td>AdaFuse</td><td>15.6M</td><td>10.3G</td><td>36.9</td><td>11.1G</td><td>50.5</td><td>7.6G</td><td>93.7</td><td>11.8G</td><td>67.5</td></tr><tr><td>TSNR50 (Wang et al., 2016)</td><td>23.6M</td><td>32.9G</td><td>18.7</td><td>32.9G</td><td>32.1</td><td>32.9G</td><td>82.6</td><td>32.9G</td><td>72.1</td></tr><tr><td>LSTMR50</td><td>28.8M</td><td>33.0G</td><td>30.1</td><td>33.0G</td><td>47.4</td><td>33.0G</td><td>93.7</td><td>33.0G</td><td>71.6</td></tr><tr><td>AdaFuser</td><td>37.8M</td><td>22.1G</td><td>41.9</td><td>18.1G</td><td>56.8</td><td>16.1G</td><td>94.7</td><td>23.0G</td><td>72.3</td></tr></table>
124
+
125
+ Table 4: Comparison with the recent adaptive inference method AR-Net (Meng et al., 2020) on Something-Something-V1, Jester and Mini-Kinetics datasets. AdaFuse $^ { \mathrm { T S N } } _ { \mathrm { R } 5 0 }$ achieves a better accuracy with great savings in computation (FLOPS) and number of parameters.
126
+
127
+ <table><tr><td rowspan="2">Method</td><td rowspan="2">#Params</td><td colspan="2">SomethingV1</td><td colspan="2"> Jester</td><td colspan="2">Mini-Kinetics</td></tr><tr><td>FLOPS</td><td>Top1</td><td>FLOPS</td><td>Top1</td><td>FLOPS</td><td>Top1</td></tr><tr><td>AR-Net (Meng et al., 2020)</td><td>63.0M</td><td>41.4G</td><td>18.9</td><td>21.2G</td><td>87.8</td><td>32.0G</td><td>71.7</td></tr><tr><td>AdaFuseTSN</td><td>37.8M</td><td>22.1G</td><td>41.9</td><td>16.1G</td><td>94.7</td><td>23.0G</td><td>72.3</td></tr></table>
128
+
129
+ Table 5: Comparison with State-of-the-Art methods on Something-Something-V1 & V2 datasets. Our method has comparative accuracy with great savings in FLOPS.
130
+
131
+ <table><tr><td>Method</td><td>Backbone</td><td>T</td><td>#Params</td><td>Something-V1 FLOPS Top1</td><td></td><td>Something-V2 FLOPS</td><td>Top1</td></tr><tr><td>TSN (Wang et al., 2016)</td><td>BN-Inception</td><td>8</td><td>10.7M</td><td>16.0G</td><td>19.5</td><td>16.0G</td><td>33.4</td></tr><tr><td>TSN (Wang et al.,2016)</td><td>ResNet50</td><td>8</td><td>24.3M</td><td>33.2G</td><td>19.7</td><td>33.2G</td><td>27.8</td></tr><tr><td>TRNMultiscale (Zhou et al., 2018)</td><td>BN-Inception</td><td>8</td><td>18.3M</td><td>16.0G</td><td>34.4</td><td>16.0G</td><td>48.8</td></tr><tr><td>TRNRGB+Flow (Zhou et al., 2018)</td><td>BN-Inception</td><td>8+8</td><td>36.6M</td><td>32.0G</td><td>42.0</td><td>32.0G</td><td>55.5</td></tr><tr><td>I3D(Carreira &amp; Zisserman,2017)</td><td>3DResNet50</td><td>32×2</td><td>28.0M</td><td>306G</td><td>41.6</td><td>1</td><td>-</td></tr><tr><td>I3D+GCN+NL (Wang &amp; Gupta,2018)</td><td>3DResNet50</td><td>32×2</td><td>62.2M</td><td>606G</td><td>46.1</td><td>=</td><td>1</td></tr><tr><td>ECO (Zolfaghari et al., 2018)</td><td>BNInc+3DRes18</td><td>8</td><td>47.5M</td><td>32G</td><td>39.6</td><td></td><td></td></tr><tr><td>ECOEnLite (Zolfaghari et al.,2018)</td><td>BNInc+3DRes18</td><td>92</td><td>150M</td><td>267G</td><td>46.4</td><td>-</td><td></td></tr><tr><td>TSM (Lin et al., 2019)</td><td>ResNet50</td><td>8</td><td>24.3M</td><td>33.2G</td><td>45.6</td><td>33.2G</td><td>59.1</td></tr><tr><td></td><td>BN-Inception</td><td>8</td><td>14.5M</td><td>12.1G</td><td>38.5</td><td>12.5G</td><td>53.4</td></tr><tr><td></td><td>ResNet50</td><td>8</td><td>37.7M</td><td>22.1G</td><td>41.9</td><td>18.1G</td><td>56.8</td></tr><tr><td>AdaFuseSM TSM</td><td>ResNet50</td><td>8</td><td>37.7M</td><td>19.1G</td><td>44.9</td><td>19.5G</td><td>58.3</td></tr><tr><td></td><td>ResNet50</td><td>8</td><td>39.1M</td><td>31.5G</td><td>46.8</td><td>31.3G</td><td>59.8</td></tr></table>
132
+
133
+ ResNet50 backbones on Something V1 & V2, Jester and Mini-Kinetics. As shown in Table 3, AdaFuse $^ \mathrm { T S N } _ { \mathrm { R 1 8 } }$ and AdaFuse $^ { \mathrm { T S N } } _ { \mathrm { R } 5 0 }$ consistently outperform their baseline TSN and LSTM models with a $3 5 \%$ saving in FLOPS on average. Our approach harvests large gains in accuracy and efficiency on temporal-rich datasets like Something V1 & V2 and Jester. When comes to Mini-Kinetics, AdaFuse can still achieve a better accuracy with $2 0 \% \sim 3 3 \%$ computation reduction.
134
+
135
+ Comparison with Adaptive Inference Method. We compare our approach with AR-Net (Meng et al., 2020), which adaptively chooses frame resolutions for efficient inference. As shown in Table 4, on Something V1, Jester and Mini-Kinetics, we achieve a better accuracy-efficiency trade-off than AR-Net while using $40 \%$ less parameters. On temporal-rich dataset like Something-V1, our approach attains the largest improvement, which shows AdaFuseTSNR50 ’s capability for strong temporal modelling.
136
+
137
+ Comparison with State-of-the-Art Methods. We apply adaptive temporal fusion with different backbones (ResNet50 (He et al., 2016), BN-Inception (Ioffe & Szegedy, 2015)) and designs (TSN (Wang et al., 2016), TSM (Lin et al., 2019)) and compare with State-of-the-Art methods on Something V1 & V2. As shown in Table 5, using BN-Inception as backbone, AdaFuseTSNInc is $4 \%$ better than “TRNMultiscale” (Zhou et al., 2018) in accuracy, using only $7 5 \%$ of the FLOPS. AdaFuse $^ { \mathrm { T S N } } _ { \mathrm { R } 5 0 }$ with ResNet50 can even outperform 3D CNN method “I3D” (Carreira & Zisserman, 2017) and hybrid 2D/3D CNN method “ECO” (Zolfaghari et al., 2018) with much less FLOPS.
138
+
139
+ As for adaptive temporal fusion on “TSM” (Lin et al., 2019), AdaFuse $^ \mathrm { \cdot _ { T S M } } _ { \mathrm { \cdot _ { R 5 0 } } }$ achieves more than $40 \%$ savings in computation but at $1 \%$ loss in accuracy (Table 5). We believe this is because TSM uses temporal shift operation, which can be seen as a variant of temporal fusion. Too much temporal fusion could cause performance degradation due to a worse spatial modelling capability. As a remedy, we just adopt adaptive temporal fusion in the last block in TSM to capture high-level semantics (more intuition can be found later in our visualization experiments) and denote it as AdaFuseTSM+LastR50 . On Something V1 & V2 datasets, AdaFuse $^ \mathrm { T S M + L a s t } _ { \mathrm { R 5 0 } }$ outperforms TSM and all other state-of-the-art methods in accuracy with a $5 \%$ saving in FLOPS comparing to TSM. From our experiments, we observe that the performance of adaptive temporal fusion depends on the position of shift modules in TSM and optimizing the position of such modules through additional regularization could help us not only to achieve better accuracy but also to lower the number of parameters. We leave this as an interesting future work.
140
+
141
+ ![](images/63cf6ad0e5e5fd7955f2ca81e5acdadc0153f1b8745626a5d970a288c7ffd4ab.jpg)
142
+ Figure 2: FLOPS vs Accuracy on Something-V1 Dataset. The diameter of each data point is proportional to the total number of parameters. AdaFuse (blue points) achieves the best trade-off at a comparable model size to 2D CNN approaches.
143
+
144
+ model sizes in Figure 2. All the results are computed from Something V1 validation set. The graph shows GFLOPS / accuracy on x / y-axis and the diameter of each data point is proportional to the number of model parameters. AdaFuse (blue points) owns the best trade-off for accuracy and efficiency at a comparable model size to other 2D CNN approaches. Once again it shows AdaFuse is an effective and efficient design for action recognition.
145
+
146
+ Policy Visualizations. Figure 3 shows overall policy (“Skip”, “Reuse” and “Keep”) differences across all datasets. We focus on the quotient of “Reuse / Keep” as it indicates the mixture ratio for feature fusion. The quotients on Something V1&V2 and Jester datasets are very high (0.694, 0.741 and 0.574 respectively) when comparing to Mini-Kinetics (0.232). This is probably because the first three datasets contain more temporal relationship than Kinetics. Moreover, Jester has the highest percentage in skipping which indicates many actions in this dataset can be correctly recognized with few channels: Training on Jester is more biased towards optimizing for efficiency as the accuracy loss is very low. Distinctive policy patterns show different characteristics of datasets, which conveys a potential of our proposed approach to be served as a “dataset inspector”.
147
+
148
+ Figure 4 shows a more fine-grained policy distribution on Something V2. We plot the policy usage in each residual block inside the ResNet50 architecture (shown in light red/orange/blue) and use 3rd-order polynomials to estimate the trend of each policy (shown in black dash curves). To further study the time-sensitiveness of the policies, we calculate the number of channels where the policies stay unchanged across the frames in one video (shown in dark red/orange/blue). We find earlier layers tend to skip more and reuse/keep less, and vice versa. The first several convolution blocks normally capture low-level feature maps in large spatial sizes, so the “information density” on channel dimension should be less which results in more redundancy across channels. Later blocks often capture high-level semantics and the feature maps are smaller in spatial dimensions, so the “semantic density” could be higher and less channels will be skipped. In addition, low-level features change faster across the frames (shades, lighting intensity) whereas high-level semantics change slowly across the frames (e.g. "kicking soccer"), that’s why more features can be reused in later layers to avoid computing the same semantic again. As for the time-sensitiveness, earlier layers tend to be less sensitive and vice versa. We find that “reuse” is the most time-sensitive policy, as “Reuse (Instance)” ratio is very low, which again shows the functioning of adaptive temporal fusion. We believe these findings will provide insights to future designs of effective temporal fusions.
149
+
150
+ How does the adaptive policy affect the performance? We consider AdaFuseTSNR18 on Something V1 dataset and break down by using “skip”, ‘reuse” and adaptive (Ada.) policy learning. As shown in Table 6, “Ada. Skip” saves $55 \%$ of FLOPS comparing to TSN but at a great degradation in accuracy. This shows naively skipping channels won’t give a better classification performance. “Ada. Reuse” approach brings $2 1 . 5 \%$ absolute gain in accuracy, which shows the importance of temporal fusion. However, it fails to save much FLOPS due to the absence of skipping operation. Combining “Keep” with both “Skip” and “Reuse” via just a random policy is already achieving a better trade-off comparing to TSN, and by using adaptive learning approach, AdaFuseTSNR18 reaches the highest accuracy with the second-best efficiency. In summary, the “Skip” operation contributes the most to the computation efficiency, the “Reuse” operation boosts the classification accuracy, while the adaptive policy adds the chemistry to the whole system and achieves the best performance.
151
+
152
+ ![](images/8ccaf240b4de3e12e710fe5dc30a80dd2d44b1032bf00277a5ac9fdb3c4b8510.jpg)
153
+ Figure 3: Dataset-specific policy distribution.
154
+
155
+ ![](images/652e46060dc637b3ae2755a4a5455d60d40327005e6b9e6ea7de3844e8ef21f1.jpg)
156
+ Figure 4: Policy distribution and trends for each residual block on Something-V2 dataset.
157
+
158
+ Table 6: Effect of different policies (using AdaFuseTSNR18 ) on Something V1 dataset.
159
+
160
+ <table><tr><td>Method</td><td></td><td></td><td></td><td>Skip Reuse Ada.FLOPS Top1</td><td></td></tr><tr><td>TSN</td><td></td><td></td><td></td><td>14.6G</td><td>14.8</td></tr><tr><td>Ada. Skip</td><td></td><td></td><td></td><td>6.6G</td><td>9.5</td></tr><tr><td>Ada.Reuse</td><td></td><td></td><td></td><td>13.8G</td><td>36.3</td></tr><tr><td>Random</td><td></td><td></td><td></td><td>10.4G</td><td>27.5</td></tr><tr><td>AdaFuseTSN</td><td>x&lt;x&gt;&gt;</td><td>xx&gt;&gt;&gt;</td><td>x&gt;&gt;x&gt;</td><td>10.3G</td><td>36.9</td></tr></table>
161
+
162
+ Table 7: Effect of hidden sizes and efficient weights on the performance of AdaFuseTSM+LastR50 on SthV2.
163
+
164
+ <table><tr><td>#Hidden Units</td><td>入</td><td>#Params FLOPS</td><td></td><td>Top1</td><td>Skip Reuse</td></tr><tr><td>1024</td><td>0.050</td><td>39.1M</td><td>31.53G</td><td>59.71 13%</td><td>14%</td></tr><tr><td>1024</td><td>0.075</td><td>39.1M</td><td>31.29G</td><td>59.75 15%</td><td>13%</td></tr><tr><td>1024</td><td>0.100</td><td>39.1M</td><td>31.04G</td><td>59.40 18%</td><td>12%</td></tr><tr><td>2048</td><td>0.100</td><td>54.3M</td><td>30.97G</td><td>59.96 21%</td><td>10%</td></tr><tr><td>4096</td><td>0.100</td><td>84.7M</td><td>31.04G</td><td>60.00 25%</td><td>8%</td></tr></table>
165
+
166
+ How to achieve a better performance? Here we investigate different settings to improve the performance of AdaFuseTSM+LastR50 on Something V2 dataset. As shown in Table 7, increasing $\lambda$ will obtain a better efficiency but might result in accuracy degradation. Enlarging the number of hidden units for the policy network can get a better overall performance: as we increase the size from 1024 to 4096, the accuracy keeps increasing. When the policy network grows larger, it learns to skip more to reduce computations and to reuse history features wisely for recognition. But notice that the model size grows almost linearly to hidden layer sizes, which leads to a considerable overhead to the FLOPS computation. As a compromise, we only choose $\lambda = 0 . 7 5$ and hidden size 1024 for AdaFuseTSM+LastR50 . We leave the design for a more advanced and delicate policy module for future works.
167
+
168
+ Runtime/Hardware. Sparse convolutional kernels are often less efficient on current hardwares, e.g., GPUs. However, we strongly believe that it is important to explore models for efficient video action recognition which might guide the direction of new hardware development in the years to come. Furthermore, we also expect wall-clock time speed-up in the inference stage via efficient CUDA implementation, which we anticipate will be developed.
169
+
170
+ # 5 CONCLUSIONS
171
+
172
+ We have shown the effectiveness of adaptive temporal fusion for efficient video recognition. Comprehensive experiments on four challenging and diverse datasets present a broad spectrum of accuracyefficiency models. Our approach is model-agnostic, which allows it to be served as a plugin operation for a wide range of architectures for video recognition tasks.
173
+
174
+ Acknowledgements. This work is supported by the Intelligence Advanced Research Projects Activity (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. This work is also partly supported by the MIT-IBM Watson AI Lab.
175
+
176
+ 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.
177
+
178
+ # REFERENCES
179
+
180
+ Sadjad Asghari-Esfeden, Mario Sznaier, and Octavia Camps. Dynamic motion representation for human action recognition. In The IEEE Winter Conference on Applications of Computer Vision, pp. 557–566, 2020.
181
+
182
+ Emmanuel Bengio, Pierre-Luc Bacon, Joelle Pineau, and Doina Precup. Conditional computation in neural networks for faster models. arXiv preprint arXiv:1511.06297, 2015.
183
+
184
+ Yoshua Bengio, Nicholas Léonard, and Aaron Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013.
185
+
186
+ Joao Carreira and Andrew Zisserman. Quo vadis, action recognition? a new model and the kinetics dataset. In proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6299–6308, 2017.
187
+
188
+ Yinpeng Chen, Xiyang Dai, Mengchen Liu, Dongdong Chen, Lu Yuan, and Zicheng Liu. Dynamic convolution: Attention over convolution kernels. arXiv preprint arXiv:1912.03458, 2019a.
189
+
190
+ Zhourong Chen, Yang Li, Samy Bengio, and Si Si. You look twice: Gaternet for dynamic filter selection in cnns. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 9172–9180, 2019b.
191
+
192
+ Jeffrey Donahue, Lisa Anne Hendricks, Sergio Guadarrama, Marcus Rohrbach, Subhashini Venugopalan, Kate Saenko, and Trevor Darrell. Long-term recurrent convolutional networks for visual recognition and description. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2625–2634, 2015.
193
+
194
+ Hehe Fan, Zhongwen Xu, Linchao Zhu, Chenggang Yan, Jianjun Ge, and Yi Yang. Watching a small portion could be as good as watching all: Towards efficient video classification. In IJCAI International Joint Conference on Artificial Intelligence, 2018.
195
+
196
+ Quanfu Fan, Chun-Fu Richard Chen, Hilde Kuehne, Marco Pistoia, and David Cox. More is less: Learning efficient video representations by big-little network and depthwise temporal aggregation. In Advances in Neural Information Processing Systems, pp. 2261–2270, 2019.
197
+
198
+ Christoph Feichtenhofer, Haoqi Fan, Jitendra Malik, and Kaiming He. Slowfast networks for video recognition. arXiv preprint arXiv:1812.03982, 2018.
199
+
200
+ Michael Figurnov, Maxwell D Collins, Yukun Zhu, Li Zhang, Jonathan Huang, Dmitry Vetrov, and Ruslan Salakhutdinov. Spatially adaptive computation time for residual networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1039–1048, 2017.
201
+
202
+ Ruohan Gao, Tae-Hyun Oh, Kristen Grauman, and Lorenzo Torresani. Listen to look: Action recognition by previewing audio. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10457–10467, 2020.
203
+
204
+ Xitong Gao, Yiren Zhao, Łukasz Dudziak, Robert Mullins, and Cheng-zhong Xu. Dynamic channel pruning: Feature boosting and suppression. arXiv preprint arXiv:1810.05331, 2018.
205
+
206
+ Peter W Glynn. Likelihood ratio gradient estimation for stochastic systems. Communications of the ACM, 33(10):75–84, 1990.
207
+
208
+ Raghav Goyal, Samira Ebrahimi Kahou, Vincent Michalski, Joanna Materzynska, Susanne Westphal, Heuna Kim, Valentin Haenel, Ingo Fruend, Peter Yianilos, Moritz Mueller-Freitag, et al. The" something something" video database for learning and evaluating visual common sense. In ICCV, volume 1, pp. 5, 2017.
209
+
210
+ Alex Graves. Adaptive computation time for recurrent neural networks. arXiv preprint arXiv:1603.08983, 2016.
211
+
212
+ Yunhui Guo, Honghui Shi, Abhishek Kumar, Kristen Grauman, Tajana Rosing, and Rogerio Feris. Spottune: transfer learning through adaptive fine-tuning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4805–4814, 2019.
213
+
214
+ Kai Han, Yunhe Wang, Qi Tian, Jianyuan Guo, Chunjing Xu, and Chang Xu. Ghostnet: More features from cheap operations. arXiv preprint arXiv:1911.11907, 2019.
215
+
216
+ Kensho Hara, Hirokatsu Kataoka, and Yutaka Satoh. Can spatiotemporal 3d cnns retrace the history of 2d cnns and imagenet? In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition, pp. 6546–6555, 2018.
217
+
218
+ 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.
219
+
220
+ Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8): 1735–1780, 1997.
221
+
222
+ Weizhe Hua, Yuan Zhou, Christopher M De Sa, Zhiru Zhang, and G Edward Suh. Channel gating neural networks. In Advances in Neural Information Processing Systems, pp. 1884–1894, 2019.
223
+
224
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015.
225
+
226
+ Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax. arXiv preprint arXiv:1611.01144, 2016.
227
+
228
+ S. Ji, W. Xu, M. Yang, and K. Yu. 3d convolutional neural networks for human action recognition. IEEE Transactions on Pattern Analysis and Machine Intelligence, 35(1):221–231, Jan 2013. doi: 10.1109/TPAMI.2012.59.
229
+
230
+ Boyuan Jiang, MengMeng Wang, Weihao Gan, Wei Wu, and Junjie Yan. Stm: Spatiotemporal and motion encoding for action recognition. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2000–2009, 2019.
231
+
232
+ Andrej Karpathy, George Toderici, Sanketh Shetty, Thomas Leung, Rahul Sukthankar, and Li Fei-Fei. Large-scale video classification with convolutional neural networks. In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition, pp. 1725–1732, 2014.
233
+
234
+ Will Kay, Joao Carreira, Karen Simonyan, Brian Zhang, Chloe Hillier, Sudheendra Vijayanarasimhan, Fabio Viola, Tim Green, Trevor Back, Paul Natsev, et al. The kinetics human action video dataset. arXiv preprint arXiv:1705.06950, 2017.
235
+
236
+ Bruno Korbar, Du Tran, and Lorenzo Torresani. Scsampler: Sampling salient clips from video for efficient action recognition. In Proceedings of the IEEE International Conference on Computer Vision, pp. 6232–6242, 2019.
237
+
238
+ Chengxi Li, Yue Meng, Stanley H Chan, and Yi-Ting Chen. Learning 3d-aware egocentric spatialtemporal interaction via graph convolutional networks. In 2020 IEEE International Conference on Robotics and Automation (ICRA), pp. 8418–8424. IEEE, 2020a.
239
+
240
+ Yan Li, Bin Ji, Xintian Shi, Jianguo Zhang, Bin Kang, and Limin Wang. Tea: Temporal excitation and aggregation for action recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 909–918, 2020b.
241
+
242
+ Ji Lin, Yongming Rao, Jiwen Lu, and Jie Zhou. Runtime neural pruning. In Advances in Neural Information Processing Systems, pp. 2181–2191, 2017.
243
+
244
+ Ji Lin, Chuang Gan, and Song Han. Tsm: Temporal shift module for efficient video understanding. In Proceedings of the IEEE International Conference on Computer Vision, pp. 7083–7093, 2019.
245
+
246
+ Zhaoyang Liu, Donghao Luo, Yabiao Wang, Limin Wang, Ying Tai, Chengjie Wang, Jilin Li, Feiyue Huang, and Tong Lu. Teinet: Towards an efficient architecture for video recognition. In AAAI, pp. 11669–11676, 2020.
247
+
248
+ Farzaneh Mahdisoltani, Guillaume Berger, Waseem Gharbieh, David Fleet, and Roland Memisevic. On the effectiveness of task granularity for transfer learning. arXiv preprint arXiv:1804.09235, 2018.
249
+
250
+ Joanna Materzynska, Guillaume Berger, Ingo Bax, and Roland Memisevic. The jester dataset: A large-scale video dataset of human gestures. In Proceedings of the IEEE International Conference on Computer Vision Workshops, pp. 0–0, 2019.
251
+
252
+ Mason McGill and Pietro Perona. Deciding how to decide: Dynamic routing in artificial neural networks. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 2363–2372, 2017.
253
+
254
+ Yue Meng, Chung-Ching Lin, Rameswar Panda, Prasanna Sattigeri, Leonid Karlinsky, Aude Oliva, Kate Saenko, and Rogerio Feris. Ar-net: Adaptive frame resolution for efficient action recognition. In European Conference on Computer Vision, pp. 86–104. Springer, 2020.
255
+
256
+ Mathew Monfort, Alex Andonian, Bolei Zhou, Kandan Ramakrishnan, Sarah Adel Bargal, Tom Yan, Lisa Brown, Quanfu Fan, Dan Gutfruend, Carl Vondrick, et al. Moments in time dataset: one million videos for event understanding. arXiv preprint arXiv:1801.03150, 2018.
257
+
258
+ 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.
259
+
260
+ Bowen Pan, Rameswar Panda, Camilo Luciano Fosco, Chung-Ching Lin, Alex J Andonian, Yue Meng, Kate Saenko, Aude Oliva, and Rogerio Feris. Va-red2: Video adaptive redundancy reduction. In International Conference on Learning Representations, 2021.
261
+
262
+ Karen Simonyan and Andrew Zisserman. Two-stream convolutional networks for action recognition in videos. In Neural Information Processing System (NIPS), 2014.
263
+
264
+ Swathikiran Sudhakaran, Sergio Escalera, and Oswald Lanz. Gate-shift networks for video action recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 1102–1111, 2020.
265
+
266
+ Mingxing Tan and Quoc V Le. Efficientnet: Rethinking model scaling for convolutional neural networks. arXiv preprint arXiv:1905.11946, 2019.
267
+
268
+ Du Tran, Lubomir Bourdev, Rob Fergus, Lorenzo Torresani, and Manohar Paluri. Learning spatiotemporal features with 3d convolutional networks. In Proceedings of the IEEE international conference on computer vision, pp. 4489–4497, 2015.
269
+
270
+ Du Tran, Heng Wang, Lorenzo Torresani, Jamie Ray, Yann LeCun, and Manohar Paluri. A closer look at spatiotemporal convolutions for action recognition. In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition, pp. 6450–6459, 2018.
271
+
272
+ Du Tran, Heng Wang, Lorenzo Torresani, and Matt Feiszli. Video classification with channelseparated convolutional networks. In Proceedings of the IEEE International Conference on Computer Vision, pp. 5552–5561, 2019.
273
+
274
+ Andreas Veit and Serge Belongie. Convolutional networks with adaptive inference graphs. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 3–18, 2018.
275
+
276
+ Thomas Verelst and Tinne Tuytelaars. Dynamic convolutions: Exploiting spatial sparsity for faster inference. arXiv preprint arXiv:1912.03203, 2019.
277
+
278
+ Limin Wang, Yuanjun Xiong, Zhe Wang, Yu Qiao, Dahua Lin, Xiaoou Tang, and Luc Van Gool. Temporal segment networks: Towards good practices for deep action recognition. In European conference on computer vision, pp. 20–36. Springer, 2016.
279
+
280
+ Xiaolong Wang and Abhinav Gupta. Videos as space-time region graphs. In Proceedings of the European conference on computer vision (ECCV), pp. 399–417, 2018.
281
+
282
+ Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 7794–7803, 2018a.
283
+
284
+ Xin Wang, Fisher Yu, Zi-Yi Dou, Trevor Darrell, and Joseph E Gonzalez. Skipnet: Learning dynamic routing in convolutional networks. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 409–424, 2018b.
285
+
286
+ Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
287
+
288
+ Wenhao Wu, Dongliang He, Xiao Tan, Shifeng Chen, Yi Yang, and Shilei Wen. Dynamic inference: A new approach toward efficient video action recognition. arXiv preprint arXiv:2002.03342, 2020.
289
+
290
+ Zuxuan Wu, Tushar Nagarajan, Abhishek Kumar, Steven Rennie, Larry S Davis, Kristen Grauman, and Rogerio Feris. Blockdrop: Dynamic inference paths in residual networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 8817–8826, 2018.
291
+
292
+ Zuxuan Wu, Caiming Xiong, Yu-Gang Jiang, and Larry S Davis. Liteeval: A coarse-to-fine framework for resource efficient video recognition. In Advances in Neural Information Processing Systems, pp. 7778–7787, 2019a.
293
+
294
+ Zuxuan Wu, Caiming Xiong, Chih-Yao Ma, Richard Socher, and Larry S Davis. Adaframe: Adaptive frame selection for fast video recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1278–1287, 2019b.
295
+
296
+ Saining Xie, Chen Sun, Jonathan Huang, Zhuowen Tu, and Kevin Murphy. Rethinking Spatiotemporal Feature Learning: Speed-Accuracy Trade-offs in Video Classification. In The European Conference on Computer Vision (ECCV), September 2018.
297
+
298
+ Brandon Yang, Gabriel Bender, Quoc V Le, and Jiquan Ngiam. Condconv: Conditionally parameterized convolutions for efficient inference. In Advances in Neural Information Processing Systems, pp. 1305–1316, 2019.
299
+
300
+ Serena Yeung, Olga Russakovsky, Greg Mori, and Li Fei-Fei. End-to-end learning of action detection from frame glimpses in videos. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2678–2687, 2016.
301
+
302
+ Bolei Zhou, Alex Andonian, Aude Oliva, and Antonio Torralba. Temporal relational reasoning in videos. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 803–818, 2018.
303
+
304
+ Mohammadreza Zolfaghari, Kamaljeet Singh, and Thomas Brox. Eco: Efficient convolutional network for online video understanding. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 695–712, 2018.
md/train/gwPPcc_M0lv/gwPPcc_M0lv.md ADDED
@@ -0,0 +1,481 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Learning to recover orientations from projections in single-particle cryo-EM
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 A major challenge in single-particle cryo-electron microscopy (cryo-EM) is that
11
+ 2 the orientations adopted by the 3D particles prior to imaging are unknown; yet, this
12
+ 3 knowledge is essential for high-resolution reconstruction. We present a method
13
+ 4 to recover these orientations directly from the acquired set of 2D projections.
14
+ 5 Our approach consists of two steps: (i) the estimation of distances between pairs
15
+ 6 of projections, and (ii) the recovery of the orientation of each projection from
16
+ 7 these distances. In step (i), pairwise distances are estimated by a Siamese neural
17
+ 8 network trained on synthetic cryo-EM projections from resolved bio-structures.
18
+ 9 In step (ii), orientations are recovered by minimizing the difference between
19
+ 10 the distances estimated from the projections and the distances induced by the
20
+ 11 recovered orientations. We evaluated the method on synthetic cryo-EM datasets.
21
+ 12 Current results demonstrate that orientations can be accurately recovered from
22
+ 13 projections that are shifted and corrupted with a high level of noise. The accuracy
23
+ 14 of the recovery depends on the accuracy of the distance estimator. While not
24
+ 15 yet deployed in a real experimental setup, the proposed method offers a novel
25
+ 16 learning-based take on orientation recovery in SPA. Our code is available at https:
26
+ 17 //github.com/anonymous/protein-reconstruction.
27
+
28
+ # 18 1 Introduction
29
+
30
+ 19 Single-particle cryo-electron microscopy (cryo-EM) has revolutionized the field of structural biology
31
+ 20 over the last decades [1, 2, 3]. The use of electron beams to image ice-embedded samples has
32
+ 21 permitted the recovery of 3D bio-structures at unprecedented resolution. This “resolution revolution”
33
+ 22 has had a tremendous impact in biomedical research, providing invaluable insights into the biological
34
+ 23 processes that underlie many current diseases.
35
+ 24 In single-particle cryo-EM, every 3D particle adopts a random orientation $\theta _ { i }$ in the ice layer before
36
+ 25 being imaged. Hence, the projection geometry associated to each acquired 2D projection (Figure 1)
37
+ 26 is unknown. Yet, this knowledge is essential for the tomographic reconstruction of bio-structures [4].
38
+ 27 We consider that a cryo-EM measurement (i.e., a projection) $\mathbf { p } _ { i } \in \mathbb { R } ^ { n _ { p } }$ is acquired through
39
+
40
+ $$
41
+ \mathbf { p } _ { i } = \mathbf { C } _ { \varphi } \mathbf { S _ { t } } _ { i } \mathbf { P } _ { \theta _ { i } } \mathbf { x } + \mathbf { n } ,
42
+ $$
43
+
44
+ 28 where $\mathbf { x } \in \mathbb { R } ^ { n _ { x } }$ is the unknown 3D density map [5] (Coulomb potential). The operator $\mathbf { P } _ { \pmb { \theta } _ { i } } : \mathbb { R } ^ { n _ { x } } $
45
+ 29 $\mathbb { R } ^ { n _ { p } }$ is the projection along the orientation $\theta _ { i }$ (i.e., the $\mathbf { X }$ -ray transform). The operator $\mathbf { S } _ { \mathbf { t } _ { i } } : \mathbb { R } ^ { n _ { p } } $
46
+ 30 $\mathbb { R } ^ { n _ { p } }$ is a shift of the projection by $\mathbf { t } _ { i } = ( t _ { i _ { 1 } } , t _ { i _ { 2 } } )$ . The convolution operator $\mathbf { C } _ { \varphi } : \mathbb { R } ^ { n _ { p } } \mathbb { R } ^ { n _ { p } }$ models
47
+ 31 the microscope point-spread function (PSF) with parameters $\varphi = ( d _ { 1 } , d _ { 2 } , \alpha _ { \mathrm { a s t } } )$ , where $d _ { 1 }$ is the
48
+ 32 defocus-major, $d _ { 2 }$ is the defocus-minor, and $\alpha _ { \mathrm { a s t } }$ is the angle of astigmatism [6, 7]. Finally, $\mathbf { n } \in \mathbb { R } ^ { n _ { p } }$
49
+ 33 represents additive noise. Figure 11 illustrates the effect of projection, shift, and noise. The challenge
50
+ 34 is then to reconstruct $\mathbf { x }$ from a set of projections $\{ { \bf p } _ { i } \} _ { i = 1 } ^ { P }$ acquired along unknown orientations.
51
+ 35 A popular approach is to alternatively refine the 3D structure and estimated orientations [8, 9, 10, 11,
52
+ 36 12, 13]. Yet, the outcome of these iterative-refinement procedures is often predicated on the quality
53
+ 37 of the initial reconstruction, or, equivalently, on the initial estimation of the orientations [14, 15].
54
+ 38 Several methods have been designed to produce a first rough ab initio structure for the refinement
55
+ 39 procedure [16]. Moment-matching techniques [17, 18, 19, 20] reconstruct an initial structure such
56
+ 40 that the first few moments of the distribution of its theoretical measurements match the ones of
57
+ 41 its experimental projections; however, they typically remain sensitive to error in data and can
58
+ 42 require relatively high computational complexity. Based on the central-slice theorem, common-lines
59
+ 43 methods [21, 8, 22, 23, 24, 25, 26] aim at uniquely determining the orientations of each projection by
60
+ 44 identifying the common-lines between triplets of projections—a real challenge given the massive
61
+ 45 amount of noise. Alternatively, the marginalized maximum likelihood (ML) formulation of the
62
+ 46 reconstruction problem [11]—classically used for the iterative-refinement procedures themselves—
63
+ 47 can be minimized using stochastic gradient descent [27]. This permits to avoid the need for an initial
64
+ 48 volume estimate, at the possible cost of greater convergence instability.
65
+ 49 More recently, the recovery of geometrical information from unknown view tomography of 2D point
66
+ 50 sources has been proposed [28], but the extension to 3D cryo-EM tomography is not straightforward.
67
+ 51 Finally, [29] proposed to recover the in-plane rotations by learning to embed projections in an
68
+ 52 appropriate latent space, but only after directions had been estimated through three rounds of 2D
69
+ 53 classification in RELION.
70
+ 54 Despite the aforementioned advances, providing a robust initial volume remains a challenge due to
71
+ 55 the high-dimensionality and ill-posedness of the underlying optimization problem. On the other hand,
72
+ 56 the remarkable ability of convolutional neural networks to capture relevant representations of images
73
+ 57 has had a profound influence in imaging [30]. In this work, we present a learning-based approach to
74
+ 58 recover the unknown orientations directly from the acquired set of projections—without the need for
75
+ 59 an intermediate reconstruction procedure or an initial volume estimate.
76
+
77
+ ![](images/574fcacd9c7d71546e39eb9b29cfe0b129fe830c192894eca371c94a60073732.jpg)
78
+ Figure 1: Geometry of the imaging model defined in (1). The 3D density $\mathbf { x }$ in the coordinate system $( x _ { 1 } , x _ { 2 } , x _ { 3 } )$ is imaged along the orientation $\pmb \theta$ to produce the 2D projection $\mathbf { p }$ in the coordinate system $( y _ { 1 } , y _ { 2 } )$ of the microscope’s detector plane. The orientation $\pmb { \theta } = ( \theta _ { 3 } , \theta _ { 2 } , \theta _ { 1 } )$ is decomposed as the direction $( \theta _ { 2 } , \theta _ { 1 } ) \in [ 0 , \pi ] \times$ $[ 0 , 2 \pi [$ (parameterizing the sphere $\mathbb { S } ^ { 2 }$ ) and the in-plane rotation $\theta _ { 3 } \in [ 0 , 2 \pi [$ (parameterizing the circle $\mathbb { S } ^ { 1 }$ ). In our work, we represent the orientation $\pmb { \theta }$ as a unit quaternion $q$ .
79
+
80
+ ![](images/571ec2e85d672c9aec24a91431b51abf95fd62226de8c5f704170d6b9f6c194b.jpg)
81
+ Figure 2: Single-particle cryo-EM produces $P$ projections (with $P$ in the order of $1 0 ^ { 5 }$ ) from unknown orientations: $\{ ( \mathbf { p } _ { i } , q _ { i } ) \} _ { i = 1 } ^ { P }$ . Observing that distances between orientations constrain the latter, we aim to recover the orientations $\left\{ q _ { i } \right\}$ from $\{ d _ { q } ( q _ { i } , q _ { j } ) \}$ , where $d _ { q } ( q _ { i } , q _ { j } )$ is the distance (angle) between orientations $q _ { i }$ and $q _ { j }$ . Observing that the similarity between projections depends on their relative orientation, we aim to estimate the distance $d _ { q } ( q _ { i } , q _ { j } )$ from the projections $( \mathbf { p } _ { i } , \mathbf { p } _ { j } )$ .
82
+
83
+ # 60 2 Method
84
+
85
+ 61 Our approach relies on two observations (Figure 2), yielding two steps (Figure 3). First, the more similar two projections 62 $( \mathbf { p } _ { i } , \mathbf { p } _ { j } )$ , the more likely they originated from two particles that adopted close
86
+
87
+ ![](images/3f3b0db6773005f59b0f2a35d0d58aab70fa3e035961632f38d44e661423dc1b.jpg)
88
+ Figure 3: Our method consists of two steps. First, we estimate distances between pairs of projections. Second, we recover the orientation of each projection from these distances.
89
+
90
+ 63 orientations $( q _ { i } , q _ { j } )$ in the ice prior to imaging;1 this observation guides a number of applications in
91
+ 64 the field [2]. Hence, we aim to estimate distances between orientations $d _ { q } ( q _ { i } , q _ { j } )$ from the projections
92
+ 65 as $\widehat { d } _ { p } ( \mathbf { p } _ { i } , \mathbf { p } _ { j } )$ , which we discuss in $\ S 2 . 2$ . Second, an orientation $q$ is constrained by the distances
93
+ 66 between itself and the other orientations $\{ d ( q , q _ { j } ) \}$ . Hence, we aim to recover orientations $\left\{ { \widehat { q } } _ { k } \right\}$ such
94
+ 67 that the induced distances $\{ d _ { q } ( \widehat { q } _ { i } , \widehat { q } _ { j } ) \}$ are close to the estimated distances $\{ \widehat { d _ { p } } ( \mathbf { p } _ { i } , \mathbf { p } _ { j } ) \}$ , which we
95
+ 68 discuss in $\ S 2 . 3$ b b. All in all, from a set of projections $\left\{ \mathbf { p } _ { k } \right\}$ , we aim to recover their orientations $\left\{ { \widehat { q _ { k } } } \right\}$
96
+ 69 such that $d _ { q } ( \widehat { q _ { i } } , \widehat { q _ { j } } ) \approx \widehat { d _ { p } } ( \mathbf { p } _ { i } , \mathbf { p } _ { j } ) \approx d _ { q } ( q _ { i } , q _ { j } )$ , with equality if $\widehat { d } _ { p }$ and $\left\{ { \widehat { q } } _ { k } \right\}$ are perfectly estimated.
97
+ 70 Our approach is similar to [31]. While the authors reconstruct 2D images from 1D projections, they
98
+ 71 rely on the same two-step approach: they (i) estimate distances as $\hat { \hat { d _ { p } } } ( \mathbf { p } _ { i } , \mathbf { p } _ { j } ) = \vert \vert \mathbf { p } _ { i } - \mathbf { p } _ { j } \vert \vert _ { 2 }$ then
99
+ 72 (ii) recover the orientations by spectrally embedding that distance graph. The Euclidean distance is
100
+ 73 however not robust to perturbations: for example, two projections that only differ by a shift $\bf { S _ { t } }$ of one
101
+ 74 pixel would be considered far apart while their orientations are the same. They noted that issue and
102
+ 75 we observed it too (Appendix E). To circumvent this, we propose to learn $\widehat { d } _ { p }$ from examples $( \ S 2 . 2 )$ .
103
+
104
+ # 76 2.1 Representation of orientations with quaternions
105
+
106
+ 77 The orientation of a 3D particle with respect to the microscope’s detector plane is a rotation relative to
107
+ 78 a reference orientation (Figure 1). The group of all 3D rotations under composition is identified with
108
+ 79 SO(3), the group of $3 \times 3$ orthogonal matrices with determinant 1 under matrix multiplication. A
109
+ 80 rotation matrix $\mathbf { R } _ { \theta } \in \mathbf { S O } ( 3 )$ can be decomposed as a product of ${ \binom { 3 } { 2 } } = 3$ independent rotations, for
110
+ 81 example as $\mathbf { R } _ { \theta } = \mathbf { R } _ { \theta _ { 3 } } \mathbf { R } _ { \theta _ { 2 } } \mathbf { R } _ { \theta _ { 1 } }$ , where $\pmb { \theta } = ( \theta _ { 3 } , \theta _ { 2 } , \theta _ { 1 } ) \in [ 0 , 2 \pi [ \times \overline { { [ 0 , \pi ] } } \times [ 0 , 2 \pi [$ [ are the (extrinsic
111
+ 82 and proper) Euler angles in the $Z Y Z$ convention (a common parameterization in cryo-EM) [32].
112
+ 83 While Euler angles are a concise representation of orientation (3 numbers for 3 degrees of freedom),
113
+ 84 they suffer from a topological constraint—there is no covering map from the 3-torus to SO(3)—
114
+ 85 which manifests itself in the gimbal lock, the loss of one degree of freedom when $\theta _ { 2 } = 0$ . This makes
115
+ 86 their optimization by gradient descent $( \ S 2 . 3 )$ problematic. On the other hand, optimizing rotation
116
+ 87 matrices (made of 9 numbers) would require computationally costly constraints (orthogonality and
117
+ 88 determinant 1) to reduce the degrees of freedom to 3. Moreover, the distance between orientations
118
+ 89 cannot be directly computed from Euler angles and is costly (30 multiplications) to compute from
119
+ 90 rotation matrices [33]. We solve both problems by representing orientations with unit quaternions.
120
+ 91 Quaternions $q \in \mathbb { H }$ are an extension of complex numbers2 of the form $q = a + b i + c j + d \pmb { k }$ where
121
+ 92 $a , b , c , d \in \mathbb { R }$ . Unit quaternions $q \in \mathbb { S } ^ { 3 }$ , where $\mathbb { S } ^ { 3 } = \{ q \in \mathbb { H } : | q | \lceil = 1 \}$ is the 3-sphere (with
122
+ 93 the additional group structure inherited from quaternion multiplication), concisely and elegantly
123
+ 94 represent a rotation of angle $\theta$ about axis $( x _ { 1 } , x _ { 2 } , x _ { 3 } )$ as $q = \cos ( \bar { \theta } / 2 ) + x _ { 1 } \sin ( \theta / 2 ) i \dot { + } x _ { 2 } \sin ( \bar { \theta / 2 } ) \dot { { \bf j } _ { + } }$
124
+ 95 $\bar { x _ { 3 } } \sin ( \theta / 2 ) k$ . They parameterize rotation matrices as
125
+
126
+ $$
127
+ \mathbf { R } _ { q } = \left( \begin{array} { c c c } { a ^ { 2 } + b ^ { 2 } - c ^ { 2 } - d ^ { 2 } } & { 2 b c - 2 a d } & { 2 b d + 2 a c } \\ { 2 b c + 2 a d } & { a ^ { 2 } - b ^ { 2 } + c ^ { 2 } - d ^ { 2 } } & { 2 c d - 2 a b } \\ { 2 b d - 2 a c } & { 2 c d + 2 a b } & { a ^ { 2 } - b ^ { 2 } - c ^ { 2 } + d ^ { 2 } } \end{array} \right) .
128
+ $$
129
+
130
+ ![](images/a4869dab607e0b19aefdd984dbad627ea589878c7313f5aba9d2ea397257420b.jpg)
131
+ Figure 4: Distance learning. We are looking for a distance $\widehat { d } _ { p }$ between projections that is an accurate estimator of the distance $d _ { q }$ between their orientations. We propose to parameterize $\widehat { d } _ { p }$ as a Siamese neural network (SNN), trained on a synthetic dataset of projections with associated orientation.
132
+
133
+ 96 Note that $\mathbb { S } ^ { 3 } \to { \bf S O } ( 3 )$ is a two-to-one mapping (a double cover) as $q$ and $- q$ represent the same
134
+ 97 orientation. Unlike Euler angles, ${ \mathbb S } ^ { 3 }$ is isomorphic to the universal cover of $\mathbf { S O } ( 3 )$ . Hence, the
135
+ 98 distance between two orientations, i.e., the length of the geodesic between them on $\mathbf { \bar { S } O ( 3 ) }$ , is
136
+
137
+ $$
138
+ \begin{array} { c } { d _ { q } : \mathbb { S } ^ { 3 } \times \mathbb { S } ^ { 3 } \to [ 0 , \pi ] , } \\ { d _ { q } ( q _ { i } , q _ { j } ) = 2 \operatorname { a r c c o s } \left( | \langle q _ { i } , q _ { j } \rangle | \right) , } \end{array}
139
+ $$
140
+
141
+ where 99 $\langle \cdot , \cdot \rangle$ is the inner product, and the absolute value $\left. \cdot \right.$ ensures that $d _ { q } ( q _ { i } , q _ { j } ) = d _ { q } ( q _ { i } , - q _ { j } )$ . The distance 00 $d _ { q } ( q _ { i } , q _ { j } )$ corresponds to the magnitude of the rotation $\mathbf { R } _ { * }$ such that ${ \bf R } _ { q _ { i } } = { \bf R } _ { * } { \bf R } _ { q _ { j } }$ [33].
142
+
143
+ # 2.2 Distance learning
144
+
145
+ 102 We aim to estimate a function $\widehat { d } _ { p }$ such that $\widehat { d } _ { p } ( { \bf p } _ { i } , { \bf p } _ { j } ) \approx d _ { q } ( q _ { i } , q _ { j } )$ . While we could in principle
146
+ 103 design $\widehat { d } _ { p }$ , that would be intricate—if not impossible—partly because the invariants are difficult
147
+ 104 to specify. We instead opt to learn $\widehat { d } _ { p }$ , capitalizing on (i) the powerful function approximation
148
+ 105 capabilities of neural networks, and (ii) the possibility to generate realistic datasets supported by the
149
+ 106 availability of numerous 3D atomic models3 and our ability to model the cryo-EM imaging procedure.
150
+
151
+ From a training dataset 107 $\left\{ { \bf p } _ { i } , q _ { i } \right\} _ { i = 1 } ^ { P }$ , we learn the projection distance
152
+
153
+ $$
154
+ \widehat { d } _ { p } = \mathop { \mathrm { a r g } } \underset { d _ { p } } { \mathrm { a r g } } \mathrm { m i n } L _ { \mathrm { D E } } , \quad \mathrm { w h e r e } \quad L _ { \mathrm { D E } } = \sum _ { i , j } \left| d _ { p } \big ( \mathbf { p } _ { i } , \mathbf { p } _ { j } \big ) - d _ { q } \big ( q _ { i } , q _ { j } \big ) \right| ^ { 2 }
155
+ $$
156
+
157
+ 108 is the loss and $d _ { q }$ is defined in (2). The $d _ { p }$ is parameterized as the Siamese neural network (SNN) [34]
158
+
159
+ $$
160
+ d _ { p } ( \mathbf { p } _ { i } , \mathbf { p } _ { j } ) = d _ { f } ( \mathcal { G } _ { w } ( \mathbf { p } _ { i } ) , \mathcal { G } _ { w } ( \mathbf { p } _ { j } ) ) ,
161
+ $$
162
+
163
+ 109 where $\mathcal { G } _ { w }$ is a convolutional neural network with weights $w$ that is trained to extract the most relevant
164
+ 110 features $\mathbf { f } _ { i } \in \mathbb { R } ^ { n _ { f } }$ from a projection $\mathbf { p } _ { i }$ . SNNs, also termed “twin networks”, are commonly used in
165
+ 111 the field of deep metric learning to learn similarity functions [35]. We set the feature space distance
166
+ 112 $d _ { f }$ as the cosine distance to facilitate the learning of a $\widehat { d } _ { p }$ that respects the elliptic geometry of $\mathbb { S } ^ { 3 }$
167
+ 113 (Appendix F). Figure 4 illustrates the proposed learning paradigm.
168
+ 114 As evaluating a sum over $P ^ { 2 }$ pairs is computationally intractable for cryo-EM datasets with typically
169
+ 115 $P$ in the order of $1 0 ^ { 5 }$ projections, we sample the sum and minimize (3) with stochastic gradient
170
+ 116 descent (SGD) over small batches of pairs. The weights $w$ are updated by back-propagation.
171
+ 117 The architecture of $\mathcal { G } _ { w }$ is described in Appendix G. When designing the architecture, we constrain
172
+ 118 the functional space from which the trained $\mathcal { G } _ { w }$ is drawn and express our prior expert knowledge. For
173
+ 119 example, we realize shift invariance, i.e., a guarantee that a shift $\bf { S _ { t } }$ does not change our estimated
174
+ 120 distances and orientations, with a fully convolutional architecture. Size invariance, i.e., taking
175
+ 121 projections $\mathbf { p }$ of varying sizes $n _ { p }$ while yielding a representation f of a fixed size $n _ { f }$ , is realized by a
176
+ 122 final average pooling layer. As we do not (yet) know how to realize an invariance to noise or PSF, we
177
+ 123 resort to data augmentation, i.e., training on perturbed projections. In $\ S 3 . 4$ , we show that a built-in
178
+ 124 invariance (shift) is far preferable to one learned through augmentation (noise). Finally, as projections
179
+
180
+ 125 are made by integrating through the 3D volume, projections from opposed directions are mirrors of each other.4126 That is another kind of physical knowledge that should ideally be built into our method.
181
+
182
+ 127 One could hope to train $\mathcal { G } _ { w }$ to directly map projections to orientations as ${ \widehat { q _ { i } } } = \mathbf { f } _ { i } = { \mathcal { G } } _ { w } ( \mathbf { p } _ { i } )$ . While
183
+ 128 that would avoid the orientation recovery step, a space of ${ n } _ { f } = 4$ bdimensions does not have room for
184
+ 129 $\mathcal { G } _ { w }$ to represent the other factors of variation in $\mathbf { p }$ , such as different noise levels, PSFs, or proteins.
185
+ 130 We tested that hypothesis in Appendix F.
186
+
187
+ # 2.3 Orientation recovery
188
+
189
+ 132 The task of recovering points based on their relative distances has been extensively studied. Many
190
+ 133 methods aim at mapping high-dimensional data onto a lower-dimensional space while preserving
191
+ 134 distances, primarily for dimensionality reduction and data visualization. Well-known examples
192
+ 135 include MDS [36], Isomap [37], LLE [38], Laplacian eigenmaps [39], t-SNE [40], and UMAP [41].
193
+ 136 The embedding of distance matrices in Euclidean space (given by their eigenvectors) is especially
194
+ 137 well-described. In particular, the framework of Euclidean distance matrices (EDMs) [42] provides
195
+ 138 theoretical guarantees on the recovery of points from distances.
196
+ 139 We however aim to embed the orientations $q$ in $\mathbb { S } ^ { 3 }$ (§2.1), a setting for which we are unaware of any
197
+ 140 theoretical characterization (e.g., on the shape of the loss function or its behavior when distances are
198
+ 141 missing or noisy). The fact that ${ \mathbb S } ^ { 3 }$ is locally Euclidean does however offer some hope. Indeed, despite
199
+ 142 the non-convexity and the lack of theoretical guarantees, we are able to appropriately minimize our
200
+ 143 loss function, as we experimentally demonstrate in Appendix D.
201
+
202
+ We recover the orientations of a set of projections 144 $\left\{ { \bf p } _ { k } \right\} _ { k = 1 } ^ { P }$ through
203
+
204
+ $$
205
+ \left\{ \widehat { q } _ { k } \right\} _ { k = 1 } ^ { P } = \underset { \left\{ q _ { k } \in \mathbb { S } ^ { 3 } \right\} } { \arg \operatorname* { m i n } } L _ { \mathrm { O R } } , \quad \mathrm { w h e r e } \quad L _ { \mathrm { O R } } = \sum _ { i , j } \left| \widehat { d } _ { p } \left( \mathbf { p } _ { i } , \mathbf { p } _ { j } \right) - d _ { q } \left( q _ { i } , q _ { j } \right) \right| ^ { 2 }
206
+ $$
207
+
208
+ 145 is the loss and $\widehat { d } _ { p }$ is the estimator trained in (3). Note that the sole difference with (3) is that the
209
+ 146 minimization is performed over the orientations $q$ rather than the distance $d _ { p }$ . Here again, we sample
210
+ 147 the sum in practice and minimize (4) with mini-batch SGD. Sampling the sum amounts to building a
211
+ 148 sparse (instead of complete) distance graph before embedding, a common strategy.
212
+
213
+ # 149 2.4 Evaluation
214
+
215
+ 150 151 Unfortunately, we cannand the true orientations y take the difference between the recovered orientations as orientations are rotations up to an arbitrary reference or $\{ \widehat { q _ { k } } \} _ { k = 1 } ^ { P }$
216
+ $\{ q _ { k } \} _ { k = 1 } ^ { P }$
217
+ 153 Any global rotation or reflection of the recovered orientations is as valid as any other, i.e., $d _ { q } ( q _ { i } , q _ { j } ) =$
218
+ 154 $d _ { q } ( \mathbf { T } q _ { i } , \mathbf { T } q _ { j } ) \ \forall \mathbf { T } \in \mathbf { O } ( 4 )$ , where $\mathbf { O } ( 4 )$ is the group of $4 \times 4$ orthogonal matrices. Hence, we align
219
+ 155 the sets of orientations and compute the mean orientation recovery error as
220
+
221
+ $$
222
+ E _ { \mathrm { O R } } = \operatorname* { m i n } _ { \mathbf { T } \in \mathbf { O } ( 4 ) } \frac { 1 } { P } \sum _ { i = 1 } ^ { P } \left| d _ { q } \left( q _ { i } , \mathbf { T } \widehat { q _ { i } } \right) \right| .
223
+ $$
224
+
225
+ We implement 156 $\mathbf { T }$ as a product of ${ \binom { 4 } { 2 } } = 6$ independent rotations and an optional reflection:
226
+
227
+ $$
228
+ \mathbf { T } = \left[ \begin{array} { l l } { m } & { \mathbf { 0 } } \\ { \mathbf { 0 } } & { \mathbf { I } } \end{array} \right] \prod _ { \substack { 1 \leq i < j \leq 4 } } \mathbf { T } _ { \theta _ { i j } } , \quad m \in \{ - 1 , 1 \} , \ \theta _ { i j } \in [ 0 , 2 \pi [ ,
229
+ $$
230
+
231
+ where 157 $\mathbf { T } _ { \theta _ { i j } } \in \mathbf { S O } ( 4 )$ is a rotation by angle $\theta _ { i j }$ on the $( x _ { i } , x _ { j } )$ plane.
232
+
233
+ 158 In practice, we again minimize (5) with mini-batch SGD. Because $\mathbf { O } ( 4 )$ is disconnected, we optimize
234
+ 159 the 6 angles separately for $m = 1$ (proper rotations) and $m = - 1$ (improper rotations). Figure 15
235
+ 160 shows an alignment to $E _ { \mathrm { O R } } = 0$ after a perfect recovery.
236
+ 162 We first evaluated whether orientation recovery through (4) was feasible assuming perfect distances,
237
+ 163 and how it was affected by errors in the distances (§3.2). We then learned to estimate the distances
238
+ 164 through (3), and evaluated the accuracy of this procedure (§3.3) and its robustness to perturbations of
239
+ 165 the projections (§3.4). Finally, we ran the whole machinery on a synthetic dataset to assess how well
240
+ 166 orientations could be recovered from estimated distances (§3.5).
241
+
242
+ # 3.1 Experimental conditions
243
+
244
+ 168 Density maps. We considered two proteins (Figure 10): the $\beta$ -galactosidase, a protein with a
245
+ 169 dihedral (D2) symmetry, and the lambda excision HJ intermediate (HJI), an asymmetric protein
246
+ 170 with local cyclic (C1) symmetry. Their deposited PDB atomic models are 5a1a [43] and $5 \mathrm { j } 0 \mathrm { n }$ [44],
247
+ 171 respectively. From these atomic models, we generated the density maps in Chimera [45] by fitting the
248
+ 172 models with a $1 \mathring \mathrm { A }$ map for 5a1a and a $3 . 6 7 \mathring \mathrm { A }$ map for $5 \mathrm { j } 0 \mathrm { n }$ ; this gave us a volume of $1 1 0 \times 1 5 5 \times 1 9 9$
249
+ 173 voxels for 5a1a and one of $6 9 \times 5 7 \times 7 5$ voxels for $5 \mathrm { j } 0 \mathrm { n }$ .
250
+ 174 Protein symmetries. Symmetries are problematic when learning distances: two projections can
251
+ 175 be identical while not originating from the same orientation, which breaks an axiom of distance
252
+ 176 functions (identity of indiscernibles). Figure 16b illustrates this problem. To capture only one of four
253
+ 177 identical projections of 5a1a, we restricted directions to $( \theta _ { 2 } , \theta _ { 1 } ) \in [ 0 , \pi [ \times [ 0 , \frac { \pi } { 2 } [$ (a quarter of the
254
+ 178 sphere, illustrated in Figure 12a) for that protein. This treatment of symmetries is incomplete5 but
255
+ 179 sufficient for a proof-of-concept.
256
+ 180 Projections. Using the ASTRA projector [46], we generated $P = 5 , 0 0 0$ synthetic projections
257
+ 181 of $2 7 5 \times 2 7 5$ pixels (downsampled to $1 1 6 \times 1 1 6 )$ for 5a1a and $1 1 6 \times 1 1 6$ pixels for $5 { \dot { \jmath } } 0 \mathbf { n }$ , taken
258
+ 182 from uniformly sampled orientations. 6 We then perturbed the measurements with different levels of
259
+ 183 additive Gaussian noise [47, 48] and off-centering shifts. Figure 11 displays some samples.
260
+
261
+ Datasets. For each protein, we split the projections into training, validation, and test subsets, and created disjoint pairs of projections from each (Table 1). The training and validation sets were used to train and evaluate the SNN, while the test set was used to evaluate orientation recovery given a trained SNN. Sampling orientations (mostly) uniformly induces a distribution of distances that is skewed towards larger distances (shown in Figure 12b). As this would skew $L _ { \mathrm { D E } }$ and bias $\widehat { d } _ { p }$ , we further sampled $1 \%$ of the training and validation pairs to make the distribution of distances uniform—for $\widehat { d } _ { p }$ to be uniformly accurate over the whole $[ 0 , \pi ]$ range of distances (see Appendix B for further illustrations). While 1, 650 projections were enough to perfectly reconstruct the density maps (as shown in Figures 9e and 9j), our method is not limited by the number of projections as optimization is done per batch. Optimization settings are described in Appendix C.
262
+
263
+ # 3.2 Sensitivity of orientation recovery to errors in distance estimation
264
+
265
+ We first evaluated the feasibility of orientation recovery assuming that the exact distances were known.
266
+ The method successfully recovers the orientation of every projection in this case (see Appendix D).
267
+
268
+ To evaluate the robustness of (4), we perturbed the distances prior to recovery with an error sampled from a Gaussian distribution with mean 0 and variances $\sigma ^ { \hat { 2 } } \in [ 0 . 0 , 0 . 8 ]$ . Figure 5 shows that the recovery error $E _ { \mathrm { O R } }$ is a monotonic function of the error in distances: from $E _ { \mathrm { O R } } = 0$ with exact distances to $E _ { 0 \mathrm { R } } \approx 0 . 2$ radians $( \approx 1 1 . 5 ^ { \circ } )$ for $\sigma ^ { 2 } = 0 . 8$ .
269
+
270
+ These results demonstrate that the performance of orientation recovery (4) depends on the quality of the estimated distances, which advocates for a proper and extensive training of the SNN. Moreover, we observe that $L _ { \mathrm { O R } }$ is a reliable proxy for $E _ { \mathrm { O R } }$ , allowing us to assess recovery performance in the absence of ground-truth orientations (i.e., when recovering the orientations of real projections).
271
+
272
+ Table 1: Split of $P = 5 , 0 0 0$ projections in training, validation, and test subsets.
273
+
274
+ <table><tr><td>Dataset</td><td>P</td><td>p2</td><td>Used pairs</td></tr><tr><td>Training</td><td>2,512 (50%)</td><td>6,310,144</td><td>63,101</td></tr><tr><td>Validation</td><td>838 (17%)</td><td>702,244</td><td>7,022</td></tr><tr><td>Test</td><td>1,650 (33%)</td><td>2,722,500</td><td>2,722,500</td></tr></table>
275
+
276
+ ![](images/2aaf4e1ffebb6061b0d70680344575ada494cd691329db794acfa53f635c55b1.jpg)
277
+
278
+ ![](images/8cec7c08a80f0bbcb089809f087d6f046a01157d520bd8c120d20494ab91474b.jpg)
279
+ Figure 5: Orientation recovery from perturbed distances on $5 { \dot { \jmath } } 0 \mathbf { n }$ (left) and 5a1a (right).
280
+
281
+ ![](images/705437b5f98dff2a7bfcb3af8a130419f1d633b057aa6fcecdae2727f00411f2.jpg)
282
+ Figure 6: Distance learning.
283
+
284
+ (b) Relationship between $\widehat { d _ { p } }$ and $d _ { q }$ on 1, 000 pairs from the test sets of $5 { \dot { \jmath } } 0 \mathbf { n }$ (left) and 5a1a (right).
285
+
286
+ # 205 3.3 Learning to estimate distances
287
+
288
+ 06 We evaluated the ability of the SNN to learn to approximate the orientation distance $d _ { q }$ . For
289
+ 7 comparison, we evaluated a baseline, the Euclidean distance $\widehat { d } _ { p } ( \mathbf { p } _ { i } , \mathbf { p } _ { j } ) = \| \mathbf { p } _ { i } , \mathbf { p } _ { j } \| _ { 2 }$ , in Appendix $\mathrm { E }$
290
+ 8 Figure 6a shows the convergence of $L _ { \mathrm { D E } }$ , reached in about 50 epochs. Figure 6b shows the relationship
291
+ 09 between the distance $\widehat { d } _ { p }$ estimated from projections and the true distance $d _ { q }$ . The outliers for 5a1a
292
+ 10 are explained by our incomplete treatment of its symmetry. While our learned distance function
293
+ is a much better estimator than the Euclidean distance—compare Figure 6b with Figure 16—they
294
+ 2 share one characteristic: both plateau and underestimate the largest distances. We did attenuate
295
+ the phenomenon by sampling training distances uniformly (see $\ S 3 . 1 \ r ,$ ), and the issue is much less
296
+ 4 severe than with the Euclidean distance. An alternative could be to only rely on smaller distances for
297
+ 15 recovery. That would however require the addition of a spreading term in (4) to prevent the recovered
298
+ 16 orientations to collapse.
299
+ 217 These results confirm that a SNN is able to estimate differences in orientations from projections alone,
300
+ 218 even though much has yet to be gained from improving upon the rather primitive SNN architecture
301
+ 219 we are currently using. The use of additional training data should help further diminish overfitting.
302
+
303
+ # 220 3.4 Sensitivity of distance learning to perturbations in the projections
304
+
305
+ 221 We first demonstrated that the learning of distances is insensible to off-centering shifts (Figure 7a),
306
+ 222 which is expected given that shift invariance is built in our SNN (see $\ S 2 . 2 \AA ,$ ).
307
+
308
+ As we cannot—or do not yet know how to—build noise invariance in the SNN architecture, we trained the SNN on noisy projections and evaluated whether it could learn to treat noise as an irrelevant information. Figure 7b shows $E _ { \mathrm { O R } } \approx 0 . 1 6$ radians $( \approx 9 ^ { \circ } )$ for noiseless projections and $E _ { \mathrm { O R } } \approx 0 . 4 2$ radians $( \approx 2 4 ^ { \circ } )$ for a more realistic noise variance of $\sigma ^ { 2 } = 1 6$ (with signal-to-noise ratio of $- 1 2 \ \mathrm { d B }$ ). Whereas a naive distance function (e.g., an Euclidean distance) would be extremely sensitive to noise, the SNN mostly learned to discard it. Moreover, the observed overfitting indicates that more training data should further decrease the sensitivity of the SNN to noise.
309
+
310
+ 230 Note that we did not evaluate sensitivity to the PSF at this stage but expect a similar behavior.
311
+
312
+ 231 Here again (§3.2), we observed that (i) the estimation of more accurate distances (a smaller $L _ { \mathrm { D E } } ,$ )
313
+ 232 leads to the recovery of more accurate orientations (a smaller $L _ { \mathrm { O R } }$ and $E _ { \mathrm { O R } } \mathrm { , }$ ), and that (ii) an higher
314
+ 233 recovery loss $L _ { \mathrm { O R } }$ induces an higher error $E _ { \mathrm { O R } }$ .
315
+
316
+ ![](images/6f70f3284125a2c36d4a356143a7dcfa7b58837a136ef24c27fd3c69e4865116.jpg)
317
+
318
+ (a) Learning from shifted projections $\{ \mathbf { S } _ { \mathbf { t } _ { i } } \mathbf { P } _ { \pmb { \theta } _ { i } } \mathbf { x } \}$ , with shifts $t _ { i _ { 1 } }$ and $t _ { i _ { 2 } }$ sampled from a triangular distribution with mean 0 and of increasing limits.
319
+
320
+ ![](images/fa385fb38fc1189c00191e90224e286cf12a4a8e9dac8951664eec3eb9e6ac1a.jpg)
321
+ (b) Learning from noisy projections $\{ \mathbf { P } _ { \pmb { \theta } _ { i } } \mathbf { x } + \mathbf { n } \}$ , with white noise $\mathbf { n } \sim { \mathcal { N } } ( 0 , \sigma ^ { 2 } \mathbf { I } )$ of increasing variance $\sigma ^ { 2 }$ .
322
+
323
+ ![](images/0264fa45e6883ef7433b143093a4bdda85e2307012d7e4a9d89d7791417030a3.jpg)
324
+ Figure 7: Sensitivity of distance learning to perturbations in the projections of $5 \mathrm { j } 0 \mathrm { n }$ . The box plots show the distance learning loss $L _ { \mathrm { D E } }$ (the distribution is taken over epochs). Boxes show the orientation recovery loss $L _ { \mathrm { O R } }$ and error $E _ { \mathrm { O R } }$ .
325
+ Figure 8: Distance learning and orientation recovery from estimated distances. The green and orange boxes show $L _ { \mathrm { D E } }$ (3) on the training and validation sets. The blue curve shows the evolution of the recovery loss until convergence, with the minimum $L _ { \mathrm { O R } }$ (4) highlighted. The red histogram shows the errors in the recovered orientations $\{ d _ { q } ( q _ { i } , \mathbf { T } \widehat { q _ { i } } ) \}$ , with the mean $E _ { \mathrm { O R } }$ (5) highlighted.
326
+
327
+ # 234 3.5 Orientation recovery and reconstruction of density maps
328
+
329
+ As a proof-of-concept, we attempted to solve the full inverse problem posed by (1), i.e., to reconstruct the density maps $\widehat { \mathbf { x } }$ from sets of projections $\{ { \bf { p } } _ { i } \}$ and their orientations $\left\{ { \widehat { q } } _ { i } \right\}$ recovered through the b bproposed method. It is worth noting that, at this stage of development, we only trained the SNN on projections originating from the protein we were attempting to reconstruct. In addition, reconstruction was performed with a direct reconstruction algorithm (ASTRA’s GPU implementation of the CGLS algorithm) rather than with a robuster iterative method. This is a specific experimental case that only partially shines light on the applicability of the method in real situations; this is discussed in $\ S 4$ .
330
+
331
+ Figure 8a shows the recovery of orientations from distances that were estimated from noiseless projections of $5 \mathrm { j } 0 \mathrm { n }$ . A mean error of $E _ { 0 \mathrm { R } } \approx 0 . 2 0$ radians $( \approx 1 1 ^ { \circ } )$ in the recovered orientations led to a reconstruction with a resolution of $1 2 . 2 \mathring \mathrm { A }$ at a Fourier shell coefficient (FSC) of 0.5, shown in Figure ${ 9 \mathrm { c } }$ . As predicted by our other experiments, corrupting the projections with noise ( $\sigma ^ { 2 } = 1 6$ ) negatively impacts the quality of the recovered orientations (Figure 8b); the obtained mean error is then $E _ { 0 \mathrm { R } } \approx 0 . 2 5$ radians $( \approx 1 4 ^ { \circ } )$ ). Unsurprisingly, this leads to a reconstruction with a lower resolution of $1 5 . 2 \mathring \mathrm { A }$ , shown in Figure 9d. (Note that reconstruction was here obtained from the noiseless projections, the goal being to evaluate only the impact of orientation mis-estimation.)
332
+
333
+ Finally, Figures 8c,d show the recovery of orientations from noiseless and noisy projections of 5a1a. A mean error of $E _ { \mathrm { O R } } \approx 0 . 1 3$ radians $( \approx 7 ^ { \circ } )$ in both cases led to reconstructions with resolutions of $8 . 0 \mathring \mathrm { A }$ and $9 . 6 \mathring \mathrm { A }$ , shown in Figures 9h,i. Distance estimation, orientation recovery, and reconstruction performed better on 5a1a than $5 \mathrm { j } 0 \mathrm { n }$ because its ground-truth density is of higher resolution.
334
+
335
+ These results tend to indicate that a reasonable first structure can be reconstructed from projections whose orientations have been recovered through our method.
336
+
337
+ # 4 Discussion
338
+
339
+ 257 In this work, we explored the use of distance learning between pairs of 2D cryo-EM projections
340
+ 258 from a 3D protein structure to infer the unknown orientation at which each projection was imaged
341
+ 259 from. Our two-step method relies on the estimation of pairwise distances between unseen projections,
342
+ 260 followed by the recovery of the orientations from these distances.
343
+
344
+ ![](images/be11a1e7a160d661e763531e4c3e3700d0c00e6a7b41db7a15cda69b0a0bdc59.jpg)
345
+ Figure 9: Density maps $\widehat { \mathbf { x } }$ reconstructed from (a,f) ground-truth orientations, (b,g) random orientations, b(c,h) orientations recovered from noiseless projections, and (d,i) orientations recovered from noisy projections. The Fourier shell correlation (FSC) curves in (e,j) indicate the resolutions of the densities (w.r.t. ground-truth densities, shown in Figures 10b,d).
346
+
347
+ The method has been evaluated on synthetic datasets for two different proteins. The results provide key insights on the viability of the proposed scheme. First, they demonstrate that a SNN can learn a distance function between projections that estimates the difference in their orientation $( \ S 3 . 3 )$ and that is invariant to shifts and robust to increasing levels of noise (§3.4)—an important condition in cryo-EM. Second, they demonstrate that an accurate estimation of distances leads to an accurate recovery of orientations $( \ S 3 . 2 , \ \ S 3 . 4 )$ . Finally, our method was able to recover orientations with an error of 0.12 to 0.25 radians (7 to $1 4 ^ { \circ }$ )—leading to an initial volume with a resolution of 8 to $1 5 \mathring \mathrm { A }$ (§3.5). In summary, the more accurate the estimated distances, the more precise the recovered orientations, and, ultimately, the higher-resolution the reconstructed volume.
348
+
349
+ 270 While the method is not yet ready to be deployed in practice, we believe that a series of developments
350
+ 271 could make it relevant for single-particle cryo-EM reconstruction. 7 As previously discussed, the
351
+ 272 results underline the importance of learning an accurate distance estimator. In this regard, the
352
+ 273 performance of the SNN could be improved. First, the architecture of the twin convolutional neural
353
+ 274 networks should be expanded and tuned. Second, training could be improved, perhaps by providing
354
+ 275 more supervision by separately predicting the differences in direction $( \theta _ { 2 } , \theta _ { 1 } )$ and in-plane angle $\theta _ { 3 }$ .
355
+
356
+ Importantly, the SNN would be better trained on a more diverse cryo-EM dataset. Indeed, its success as a faithful estimator eventually relies on our capacity to generate a synthetic training dataset whose data distribution is diverse enough to cover that of unseen projection datasets. Such realistic cryo-EM projections could be generated by relying on a more expressive formulation of the cryo-EM physics and taking advantage of the thousands of atomic models available in the PDB. In particular, a necessary extension will be to include the effects of the PSF and to evaluate its impact.
357
+
358
+ A final phase of tests before deploying the method on real cryo-EM measurements will be to extensively test the method on “unseen proteins”, i.e., proteins whose simulated projections have never been seen by the SNN. In this regard, an interesting aspect of our method is that the twin networks within the SNN intrinsically predict the relationship between projections, allowing the SNN as a whole to abstract the particular volume. Learning should benefit from the profound structural similarity shared by proteins—after all, they are all derived from the same 21 building blocks.
359
+
360
+ Training our 4.5M parameter model (see Appendices G and C) has the following negative environmental impact: it consumes 13 kWh of energy, which produces 6.36 lbs of $\mathrm { C O _ { 2 } }$ on average [49].
361
+
362
+ 91 [1] J. Dubochet, M. Adrian, J.-J. Chang, J.-C. Homo, J. Lepault, A. W. McDowall, and P. Schultz,
363
+ 92 “Cryo-electron microscopy of vitrified specimens,” Quarterly Reviews of Biophysics, vol. 21,
364
+ 93 no. 2, pp. 129–228, 1988.
365
+ 94 [2] J. Frank, Three-dimensional electron microscopy of macromolecular assemblies: Visualization
366
+ 95 of biological molecules in their native state. Oxford University Press, 2006.
367
+ 96 [3] Nature, “Method of the year 2015,” Nature Methods, vol. 13, no. 1, 2016.
368
+ 97 [4] F. Natterer, The mathematics of computerized tomography. Society for Industrial and Applied
369
+ 98 Mathematics, jan 2001.
370
+ 99 [5] F. DiMaio, D. A. Kondrashov, E. Bitto, A. Soni, C. A. Bingman, G. N. Phillips, and
371
+ 00 J. W. Shavlik, “Creating protein models from electron-density maps using particle-filtering
372
+ 01 methods,” Bioinformatics, vol. 23, no. 21, pp. 2851–2858, Nov. 2007. [Online]. Available:
373
+ 02 https://academic.oup.com/bioinformatics/article/23/21/2851/374177
374
+ 03 [6] M. Vulovic, R. B. Ravelli, L. J. van Vliet, A. J. Koster, I. Lazi ´ c, U. Lücken, H. Rullgård, ´
375
+ 04 O. Öktem, and B. Rieger, “Image formation modeling in cryo-electron microscopy,” Journal of
376
+ 05 Structural Biology, vol. 183, no. 1, pp. 19–32, Jul. 2013.
377
+ 06 [7] H. Rullgård, L.-G. Öfverstedt, S. Masich, B. Daneholt, and O. Öktem, “Simulation of transmis
378
+ 07 sion electron microscope images of biological specimens,” Journal of Microscopy, vol. 243,
379
+ 08 no. 3, pp. 234–256, 2011.
380
+ 09 [8] P. A. Penczek, R. A. Grassucci, and J. Frank, “The ribosome at improved resolution: New
381
+ techniques for merging and orientation refinement in 3D cryo-electron microscopy of biological
382
+ particles,” Ultramicroscopy, vol. 53, no. 3, pp. 251–270, 1994.
383
+ [9] T. Baker and R. Cheng, “A model-based approach for determining orientations of biological
384
+ macromolecules imaged by cryoelectron microscopy,” Journal of Structural Biology, vol. 116,
385
+ no. 1, pp. 120–130, 1996. [Online]. Available: http://www.sciencedirect.com/science/article/pii/
386
+ S1047847796900209
387
+ [10] A. P. Dempster, N. M. Laird, and D. B. Rubin, “Maximum likelihood from incomplete data via
388
+ the EM algorithm,” Journal of the Royal Statistical Society. Series B (Methodological), vol. 39,
389
+ 18 no. 1, pp. 1–38, 1977.
390
+ [11] F. J. Sigworth, “A maximum-likelihood approach to single-particle image refinement,” Journal
391
+ 20 of structural biology, vol. 122, no. 3, pp. 328–339, 1998.
392
+ 21 [12] S. Scheres, “A bayesian view on cryo-EM structure determination,” Journal of molecular
393
+ 22 biology, vol. 415, no. 2, pp. 406–418, 2012.
394
+ 23 [13] M. Zehni, L. Donati, E. Soubies, Z. J. Zhao, and M. Unser, “Joint Angular Refinement and
395
+ 24 Reconstruction for Single-Particle Cryo-EM,” IEEE Transactions on Image Processing, 2020.
396
+ 25 [14] C. O. S. Sorzano, R. Marabini, A. Pascual-Montano, S. H. Scheres, and J. M. Carazo, “Opti
397
+ 26 mization problems in electron microscopy of single particles,” Annals of Operations Research,
398
+ 27 vol. 148, no. 1, pp. 133–165, 2006.
399
+ 28 [15] R. Henderson, A. Sali, M. L. Baker, B. Carragher, B. Devkota, K. H. Downing, E. H. Egelman,
400
+ 29 Z. Feng, J. Frank, N. Grigorieff, W. Jiang, S. J. Ludtke, O. Medalia, P. A. Penczek, P. B.
401
+ 30 Rosenthal, M. G. Rossmann, M. F. Schmid, G. F. Schröder, A. C. Steven, D. L. Stokes, J. D.
402
+ 31 Westbrook, W. Wriggers, H. Yang, J. Young, H. M. Berman, W. Chiu, G. J. Kleywegt, and C. L.
403
+ 32 Lawson, “Outcome of the first electron microscopy validation task force meeting,” Structure,
404
+ 33 vol. 20, no. 2, pp. 205–214, 2012.
405
+ 34 [16] A. Singer and F. J. Sigworth, “Computational methods for single-particle electron cryomi
406
+ 35 croscopy,” Annual Review of Biomedical Data Science, vol. 3, 2020.
407
+ 36 [17] Z. Kam, “The reconstruction of structure from electron micrographs of randomly oriented
408
+ 37 particles,” in Electron Microscopy at Molecular Dimensions. Springer, 1980, pp. 270–277.
409
+ 38 [18] D. B. Salzman, “A method of general moments for orienting 2d projections of unknown 3d
410
+ 39 objects,” Computer vision, graphics, and image processing, vol. 50, no. 2, pp. 129–156, 1990.
411
+ 40 [19] A. Goncharov, “Integral geometry and three-dimensional reconstruction of randomly oriented
412
+ 41 identical particles from their electron microphotos,” Acta Applicandae Mathematica, vol. 11,
413
+ 42 no. 3, pp. 199–211, 1988.
414
+
415
+ [20] N. Sharon, J. Kileel, Y. Khoo, B. Landa, and A. Singer, “Method of moments for 3-d single particle ab initio modeling with non-uniform distribution of viewing angles,” Inverse Problems, 2019.
416
+ [21] M. Van Heel, “Angular reconstitution: a posteriori assignment of projection directions for 3d reconstruction,” Ultramicroscopy, vol. 21, no. 2, pp. 111–123, 1987.
417
+ [22] S. P. Mallick, S. Agarwal, D. J. Kriegman, S. J. Belongie, B. Carragher, and C. S. Potter, “Structure and view estimation for tomographic reconstruction: A bayesian approach,” in 2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’06), vol. 2. IEEE, 2006, pp. 2253–2260.
418
+ [23] A. Singer, R. R. Coifman, F. J. Sigworth, D. W. Chester, and Y. Shkolnisky, “Detecting consistent common lines in cryo-EM by voting,” Journal of structural biology, vol. 169, no. 3, pp. 312–322, 2010.
419
+ [24] L. Wang, A. Singer, and Z. Wen, “Orientation determination of cryo-EM images using least unsquared deviations,” SIAM journal on imaging sciences, vol. 6, no. 4, pp. 2450–2483, 2013.
420
+ [25] I. Greenberg and Y. Shkolnisky, “Common lines modeling for reference free ab-initio reconstruction in cryo-EM,” Journal of structural biology, vol. 200, no. 2, pp. 106–117, 2017.
421
+ [26] G. Pragier and Y. Shkolnisky, “A common lines approach for ab initio modeling of cyclically symmetric molecules,” Inverse Problems, vol. 35, no. 12, p. 124005, 2019.
422
+ [27] A. Punjani, J. L. Rubinstein, D. J. Fleet, and M. A. Brubaker, “cryoSPARC: Algorithms for rapid unsupervised cryo-EM structure determination,” Nature Methods, vol. 14, no. 3, p. 290, 2017.
423
+ [28] M. Zehni, S. Huang, I. Dokmanic, and Z. Zhao, “Distance retrieval from unknown view ´ tomography of 2d point sources,” Electronic Imaging, vol. 2019, no. 13, pp. 134–1, 2019.
424
+ [29] N. Miolane, F. Poitevin, Y.-T. Li, and S. Holmes, “Estimation of orientation and camera parameters from cryo-electron microscopy images with variational autoencoders and generative adversarial networks,” 2019.
425
+ [30] Y. LeCun, Y. Bengio, and G. Hinton, “Deep learning,” nature, vol. 521, no. 7553, pp. 436–444, 2015.
426
+ [31] R. R. Coifman, Y. Shkolnisky, F. J. Sigworth, and A. Singer, “Graph laplacian tomography from unknown random projections,” IEEE Transactions on Image Processing, vol. 17, no. 10, pp. 1891–1899, 2008.
427
+ [32] C. Sorzano, R. Marabini, J. Vargas, J. Otón, J. Cuenca-Alba, A. Quintana, J. de la Rosa-Trevín, and J. Carazo, “Interchanging geometry conventions in 3dem: mathematical context for the development of standards,” in Computational Methods for Three-Dimensional Microscopy Reconstruction. New York, NY: Springer New York, 2014, pp. 7–42. [Online]. Available: https://doi.org/10.1007/978-1-4614-9521-5_2
428
+ [33] D. Q. Huynh, “Metrics for 3D rotations: Comparison and analysis,” Journal of Mathematical Imaging and Vision, vol. 35, no. 2, pp. 155–164, 2009.
429
+ [34] S. Chopra, R. Hadsell, and Y. LeCun, “Learning a similarity metric discriminatively, with application to face verification,” in 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’05), vol. 1. IEEE, 2005, pp. 539–546.
430
+ [35] D. Yi, Z. Lei, S. Liao, and S. Z. Li, “Deep metric learning for person re-identification,” in 2014 22nd International Conference on Pattern Recognition. IEEE, 2014, pp. 34–39.
431
+ [36] M. A. Cox and T. F. Cox, “Multidimensional scaling,” in Handbook of data visualization. Springer, 2008, pp. 315–347.
432
+ [37] J. B. Tenenbaum, V. d. Silva, and J. C. Langford, “A global geometric framework for nonlinear dimensionality reduction,” Science, vol. 290, no. 5500, pp. 2319–2323, 2000. [Online]. Available: https://science.sciencemag.org/content/290/5500/2319
433
+ [38] S. T. Roweis and L. K. Saul, “Nonlinear dimensionality reduction by locally linear embedding,” Science, vol. 290, no. 5500, pp. 2323–2326, 2000.
434
+ [39] M. Belkin and P. Niyogi, “Laplacian eigenmaps for dimensionality reduction and data representation,” Neural computation, vol. 15, no. 6, pp. 1373–1396, 2003.
435
+ [40] L. Van der Maaten and G. Hinton, “Visualizing data using t-sne,” Journal of machine learning research, vol. 9, no. 11, 2008.
436
+ [41] L. McInnes, J. Healy, and J. Melville, “Umap: Uniform manifold approximation and projection for dimension reduction,” arXiv preprint arXiv:1802.03426, 2018.
437
+ [42] I. Dokmanic, R. Parhizkar, J. Ranieri, and M. Vetterli, “Euclidean distance matrices: essential theory, algorithms, and applications,” IEEE Signal Processing Magazine, vol. 32, no. 6, pp. 12–30, 2015.
438
+ [43] A. Bartesaghi, A. Merk, S. Banerjee, D. Matthies, X. Wu, J. L. Milne, and S. Subramaniam, “2.2 å resolution cryo-EM structure of $\beta$ -galactosidase in complex with a cell-permeant inhibitor,” Science, vol. 348, no. 6239, pp. 1147–1151, 2015.
439
+ [44] G. Laxmikanthan, C. Xu, A. F. Brilot, D. Warren, L. Steele, N. Seah, W. Tong, N. Grigorieff, A. Landy, and G. D. Van Duyne, “Structure of a holliday junction complex reveals mechanisms governing a highly regulated dna transaction,” Elife, vol. 5, p. e14313, 2016.
440
+ [45] E. F. Pettersen, T. D. Goddard, C. C. Huang, G. S. Couch, D. M. Greenblatt, E. C. Meng, and T. E. Ferrin, “Ucsf chimera—a visualization system for exploratory research and analysis,” Journal of Computational Chemistry, vol. 25, no. 13, pp. 1605–1612, 2004.
441
+ [46] W. van Aarle, W. J. Palenstijn, J. De Beenhouwer, T. Altantzis, S. Bals, K. J. Batenburg, and J. Sijbers, “The ASTRA toolbox: A platform for advanced algorithm development in electron tomography,” Ultramicroscopy, vol. 157, pp. 35–47, 2015.
442
+ [47] C. Sorzano, L. De La Fraga, R. Clackdoyle, and J. Carazo, “Normalizing projection images: A study of image normalizing procedures for single particle three-dimensional electron microscopy,” Ultramicroscopy, vol. 101, no. 2-4, pp. 129–138, 2004.
443
+ [48] H. Shigematsu and F. Sigworth, “Noise models and cryo-EM drift correction with a directelectron camera,” Ultramicroscopy, vol. 131, pp. 61–69, 2013.
444
+ [49] E. Strubell, A. Ganesh, and A. McCallum, “Energy and policy considerations for modern deep learning research,” Proceedings of the AAAI Conference on Artificial Intelligence, vol. 34, no. 09, pp. 13 693–13 696, Apr. 2020. [Online]. Available: https://ojs.aaai.org/index.php/AAAI/article/view/7123
445
+ [50] T. Tieleman and G. Hinton, “Lecture 6.5-rmsprop: Divide the gradient by a running average of its recent magnitude,” COURSERA: Neural networks for machine learning, vol. 4, no. 2, pp. 26–31, 2012.
446
+ [51] D. P. Kingma and J. Ba, “Adam: A method for stochastic optimization,” arXiv preprint arXiv:1412.6980, 2014.
447
+ [52] H. B. McMahan, D. Golovin, S. Chikkerur, D. Liu, M. Wattenberg, A. M. Hrafnkelsson, T. Boulos, J. Kubica, G. Holt, D. Sculley, M. Young, D. Ebner, J. Grady, L. Nie, T. Phillips, and E. Davydov, “Ad click prediction: a view from the trenches,” in Proceedings of the 19th ACM SIGKDD international conference on Knowledge discovery and data mining - KDD ’13. ACM Press, 2013, p. 1222. [Online]. Available: http://dl.acm.org/citation.cfm?doid $\mathbf { \Psi } =$ 2487575.2488200
448
+
449
+ # 34 Checklist
450
+
451
+ 1. For all authors...
452
+
453
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
454
+ (b) Did you describe the limitations of your work? [Yes] See $\ S 4$ .
455
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes] We didn’t identify any potential risk for improving protein imaging. Moreover, our work only addresses a small step in a huge pipeline. We however mentioned the environmental impact of training our model (see $\ S 4$ ).
456
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
457
+
458
+ 2. If you are including theoretical results...
459
+
460
+ (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]
461
+
462
+ 3. If you ran experiments...
463
+
464
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We include a URL in the Abstract to a git repository that includes code, data, and instructions to reproduce our results. Moreover, notebooks and an interactive website are provided to further play with the method.
465
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See $\ S 3 . 1$ (including Table 1) for the preparation of data and how they were split. See Appendix C for the hyperparameters.
466
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] When there was variance, e.g., on Figure 7 and Figure 17b.
467
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Appendix C.
468
+
469
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
470
+
471
+ (a) If your work uses existing assets, did you cite the creators? [Yes] We used proteins from the publicly available Protein Data Bank (PDB) and cited the ones we used, see $\ S 3 . 1$ . We also used and cited the ASTRA toolbox in the same section.
472
+ (b) Did you mention the license of the assets? [Yes] The license of our code is mentioned in the README.md and included in a LICENSE.txt file in our git repository. PDB data are free of all copyright restrictions and made fully and freely available for both non-commercial and commercial use.
473
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes] As a URL in the Abstract.
474
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] Our data are proteins.
475
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] Our data are proteins.
476
+
477
+ 5. If you used crowdsourcing or conducted research with human subjects...
478
+
479
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
480
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
481
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/jNTeYscgSw8/jNTeYscgSw8.md ADDED
@@ -0,0 +1,390 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DEMYSTIFYING LOSS FUNCTIONS FOR CLASSIFICATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ It is common to use the softmax cross-entropy loss to train neural networks on classification datasets where a single class label is assigned to each example. However, it has been shown that modifying softmax cross-entropy with label smoothing or regularizers such as dropout can lead to higher performance. In this paper, we compare a variety of loss functions and output layer regularization strategies that improve performance on image classification tasks. We find differences in the outputs of networks trained with these different objectives, in terms of accuracy, calibration, out-of-distribution robustness, and predictions. However, differences in hidden representations of networks trained with different objectives are restricted to the last few layers; representational similarity reveals no differences among network layers that are not close to the output. We show that all objectives that improve over vanilla softmax loss produce greater class separation in the penultimate layer of the network, which potentially accounts for improved performance on the original task, but results in features that transfer worse to other tasks.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Softmax cross-entropy (Bridle, 1990a;b) is the canonical loss function for multi-class classification in deep learning. However, the popularity of softmax cross-entropy appears to be driven by the aesthetic appeal of its probabilistic interpretation, rather than by practical superiority. Early studies reported no empirical advantage of softmax cross-entropy over squared-error loss (Richard & Lippmann, 1991; Weigend, 1993; Dietterich & Bakiri, 1994), and more recent work has found other objectives that yield better performance on certain tasks (e.g. Szegedy et al., 2016; Liu et al., 2016; Beyer et al., 2020). These studies show that it is possible to achieve meaningful improvements in accuracy simply by changing the loss function. Nonetheless, there has been little comparison among these alternative objectives, and even less investigation of why some objectives work better than others.
12
+
13
+ In this paper, we perform a comprehensive empirical study of the properties of 9 common and less-common loss functions and regularizers for deep learning, on standard image classification benchmarks. Most existing work in this area has proposed a new loss function or regularizer and attempted to demonstrate its superiority over a limited set of alternatives on benchmark tasks. This approach creates strong incentives to demonstrate the superiority of the proposed loss and little incentive to understand its limitations. Our goal is instead to understand when one might want to use one loss function or regularizer over another and, more broadly, to understand the extent to which neural network performance and representations can be manipulated through the choice of objective alone. Our key contributions are as follows:
14
+
15
+ • We rigorously benchmark 9 training objectives on standard image classification tasks, measuring accuracy, calibration, and out-of-distribution robustness. Many objectives improve over vanilla softmax cross-entropy loss, but no single objective performs best on all benchmarks. We demonstrate that different loss functions and regularizers produce different patterns of predictions, but combining them does not appear to improve accuracy. However, regularization that affects the input, such as AutoAugment (Cubuk et al., 2019) and Mixup (Zhang et al., 2017), can provide further gains. Our best models achieve state-of-the-art accuracy $( 7 9 . 1 \% / 9 4 . 5 \%$ top-1/top-5) on ImageNet for unmodified ResNet-50 architectures trained from scratch. Using centered kernel alignment (CKA), we measure the similarity of the hidden representations of networks trained with different objectives. We show that the choice of objective affects representations in network layers close to the output, but earlier layers are highly similar regardless of what loss function is used.
16
+
17
+ • We show that all objectives that improve accuracy over softmax cross-entropy also lead to greater separation between representations of different classes in the penultimate layer. This improvement in class separation may be related to the boost in accuracy these objectives provide. However, representations with greater class separation are also more heavily specialized for the original task, and linear classifiers operating on these features perform substantially worse on transfer tasks.
18
+
19
+ # 2 LOSS FUNCTIONS AND OUTPUT LAYER REGULARIZERS
20
+
21
+ We investigate 9 loss functions and output layer regularizers.Let $\boldsymbol { \ell } \in \mathbb { R } ^ { K }$ denote the network’s output (“logit”) vector, and let ${ \pmb t } \in \{ 0 , 1 \} ^ { \mathbf { \hat { K } } }$ denote a one-hot vector of targets, where $\| \mathbf { \boldsymbol { t } } \| _ { 1 } = 1$ . Let $\pmb { x } \in \mathbb { R } ^ { M }$ denote the vector of penultimate layer activations, which gives rise to the output vector as $\ell = W x + b$ , where $\pmb { W } \in \mathbb { R } ^ { \hat { K } \times M }$ is the matrix of final layer weights, and $^ { b }$ is a vector of biases.
22
+
23
+ All investigated loss functions include a term that encourages $\ell$ to have a high dot product with $\pmb { t }$ . To avoid solutions that make this dot product large simply by increasing the scale of $\ell$ , these loss functions must also include one or more contractive terms and/or normalize $\ell$ . Many “regularizers” correspond to additional contractive terms added to the loss, so we do not draw a firm distinction between losses and regularizers. We describe each loss in detail below. Hyperparameters are provided in Appendix A.1.
24
+
25
+ Softmax cross-entropy (Bridle, 1990a;b) is the de facto loss function for multi-class classification in deep learning. It can be written as:
26
+
27
+ $$
28
+ \mathcal { L } _ { \mathrm { s o f t m a x } } ( \ell , t ) = - \sum _ { k = 1 } ^ { K } t _ { k } \log \left( \frac { e ^ { \ell _ { k } } } { \sum _ { j = 1 } ^ { K } e ^ { \ell _ { j } } } \right) = - \sum _ { k = 1 } ^ { K } t _ { k } \ell _ { k } + \log \sum _ { k = 1 } ^ { K } e ^ { \ell _ { k } } .
29
+ $$
30
+
31
+ The loss consists of a term that maximizes the dot product between the logits and targets, as well as a contractive term that minimizes the LogSumExp of the logits.
32
+
33
+ Label smoothing (Szegedy et al., 2016) "smooths" the targets for softmax cross-entropy loss. The new targets are given by mixing the original targets with a uniform distribution over all labels, $t ^ { \prime } = t \times ( 1 - \alpha ) + \alpha / K$ , where $\alpha$ determines the weighting of the original and uniform targets. In order to maintain the same scale for the gradient with respect to the positive logit, in our experiments, we scale the label smoothing loss by $1 / ( 1 - \alpha )$ . The resulting loss is:
34
+
35
+ $$
36
+ \begin{array} { l } { \displaystyle \mathcal { L } _ { \mathrm { s m o o t h } } ( \ell , t ; \alpha ) = - \frac { 1 } { 1 - \alpha } \sum _ { k = 1 } ^ { K } \left( ( 1 - \alpha ) t _ { k } + \frac { \alpha } { K } \right) \log \left( \frac { e ^ { \ell _ { k } } } { \sum _ { j = 1 } ^ { K } e ^ { \ell _ { j } } } \right) } \\ { \displaystyle = - \sum _ { k = 1 } ^ { K } t _ { k } \ell _ { k } + \frac { 1 } { 1 - \alpha } \log \sum _ { k = 1 } ^ { K } e ^ { \ell _ { k } } - \frac { \alpha } { ( 1 - \alpha ) K } \sum _ { k = 1 } ^ { K } \ell _ { k } . } \end{array}
37
+ $$
38
+
39
+ Compared to softmax cross-entropy loss, label smoothing adds an additional term that encourages the logits to be positive. Müller et al. (2019) previously showed that label smoothing improves calibration and encourages class centroids to lie at the vertices of a regular simplex.
40
+
41
+ Dropout (Srivastava et al., 2014) is among the most prominent regularizers in the deep learning literature. We consider dropout applied to the penultimate layer of the neural network, i.e., when inputs to the final layer are randomly kept with some probability $\rho$ . When employing dropout, we replace the penultimate layer activations $_ { \textbf { \em x } }$ with $\tilde { \pmb { x } } = \pmb { x } \odot \pmb { \xi } / \rho$ where $\xi _ { i } \sim \mathrm { B e r n o u l l i } ( \rho )$ . Writing the dropped out logits as $\tilde { \ell } = W \tilde { \pmb { x } } + b$ , the dropout loss is:
42
+
43
+ $$
44
+ \mathcal { L } _ { \mathrm { d r o p o u t } } ( W , b , x , t ; p ) = \mathbb { E } _ { \xi } \left[ \mathcal { L } _ { \mathrm { s o f t m a x } } ( \tilde { \ell } , t ) \right]
45
+ $$
46
+
47
+ Dropout produces both implicit regularization, by introducing noise into the optimization process, and explicit regularization, by altering the representation that minimizes the loss (Wei et al., 2020). Wager et al. (2013) have previously derived a quadratic approximation to the explicit regularizer for logistic regression and other generalized linear models; this strategy can also be used to approximate the explicit regularization imposed by dropout on the penultimate layer of a neural network with softmax loss. However, we observe that penultimate layer dropout has similar effects to extra final layer $L ^ { 2 }$ regularization, suggesting that implicit regularization is the more important component.
48
+
49
+ Extra final layer $L ^ { 2 }$ regularization: It is common to place the same $L ^ { 2 }$ regularization on the final layer as elsewhere in the network. However, we find that applying greater $\bar { L } ^ { 2 }$ regularization to the final layer can improve performance. In architectures with batch normalization, adding additional $L ^ { 2 }$ regularization has no explicit regularizing effect if the learnable scale $( \gamma )$ parameters that are unregularized, but it still exerts an implicit regularizing effect by altering optimization.
50
+
51
+ Logit penalty: Whereas label smoothing encourages logits not to be too negative, and dropout imposes a penalty on the logits that depends on the covariance of the weights, an alternative possibility is simply to explicitly constrain logits to be small in $L ^ { 2 }$ norm:
52
+
53
+ $$
54
+ \mathcal { L } _ { \mathrm { l o g i t \_ p e n a l t y } } ( \ell , t ; \beta ) = \mathcal { L } _ { \mathrm { s o f t m a x } } ( \ell , t ) + \beta \Vert \ell \Vert ^ { 2 } .
55
+ $$
56
+
57
+ Logit normalization: We consider the use of $L ^ { 2 }$ normalization, rather than regularization, of the logits. Because the entropy of the output of the softmax function depends on the scale of the logits, which is lost after normalization, we introduce an additional temperature parameter $\tau$ that controls the magnitude of the logit vector, and thus, indirectly, the minimum entropy of the output distribution:
58
+
59
+ $$
60
+ \mathcal { L } _ { \mathrm { l o g i t \_ n o r m } } ( \ell , t ; \tau ) = \mathcal { L } _ { \mathrm { s o f t m a x } } ( \ell / ( \tau \| \ell \| ) , t )
61
+ $$
62
+
63
+ Cosine softmax: We additionally consider $L ^ { 2 }$ normalization of both the penultimate layer features and the final layer weights corresponding to each class. This loss is equivalent to softmax crossentropy loss if the logits are given by cosine similarity $\sin ( \mathbf x , \pmb y ) = \pmb x ^ { \dag } \pmb y / ( \| \pmb x \| \| \pmb y \| )$ between the weight vector and the penultimate layer plus a per-class bias:
64
+
65
+ $$
66
+ \mathcal { L } _ { \mathrm { c o s \mathrm { . } s o f t m a x } } ( W , b , x , t ; \tau ) = - \sum _ { k = 1 } ^ { K } t _ { k } \left( \sin ( W _ { k , : } , x ) / \tau + b _ { k } \right) + \log \sum _ { k = 1 } ^ { K } e ^ { \sin ( W _ { k , : } , x ) / \tau + b _ { k } }
67
+ $$
68
+
69
+ where $\tau$ is a temperature parameter as above. Similar losses have appeared in previous literature (Ranjan et al., 2017; Wojke & Bewley, 2018; Wang et al., 2018a;b; Deng et al., 2019; Liu et al., 2017), and variants have introduced explicit additive or multiplicative margins to this loss that we do not consider here (Liu et al., 2017; Wang et al., 2018a;b; Deng et al., 2019). It is possible that performance could be enhanced by employing one of these margin schemes, although we observe that manipulating the temperature alone has a large impact on observed class separation.
70
+
71
+ Sigmoid cross-entropy is the natural analog to softmax cross-entropy for multi-label classification problems. Although we investigate only single-label multi-class classification tasks, we train networks with sigmoid cross-entropy and evaluate accuracy by ranking the logits of the sigmoids. This approach is related to the one-versus-rest strategy for converting binary classifiers to multi-class classifiers. The sigmoid cross-entropy loss is:
72
+
73
+ $$
74
+ \begin{array} { l } { { \displaystyle { \mathcal { L } } _ { \mathrm { s i g m o i d } } ( \ell , t ) = - \sum _ { k = 1 } ^ { K } \left( t _ { k } \log \left( \frac { e ^ { \ell _ { k } } } { e ^ { \ell _ { k } } + 1 } \right) + ( 1 - t _ { k } ) \log \left( 1 - \frac { e ^ { \ell _ { k } } } { e ^ { \ell _ { k } } + 1 } \right) \right) } } \\ { { \displaystyle \quad = - \sum _ { k = 1 } ^ { K } t _ { k } \ell _ { k } + \sum _ { k = 1 } ^ { K } \log ( e ^ { \ell _ { k } } + 1 ) } . } \end{array}
75
+ $$
76
+
77
+ The LogSumExp term of softmax loss is replaced with the sum of the softplus-transformed logits. We initialize the biases of the logits $^ { b }$ to $- \log ( K )$ so that the initial output probabilities are approximately $1 / K$ . Beyer et al. (2020) have previously shown that sigmoid cross-entropy loss leads to improved accuracy on ImageNet relative to softmax cross-entropy.
78
+
79
+ Squared error: Finally, we investigate squared error loss, as formulated by Hui & Belkin (2020):
80
+
81
+ $$
82
+ \mathcal { L } _ { \mathrm { s q u a r e d } _ { - } \mathrm { e r r o r } } ( \ell , t ; \kappa , M ) = \frac { 1 } { K } \sum _ { k = 1 } ^ { K } \left( \kappa t _ { k } ( \ell _ { k } - M ) ^ { 2 } + ( 1 - t _ { k } ) \ell _ { k } ^ { 2 } \right)
83
+ $$
84
+
85
+ where $\kappa$ and $M$ are hyperparameters. $\kappa$ sets the strength of the loss for the correct class relative to incorrect classes, whereas $M$ controls the magnitude of the correct class target. When $\kappa = M = 1$ , the loss is simply the mean squared error between $\ell$ and $\pmb { t }$ . Like Hui & Belkin (2020), we find that placing greater weight on the correct class slightly improves ImageNet accuracy.
86
+
87
+ # 3 RESULTS
88
+
89
+ For each loss, we trained 8 ResNet-50 (He et al., 2016; Gross & Wilber, 2016) models on ImageNet. To tune loss hyperparameters and the epoch for early stopping, we performed 3 training runs per hyperparameter configuration where we held out a validation set of 50,046 ImageNet training example.
90
+
91
+ Table 1: Regularizers and alternative losses improve ImageNet accuracy. Accuracy of models trained with different losses/regularizers on the ImageNet validation (mean $\pm$ standard error of 8 models) and CIFAR-10 and CIFAR-100 test sets (mean $\pm$ standard error of 25 models). Losses are sorted from lowest to highest ImageNet top-1 accuracy. Accuracy values not significantly different from the best $( p > 0 . 0 5$ , t-test) are bold-faced.
92
+
93
+ <table><tr><td></td><td colspan="2">ImageNet (ResNet-50)</td><td>CIFAR-10</td><td>CIFAR-100</td></tr><tr><td>Loss/regularizer</td><td>Top-1 Acc. (%)</td><td>Top-5 Acc. (%)</td><td>(All-CNN-C + BN)</td><td>(WRN 16-8)</td></tr><tr><td>Softmax</td><td>77.0±0.06</td><td>93.40 ± 0.02</td><td>93.49 ± 0.03</td><td>79.7 ± 0.04</td></tr><tr><td>Squared error</td><td>77.2 ±0.04</td><td>92.79±0.02</td><td>93.31 ±0.02</td><td>79.4± 0.05</td></tr><tr><td>Dropout</td><td>77.5 ± 0.04</td><td>93.62 ±0.02</td><td>93.74± 0.03</td><td>79.5 ± 0.06</td></tr><tr><td>Label smoothing</td><td>77.6 ± 0.03</td><td>93.78 ± 0.01</td><td>93.79±0.03</td><td>80.0±0.05</td></tr><tr><td>Extra final layer L²</td><td>77.7 ± 0.03</td><td>93.79±0.02</td><td>93.63 ± 0.03</td><td>80.2 ±0.05</td></tr><tr><td>Logit penalty</td><td>77.7 ± 0.02</td><td>93.83±0.02</td><td>93.84±0.04</td><td>80.2 ±0.05</td></tr><tr><td>Logit normalization</td><td>77.8 ± 0.02</td><td>93.71 ± 0.02</td><td>93.55 ± 0.03</td><td>78.9 ± 0.05</td></tr><tr><td>Cosine softmax</td><td>77.9 ± 0.02</td><td>93.86 ± 0.01</td><td>93.64 ± 0.03</td><td>80.1 ± 0.06</td></tr><tr><td>Sigmoid</td><td>77.9± 0.05</td><td>93.50±0.02</td><td>93.79±0.04</td><td>80.0±0.05</td></tr></table>
94
+
95
+ We also trained 25 batch-normalized All-CNN-C (Springenberg et al., 2014) models for each loss on CIFAR-10 (Krizhevsky & Hinton, 2009), where we performed extensive hyperparameter tuning for learning rate and weight decay in addition to loss hyperparameters. We provide further details regarding training and hyperparameter selection in Appendix A.1.
96
+
97
+ # 3.1 REGULARIZERS AND ALTERNATIVE LOSSES ENHANCE ACCURACY
98
+
99
+ We found that, when properly tuned, many investigated objectives often provide a statistically significant improvement over softmax cross-entropy, as shown in Table 1. The range of improvements was small, but meaningful, with sigmoid cross-entropy and cosine softmax both leading to an improvement of $0 . 9 \%$ in top-1 accuracy over the baseline for ResNet-50 on ImageNet. No single loss performed best across all benchmarks, although cosine softmax, logit penalty, and sigmoid were frequently among the top-performing losses.
100
+
101
+ Losses that yielded large improvements in top-1 accuracy on ImageNet did not necessarily improve top-5 accuracy. For ResNet-50, sigmoid cross-entropy led to a large $( 0 . 9 \% )$ improvement in top-1 accuracy over vanilla softmax cross-entropy, but only a small $( 0 . 1 \% )$ improvement in top-5 accuracy. Cosine softmax performed comparably to sigmoid cross-entropy in terms of top-1 accuracy, but better in top-5 accuracy, with a $0 . 4 \%$ improvement over the baseline. Similar patterns were observed for Inception v3 (Table B.1), where sigmoid cross-entropy was the best-performing model in terms of top-1 accuracy but performed worse than the softmax baseline in terms of top-5 accuracy.
102
+
103
+ Losses also differed in out-of-distribution robustness, and in the calibration of the resulting predictions. Table B.2 shows results on the out-of-distribution test sets ImageNet-v2 (Recht et al., 2019), ImageNetA (Hendrycks et al., 2019), ImageNet-Sketch (Wang et al., 2019), ImageNet-R (Hendrycks et al., 2020), and ImageNet-C (Hendrycks & Dietterich, 2019). In almost all cases, alternative loss functions outperformed softmax cross-entropy, with logit normalization and cosine softmax typically performing slightly better than alternatives. Effects on calibration, shown in Table B.3, were mixed. Label smoothing substantially reduced expected calibration error (Guo et al., 2017), as previously shown by Müller et al. (2019), although cosine softmax achieved a lower negative log likelihood. However, there was no clear relationship between calibration and accuracy. Although logit penalty performed well in terms of accuracy, it provided the worst calibration of any objective investigated.
104
+
105
+ Our attempts to achieve higher accuracy by combining objectives were unsuccessful. As described in Appendix C, adding additional regularization did not improve performance of well-tuned loss functions, and normalized variants of sigmoid cross-entropy loss failed to improve accuracy on ImageNet. However, it was still possible to improve networks’ performance substantially using AutoAugment (Cubuk et al., 2019) or Mixup (Zhang et al., 2017), and gains from improved losses and these data augmentation strategies were approximately additive (Table C.2). With longer training, both sigmoid cross-entropy and cosine softmax achieve state-of-the-art accuracy among ResNet-50 networks trained with AutoAugment (Table C.3), matching or outperforming supervised contrastive learning (Khosla et al., 2020). Combining cosine softmax loss, AutoAugment, and Mixup, we achieve $7 9 . 1 \%$ top-1 accuracy and $9 4 . 5 \%$ top-5 accuracy, which is to our knowledge the best reported $2 2 4 \times 2 2 4$ pixel single-crop accuracy with an unmodified ResNet-50 architecture trained from scratch.
106
+
107
+ ![](images/cfc3c785d4f2c482d53cd03a058aafee461bd638df6327d79de3762a78d2ea19.jpg)
108
+ Figure 1: Different losses produce different predictions. a: Percentages of ImageNet validation set examples for which models assign the same top-1 predictions, for 8 seeds of ResNet-50 models. b: Dendrogram based on similarity of predictions. All models naturally cluster according to loss, except for “Dropout” and “More Final Layer ${ \mathrm { L } } 2 ^ { , , }$ models. See also Figure D.1.
109
+
110
+ ![](images/54310b5806959f7bacbcbdb67c246ca8a7ad4c3eb84a2cf2e99cf8ef5226c7b9.jpg)
111
+ Figure 2: Loss functions affect sparsity of later layer representations. Plot shows the average $\%$ non-zero activations for each ResNet-50 block, after the residual connection and subsequent nonlinearity, on the ImageNet validation set. Dashed lines indicate boundaries between stages.
112
+
113
+ # 3.2 DIFFERENT LOSSES PRODUCE DIFFERENT PREDICTIONS
114
+
115
+ Given that effects of regularization were non-additive, we sought to determine whether different regularizers and losses had similar effects on network predictions. For each pair of models, we measured the percentage of images in the ImageNet validation set where both models predicted the same class. The results are shown in Figure 1. We also examined the percentage of images that where both models are either correct or incorrect, and the agreement on examples that both models get incorrect (Figure D.1). All ways of measuring similarity of predictions yielded similar results.
116
+
117
+ Models’ predictions clustered into distinct groups according to their loss functions. Models trained from different initializations with the same loss function were more similar than models trained with different loss functions. However, all models trained with (regularized) softmax loss or sigmoid loss were more similar to each other than they were to models trained with logit or feature $^ +$ weight normalization. Networks trained with squared error were dissimilar to all others examined.
118
+
119
+ Variability in predictions of models trained with the same loss but different random initializations was large. Although standard deviations in top-1 accuracy were ${ < } 0 . 2 \%$ for all losses, even the most similar pair of models disagreed on $1 3 . 9 \%$ of test set examples. When ensembling the 8 models trained with the same loss but different random initializations, the least similar losses (softmax and squared error) disagreed on only $1 1 . 5 \%$ of examples (Figure D.2). The accuracy of ensembles of models trained with different losses was closely related to the accuracies of the constituent models; ensembling models trained with the two best losses yielded only modest accuracy improvements over ensembles trained with either loss alone (Figure D.3).
120
+
121
+ # 3.3 LOSSES PRIMARILY AFFECT HIDDEN REPRESENTATIONS CLOSE TO THE OUTPUT
122
+
123
+ Loss functions differ not only in their predictions, but also in their effects on internal representations of neural networks. In Figure 2, we show the sparsity of the activations of layers of networks trained with different loss functions. In all networks, the percentage of non-zero ReLU activations decreased with depth, attaining its minimum at the last convolutional layer. In the first three ResNet stages, activation sparsity was broadly similar regardless of the loss. However, in the final stage and penultimate average pooling layer, there were substantial differences.
124
+
125
+ ![](images/8c4c1859b99e03fe68f5dff760de7fd97d6d70b2cc46e3c042337f7ea3d82155.jpg)
126
+ Figure 3: The loss function has little impact on representations in early network layers. All plots show linear centered kernel alignment (CKA) between representations computed on the ImageNet validation set. a: CKA between network layers, for pairs of networks trained from different initializations. b: CKA between representations extracted from architecturally corresponding layers of networks trained with different loss functions. Diagonal reflects similarity of networks with the same loss function trained from different initalizations.
127
+
128
+ Given that these observations, we wondered whether the choice of loss had any effect on representations in these layers at all. We used linear centered kernel alignment (CKA) (Kornblith et al., 2019a; Cortes et al., 2012; Cristianini et al., 2002) to measure the similarity between networks’ hidden representations. As shown in Figure 3, representations of corresponding early, but not late, network layers were highly similar regardless of loss function. These results provide further confirmation that effects of the loss function are limited to later network layers.
129
+
130
+ # 3.4 REGULARIZATION IMPROVES CLASS SEPARATION
131
+
132
+ Is there a feature of the investigated regularizers that can potentially explain their beneficial effect on accuracy? We demonstrate that all investigated regularizers and alternative losses force the network to shrink or eliminate directions in the penultimate layer representation space that are not aligned with weight vectors. The universality of this finding suggests it may relate to the accuracy-enhancing properties of these losses.
133
+
134
+ The ratio of the average within-class cosine distance to the overall average cosine distance provides a measure of how distributed examples within a class are that is between 0 and 1. We take one minus this quantity to get a closed-form measure of class separation:
135
+
136
+ $$
137
+ R ^ { 2 } = 1 - \frac { \sum _ { k = 1 } ^ { K } \sum _ { m = 1 } ^ { N _ { k } } \sum _ { n = 1 } ^ { N _ { k } } \left( 1 - \sin ( \mathbf { x } _ { k , m } , \mathbf { x } _ { k , n } ) \right) / N _ { K } ^ { 2 } } { \sum _ { j = 1 } ^ { K } \sum _ { k = 1 } ^ { K } \sum _ { m = 1 } ^ { N _ { j } } \sum _ { n = 1 } ^ { N _ { k } } \left( 1 - \sin ( \mathbf { x } _ { j , m } , \mathbf { x } _ { k , n } ) \right) / ( N _ { j } N _ { k } ) }
138
+ $$
139
+
140
+ where ${ \pmb x } _ { k , m }$ is the embedding of example $m$ in class $k$ , $N _ { k }$ is the number of examples in class $k$ , and $\sin ( \mathbf { x } , \mathbf { y } ) = \mathbf { x } ^ { \mathsf { T } } \mathbf { y } / ( \| \mathbf { x } \| \| \mathbf { y } \| )$ is cosine similarity between vectors. If the embeddings are first $L ^ { 2 }$ normalized, then $1 - R ^ { 2 }$ is the ratio of the average within-class variance to the weighted total variance, where the weights are inversely proportional to the number of examples in each class. For a balanced dataset, $R ^ { 2 }$ is also equivalent to centered kernel alignment (Cortes et al., 2012; Cristianini et al., 2002) between the embeddings and the one-hot label matrix, with a cosine kernel. We also examined alternative class separation metrics (Appendix E); results were similar.
141
+
142
+ Table 2: Regularization and alternative losses improve class separation in the penultimate layer. Results averaged over 8 ResNet-50 models per loss on the ImageNet training set.
143
+
144
+ <table><tr><td>Loss/regularizer</td><td>Class separation (R²)</td></tr><tr><td>Softmax</td><td>0.3494± 0.0002 0.8452 ± 0.0002</td></tr><tr><td>Squared error Dropout</td><td>0.4606 ± 0.0003</td></tr><tr><td>Label smoothing</td><td>0.4197 ± 0.0003</td></tr><tr><td>Extra L²</td><td>0.5718 ± 0.0006</td></tr><tr><td>Logit penalty</td><td>0.6012 ± 0.0004</td></tr><tr><td>Logit norm</td><td>0.5167 ± 0.0002</td></tr><tr><td>Cosine softmax</td><td>0.6406 ± 0.0003</td></tr><tr><td></td><td></td></tr><tr><td>Sigmoid</td><td>0.4267 ± 0.0003</td></tr></table>
145
+
146
+ ![](images/e76c6bca787504d0142481762c42a339d8705283a7eeba55989cd71c471d2af9.jpg)
147
+ Figure 4: Class separation in different layers of ResNet-50 models, on the ImageNet training set.
148
+
149
+ Table 3: Regularized networks learn features specialized to ImageNet. Accuracy of linear classifiers $L ^ { 2 }$ - regularized multinomial logistic regression) trained to classify different datasets using fixed penultimate layer features. IN(50k) reflects accuracy of a classifier trained on 50,046 examples from the ImageNet training set and tested on the validation set. See Appendix A.2 for training details.
150
+
151
+ <table><tr><td>Pretraining loss</td><td>Food</td><td>CIFAR10</td><td>CIFAR100</td><td>Birdsnap</td><td>SUN397</td><td>Cars</td><td>Pets</td><td>Flowers</td><td>IN(50k)</td></tr><tr><td>Softmax</td><td>74.6</td><td>92.4</td><td>76.9</td><td>55.4</td><td>62.0</td><td>60.3</td><td>92.0</td><td>94.0</td><td>71.1</td></tr><tr><td>Squared error</td><td>39.8</td><td>82.2</td><td>56.3</td><td>21.8</td><td>39.9</td><td>15.3</td><td>84.7</td><td>46.7</td><td>76.7</td></tr><tr><td>Dropout</td><td>72.6</td><td>91.4</td><td>75.0</td><td>53.6</td><td>61.2</td><td>54.7</td><td>92.6</td><td>92.1</td><td>74.8</td></tr><tr><td>Label smoothing</td><td>72.7</td><td>91.6</td><td>75.2</td><td>53.6</td><td>61.6</td><td>54.8</td><td>92.9</td><td>91.9</td><td>74.5</td></tr><tr><td>Extra L²</td><td>70.6</td><td>91.0</td><td>73.7</td><td>51.5</td><td>60.1</td><td>50.3</td><td>92.4</td><td>89.8</td><td>75.9</td></tr><tr><td>Logit penalty</td><td>68.1</td><td>90.2</td><td>72.3</td><td>48.1</td><td>59.0</td><td>48.3</td><td>92.3</td><td>86.6</td><td>76.4</td></tr><tr><td>Logit norm</td><td>66.3</td><td>90.5</td><td>72.9</td><td>50.7</td><td>58.1</td><td>45.4</td><td>92.0</td><td>82.9</td><td>75.1</td></tr><tr><td>Cosine softmax</td><td>62.0</td><td>89.9</td><td>71.3</td><td>45.4</td><td>55.0</td><td>36.7</td><td>91.1</td><td>75.3</td><td>76.9</td></tr><tr><td>Sigmoid</td><td>73.4</td><td>91.7</td><td>75.7</td><td>52.3</td><td>62.0</td><td>56.1</td><td>92.5</td><td>92.9</td><td>74.3</td></tr></table>
152
+
153
+ As shown in Table 2 and Figure 4, all regularizers and alternative loss functions resulted in greater class separation in penultimate (average pooling) layer representations as compared to softmax loss. Whereas additional final layer $L ^ { 2 }$ , logit penalty, and squared error also produced greater class separation before the penultimate layer, other losses did not.
154
+
155
+ Although losses that improve class separation also improve accuracy on the ImageNet validation set, they result in penultimate layer features that are substantially less useful for other tasks. Kornblith et al. (2019b) previously showed that networks trained with label smoothing and dropout learn less transferable features. As in this work, we trained logistic regression classifiers to classify a selection of transfer datasets (Bossard et al., 2014; Krizhevsky & Hinton, 2009; Berg et al., 2014; Xiao et al., 2010; Krause et al., 2013; Parkhi et al., 2012; Nilsback & Zisserman, 2008), using fixed features from networks trained with different losses. As shown in Table 3, features from networks trained with vanilla softmax loss yield the highest transfer accuracy. However, when we attempted to relearn the original 1000-way ImageNet classifier using 50,046 training set examples, features from networks trained with vanilla softmax loss performed worst. Thus, the ease with which ImageNet classifier weights can be relearned from representations is inversely related to the performance of these representations when they are used to classify other datasets (Figure 5).
156
+
157
+ To confirm this relationship between class separation, ImageNet accuracy, and transfer, we trained models with cosine softmax with varying values of the temperature parameter $\tau$ .1 As shown in Table 4, lower temperatures resulted in lower top-1 accuracies and worse class separation, and made the ImageNet classifier weights more difficult to recover. However, even though the lowest temperature achieved $2 . 7 \%$ lower accuracy on ImageNet compared to higher temperatures, this lowest temperature yielded the better features for nearly all transfer datasets. Thus, $\tau$ controls a tradeoff between the generalizability of penultimate-layer features and the accuracy on the target dataset.
158
+
159
+ ![](images/167dd725aa0adfc6785f0fd09fe0470e420c3a52107bb44419a0b7ed263f9aef.jpg)
160
+ Figure 5: Transfer accuracy and accuracy of relearned ImageNet weights are negatively related. a: Average transfer task accuracy versus accuracy of a classifier trained on 50,046 ImageNet training set examples and tested on the validation set for different objectives. b: Relationship of transfer accuracy and relearned ImageNet accuracy with cosine softmax temperature.
161
+
162
+ Table 4: Temperature of cosine softmax loss controls ImageNet top-1 accuracy, class separation $( R ^ { 2 } )$ , and linear transfer accuracy.
163
+
164
+ <table><tr><td></td><td colspan="2">ImageNet</td><td colspan="10"></td></tr><tr><td>Temp.</td><td>Top-1</td><td>R²</td><td>Food</td><td>CIFAR10</td><td>CIFAR100</td><td>Birdsnap</td><td>SUN397</td><td></td><td>Cars</td><td>Pets</td><td>Flowers</td><td>IN(50k)</td></tr><tr><td>0.01</td><td>74.9</td><td>0.236</td><td>73.4</td><td>91.9</td><td>76.5</td><td>57.2</td><td></td><td>60.5</td><td>62.9</td><td>91.7</td><td>93.6</td><td>67.0</td></tr><tr><td>0.02</td><td>77.0</td><td>0.358</td><td>72.1</td><td></td><td>91.8</td><td>76.2</td><td>56.5</td><td>60.4</td><td>58.5</td><td>92.2</td><td>91.2</td><td>70.8</td></tr><tr><td>0.03</td><td>77.5</td><td>0.475</td><td>69.1</td><td></td><td>91.5</td><td>74.9</td><td>53.7</td><td>59.1</td><td>51.8</td><td>92.3</td><td>87.4</td><td>74.3</td></tr><tr><td>0.04</td><td>77.6</td><td>0.562</td><td>66.0</td><td></td><td>90.7</td><td>73.8</td><td>50.3</td><td>57.4</td><td>45.1</td><td>91.7</td><td>82.2</td><td>75.7</td></tr><tr><td>0.05</td><td>77.6</td><td>0.634</td><td>62.8</td><td>90.4</td><td></td><td>72.2</td><td>47.6</td><td>55.4</td><td>38.6</td><td>91.0</td><td>78.3</td><td>76.4</td></tr><tr><td>0.06</td><td>77.5</td><td>0.693</td><td>60.3</td><td>89.3</td><td></td><td>69.8</td><td>43.3</td><td>53.8</td><td>33.3</td><td>91.0</td><td>72.7</td><td>76.6</td></tr><tr><td>0.07</td><td>77.5</td><td>0.738</td><td>57.1</td><td>88.7</td><td></td><td>68.6</td><td>39.6</td><td>51.4</td><td>29.1</td><td>90.2</td><td>67.9</td><td>76.8</td></tr><tr><td>0.08</td><td>77.6</td><td>0.770</td><td>53.7</td><td></td><td>87.7</td><td>66.5</td><td>35.5</td><td>49.4</td><td>25.7</td><td>89.3</td><td>63.2</td><td>77.0</td></tr></table>
165
+
166
+ # 4 RELATED WORK
167
+
168
+ Theoretical analysis of loss functions is challenging; in most cases, solutions cannot be expressed in closed form even when the predictor is linear. However, Soudry et al. (2018) have previously shown that, on linearly separable data, gradient descent on the unregularized logistic or multinomial logistic regression objectives (i.e., linear models with sigmoid or softmax cross-entropy loss) eventually converges to the minimum norm solution. These results can be extended to neural networks in certain restricted settings (Soudry et al., 2018; Gunasekar et al., 2018; Wei et al., 2019).
169
+
170
+ Our study of class separation in penultimate layers of neural networks is related to work investigating angular visual hardness (Chen et al., 2019), which measures the arccosine-transformed cosine similarity between the weight vectors and examples. This metric is similar to the class separation metric we apply (Eq. 11), but fails to differentiate between networks trained with softmax and sigmoid cross-entropy; see Appendix Figure E.1. Other work has investigated how class information evolves through the hidden layers of neural networks, using linear classifiers (Alain & Bengio, 2016), binning estimators of mutual information (Shwartz-Ziv & Tishby, 2017; Saxe et al., 2019; Goldfeld et al., 2018), Euclidean distances (Schilling et al., 2018), and manifold geometry (Cohen et al., 2020). However, this previous work has not analyzed how training objectives affect these measures.
171
+
172
+ The loss functions we investigate are only a subset of those explored in past literature. We have excluded loss functions that require specially constructed batches from the current investigation (Snell et al., 2017; Khosla et al., 2020), as well as losses designed for situations with high label noise (Jindal et al., 2016; Ghosh et al., 2017; Patrini et al., 2017; Amid et al., 2019; Lukasik et al., 2020). Other work has investigated replacing the softmax function with other functions that lead to normalized class probabilities (de Brébisson & Vincent, 2015; Laha et al., 2018). Our approach is related to previous studies of metric learning (Musgrave et al., 2020) and optimizers (Choi et al., 2019).
173
+
174
+ # 5 CONCLUSION
175
+
176
+ Our study identifies many similarities among networks trained with different objectives. On CIFAR10, CIFAR-100, and ImageNet, different losses and regularizers achieve broadly similar accuracies. Although the accuracy differences are large enough to be meaningful in some contexts, the largest is still ${ < } 1 . 5 \%$ . Representational similarity analysis using centered kernel alignment indicates that the choice of loss function affects representations in only the last few layers of the network, suggesting inherent limitations to what can be achieved by manipulating the loss. However, we also show that different objectives lead to substantially different penultimate layer representations. We find that class separation is an important factor that distinguishes these different penultimate layer representations, and show that it is inversely related to transferability of representations to other tasks.
177
+
178
+ # REFERENCES
179
+
180
+ Guillaume Alain and Yoshua Bengio. Understanding intermediate layers using linear classifier probes. arXiv preprint arXiv:1610.01644, 2016.
181
+
182
+ Ehsan Amid, Manfred KK Warmuth, Rohan Anil, and Tomer Koren. Robust bi-tempered logistic loss based on bregman divergences. In Advances in Neural Information Processing Systems, pp. 15013–15022, 2019.
183
+
184
+ Thomas Berg, Jiongxin Liu, Seung Woo Lee, Michelle L Alexander, David W Jacobs, and Peter N Belhumeur. Birdsnap: Large-scale fine-grained visual categorization of birds. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2019–2026. IEEE, 2014.
185
+
186
+ 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.
187
+
188
+ Lukas Bossard, Matthieu Guillaumin, and Luc Van Gool. Food-101 — mining discriminative components with random forests. In European Conference on Computer Vision, pp. 446–461. Springer, 2014.
189
+
190
+ John S Bridle. Probabilistic interpretation of feedforward classification network outputs, with relationships to statistical pattern recognition. In Neurocomputing, pp. 227–236. Springer, 1990a.
191
+
192
+ John S Bridle. Training stochastic model recognition algorithms as networks can lead to maximum mutual information estimation of parameters. In Advances in neural information processing systems, pp. 211–217, 1990b.
193
+
194
+ Beidi Chen, Weiyang Liu Animesh Garg, Zhiding Yu, Anshumali Shrivastava, Jan Kautz, and Anima Anandkumar. Angular visual hardness. arXiv preprint arXiv:1912.02279, 2019.
195
+
196
+ Dami Choi, Christopher J Shallue, Zachary Nado, Jaehoon Lee, Chris J Maddison, and George E Dahl. On empirical comparisons of optimizers for deep learning. arXiv preprint arXiv:1910.05446, 2019.
197
+
198
+ Uri Cohen, SueYeon Chung, Daniel D Lee, and Haim Sompolinsky. Separability and geometry of object manifolds in deep neural networks. Nature communications, 11(1):1–13, 2020.
199
+
200
+ Corinna Cortes, Mehryar Mohri, and Afshin Rostamizadeh. Algorithms for learning kernels based on centered alignment. The Journal of Machine Learning Research, 13(1):795–828, 2012.
201
+
202
+ Nello Cristianini, John Shawe-Taylor, Andre Elisseeff, and Jaz S Kandola. On kernel-target alignment. In Advances in neural information processing systems, pp. 367–373, 2002.
203
+
204
+ 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.
205
+
206
+ Alexandre de Brébisson and Pascal Vincent. An exploration of softmax alternatives belonging to the spherical loss family. arXiv preprint arXiv:1511.05042, 2015.
207
+
208
+ Jiankang Deng, Jia Guo, Niannan Xue, and Stefanos Zafeiriou. Arcface: Additive angular margin loss for deep face recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4690–4699, 2019.
209
+
210
+ Thomas G Dietterich and Ghulum Bakiri. Solving multiclass learning problems via error-correcting output codes. Journal of artificial intelligence research, 2:263–286, 1994.
211
+
212
+ Aritra Ghosh, Himanshu Kumar, and PS Sastry. Robust loss functions under label noise for deep neural networks. arXiv preprint arXiv:1712.09482, 2017.
213
+
214
+ Ziv Goldfeld, Ewout van den Berg, Kristjan Greenewald, Igor Melnyk, Nam Nguyen, Brian Kingsbury, and Yury Polyanskiy. Estimating information flow in deep neural networks. arXiv preprint arXiv:1810.05728, 2018.
215
+
216
+ Priya Goyal, Piotr Dollár, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch sgd: training imagenet in 1 hour. arXiv preprint arXiv:1706.02677, 2017.
217
+
218
+ Sam Gross and Michael Wilber. Training and investigating residual nets. In The Torch Blog. http://torch.ch/blog/2016/02/04/resnets.html, 2016.
219
+
220
+ Suriya Gunasekar, Jason D Lee, Daniel Soudry, and Nati Srebro. Implicit bias of gradient descent on linear convolutional networks. In Advances in Neural Information Processing Systems, pp. 9461–9471, 2018.
221
+
222
+ Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger. On calibration of modern neural networks. In International Conference on Machine Learning, pp. 1321–1330, 2017.
223
+
224
+ 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.
225
+
226
+ Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. ICLR, 2019.
227
+
228
+ Dan Hendrycks, Kevin Zhao, Steven Basart, Jacob Steinhardt, and Dawn Song. Natural adversarial examples. arXiv preprint arXiv:1907.07174, 2019.
229
+
230
+ 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.
231
+
232
+ Like Hui and Mikhail Belkin. Evaluation of neural architectures trained with square loss vs crossentropy in classification tasks. arXiv preprint arXiv:2006.07322, 2020.
233
+
234
+ Ishan Jindal, Matthew Nokleby, and Xuewen Chen. Learning deep networks from noisy labels with dropout regularization. In 2016 IEEE 16th International Conference on Data Mining (ICDM), pp. 967–972. IEEE, 2016.
235
+
236
+ Prannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna, Yonglong Tian, Phillip Isola, Aaron Maschinot, Ce Liu, and Dilip Krishnan. Supervised contrastive learning. arXiv preprint arXiv:2004.11362, 2020.
237
+
238
+ Simon Kornblith, Mohammad Norouzi, Honglak Lee, and Geoffrey Hinton. Similarity of neural network representations revisited. arXiv preprint arXiv:1905.00414, 2019a.
239
+
240
+ Simon Kornblith, Jonathon Shlens, and Quoc V Le. Do better imagenet models transfer better? In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2661–2671, 2019b.
241
+
242
+ Jonathan Krause, Jia Deng, Michael Stark, and Li Fei-Fei. Collecting a large-scale dataset of fine-grained cars. In Second Workshop on Fine-Grained Visual Categorization, 2013.
243
+
244
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009. URL https://www.cs.toronto.edu/ \~kriz/learning-features-2009-TR.pdf.
245
+
246
+ Anirban Laha, Saneem Ahmed Chemmengath, Priyanka Agrawal, Mitesh Khapra, Karthik Sankaranarayanan, and Harish G Ramaswamy. On controllable sparse alternatives to softmax. In Advances in Neural Information Processing Systems, pp. 6422–6432, 2018.
247
+
248
+ Weiyang Liu, Yandong Wen, Zhiding Yu, and Meng Yang. Large-margin softmax loss for convolutional neural networks. In ICML, volume 2, pp. 7, 2016.
249
+
250
+ Weiyang Liu, Yandong Wen, Zhiding Yu, Ming Li, Bhiksha Raj, and Le Song. Sphereface: Deep hypersphere embedding for face recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 212–220, 2017.
251
+
252
+ Michal Lukasik, Srinadh Bhojanapalli, Aditya Krishna Menon, and Sanjiv Kumar. Does label smoothing mitigate label noise? arXiv preprint arXiv:2003.02819, 2020.
253
+
254
+ Rafael Müller, Simon Kornblith, and Geoffrey E Hinton. When does label smoothing help? In Advances in Neural Information Processing Systems, pp. 4696–4705, 2019.
255
+
256
+ Kevin Musgrave, Serge Belongie, and Ser-Nam Lim. A metric learning reality check. arXiv preprint arXiv:2003.08505, 2020.
257
+
258
+ Maria-Elena Nilsback and Andrew Zisserman. Automated flower classification over a large number of classes. In Computer Vision, Graphics & Image Processing, 2008. ICVGIP’08. Sixth Indian Conference on, pp. 722–729. IEEE, 2008.
259
+
260
+ Omkar M Parkhi, Andrea Vedaldi, Andrew Zisserman, and CV Jawahar. Cats and dogs. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3498–3505. IEEE, 2012.
261
+
262
+ Giorgio Patrini, Alessandro Rozza, Aditya Krishna Menon, Richard Nock, and Lizhen Qu. Making deep neural networks robust to label noise: A loss correction approach. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1944–1952, 2017.
263
+
264
+ Rajeev Ranjan, Carlos D Castillo, and Rama Chellappa. L2-constrained softmax loss for discriminative face verification. arXiv preprint arXiv:1703.09507, 2017.
265
+
266
+ Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do imagenet classifiers generalize to imagenet? arXiv preprint arXiv:1902.10811, 2019.
267
+
268
+ Michael D Richard and Richard P Lippmann. Neural network classifiers estimate bayesian a posteriori probabilities. Neural computation, 3(4):461–483, 1991.
269
+
270
+ Andrew M Saxe, Yamini Bansal, Joel Dapello, Madhu Advani, Artemy Kolchinsky, Brendan D Tracey, and David D Cox. On the information bottleneck theory of deep learning. Journal of Statistical Mechanics: Theory and Experiment, 2019(12):124020, 2019.
271
+
272
+ Achim Schilling, Claus Metzner, Jonas Rietsch, Richard Gerum, Holger Schulze, and Patrick Krauss. How deep is deep enough?–quantifying class separability in the hidden layers of deep neural networks. arXiv preprint arXiv:1811.01753, 2018.
273
+
274
+ Ravid Shwartz-Ziv and Naftali Tishby. Opening the black box of deep neural networks via information. arXiv preprint arXiv:1703.00810, 2017.
275
+
276
+ Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical networks for few-shot learning. In Advances in neural information processing systems, pp. 4077–4087, 2017.
277
+
278
+ Daniel Soudry, Elad Hoffer, Mor Shpigel Nacson, Suriya Gunasekar, and Nathan Srebro. The implicit bias of gradient descent on separable data. The Journal of Machine Learning Research, 19(1): 2822–2878, 2018.
279
+
280
+ Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin Riedmiller. Striving for simplicity: The all convolutional net. arXiv preprint arXiv:1412.6806, 2014.
281
+
282
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. The journal of machine learning research, 15(1):1929–1958, 2014.
283
+
284
+ Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2818–2826, 2016.
285
+
286
+ Stefan Wager, Sida Wang, and Percy S Liang. Dropout training as adaptive regularization. In Advances in neural information processing systems, pp. 351–359, 2013.
287
+
288
+ Feng Wang, Jian Cheng, Weiyang Liu, and Haijun Liu. Additive margin softmax for face verification. IEEE Signal Processing Letters, 25(7):926–930, 2018a.
289
+
290
+ Hao Wang, Yitong Wang, Zheng Zhou, Xing Ji, Dihong Gong, Jingchao Zhou, Zhifeng Li, and Wei Liu. Cosface: Large margin cosine loss for deep face recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5265–5274, 2018b.
291
+
292
+ Haohan Wang, Songwei Ge, Eric P. Xing, and Zachary C. Lipton. Learning robust global representations by penalizing local predictive power, 2019.
293
+
294
+ Colin Wei, Jason D Lee, Qiang Liu, and Tengyu Ma. Regularization matters: Generalization and optimization of neural nets vs their induced kernel. In Advances in Neural Information Processing Systems, pp. 9712–9724, 2019.
295
+
296
+ Colin Wei, Sham Kakade, and Tengyu Ma. The implicit and explicit regularization effects of dropout. arXiv preprint arXiv:2002.12915, 2020.
297
+
298
+ Andreas Weigend. On overfitting and the effective number of hidden units. In Proceedings of the 1993 connectionist models summer school, volume 1, pp. 335–342, 1993.
299
+
300
+ Nicolai Wojke and Alex Bewley. Deep cosine metric learning for person re-identification. In 2018 IEEE winter conference on applications of computer vision (WACV), pp. 748–756. IEEE, 2018.
301
+
302
+ Jianxiong Xiao, James Hays, Krista A Ehinger, Aude Oliva, and Antonio Torralba. Sun database: Large-scale scene recognition from abbey to zoo. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3485–3492. IEEE, 2010.
303
+
304
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In Edwin R. Hancock Richard C. Wilson and William A. P. Smith (eds.), Proceedings of the British Machine Vision Conference (BMVC). BMVA Press, 2016. ISBN 1-901725-59-6. doi: 10.5244/C.30.87. URL https: //dx.doi.org/10.5244/C.30.87.
305
+
306
+ Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. arXiv preprint arXiv:1710.09412, 2017.
307
+
308
+ # Appendix
309
+
310
+ A DETAILS OF TRAINING AND HYPERPARAMETER TUNING
311
+
312
+ A.1 TRAINING AND TUNING NEURAL NETWORKS
313
+
314
+ ImageNet. We trained ImageNet models (ResNet-50 (He et al., 2016; Gross & Wilber, 2016; Goyal et al., 2017) $\mathbf { \hat { \Sigma } } ^ { 6 } \mathbf { v } 1 . 5 ^ { \mathbf { \ v } 2 }$ and Inception v3 (Szegedy et al., 2016)) models with SGD with Nesterov momentum of 0.9 and a batch size 4096 and weight decay of $8 \times 1 0 ^ { - 5 }$ (applied to the weights but not batch norm parameters). After 10 epochs of linear warmup to a maximum learning rate of 1.6, we decayed the learning rate by a factor of 0.975 per epoch. We took an exponential moving average of the weights over training as in Szegedy et al. (2016), with a momentum factor of 0.9999. We used standard data augmentation comprising random crops of $10 \mathrm { - } 1 0 0 \%$ of the image with aspect ratios of 0.75 to 1.33 and random horizontal flips. At test time, we resized images to 256 pixels on their shortest side and took a $2 2 4 \times 2 2 4$ center crop.
315
+
316
+ To tune hyperparameters, we initially performed a set of training runs with a wide range of different parameters, and then narrowed the hyperparameter range to the range shown in Table A.1. To further tune the hyperparameters and the epoch for early stopping, we performed 3 training runs per configuration where we held out a validation set of approximately 50,000 ImageNet training examples.3 We tuned loss hyperparameters for ResNet-50 only. For Inception v3, we used the same loss hyperparameters as for ResNet-50, but we still performed 3 training runs with the held out validation set to select the point at which to stop for each loss.
317
+
318
+ Table A.1: Hyperparameters for ImageNet.
319
+
320
+ <table><tr><td>Loss/regularizer</td><td>Hyperparameters</td><td>Epochs</td></tr><tr><td>Softmax</td><td>N/A</td><td>146</td></tr><tr><td>Squared error</td><td>K = 9,M = 60,loss scale = 10</td><td>196</td></tr><tr><td>Dropout</td><td>p= {0.6,0.65,0.7,0.75,0.8,0.85}</td><td>172</td></tr><tr><td>Label smoothing</td><td>α= {0.08,0.09,0.1,0.11.0.12}</td><td>180</td></tr><tr><td>Extra final layer L²</td><td>入final ={4e-4,6e-4,8e-4,1e-3}</td><td>168</td></tr><tr><td>Logit penalty</td><td>β= {5e-5,1e-4,2e-4,4e-4,6e-4,8e-4}</td><td>180</td></tr><tr><td>Logit normalization</td><td>T= {0.03,0.04,0.05,0.06}</td><td>152</td></tr><tr><td>Cosine softmax</td><td>T= {0.04,0.045,0.05,0.06,0.07,0.08}</td><td>158</td></tr><tr><td>Sigmoid</td><td>N/A</td><td>166</td></tr></table>
321
+
322
+ CIFAR. We trained CIFAR-10 and CIFAR-100 models using SGD with Nesterov momentum of 0.9 and a cosine learning rate decay schedule without restarts, and without weight averaging. For CIFAR-10, we used a batch size of 128; for CIFAR-100, we used a batch size of 256. For these networks, we performed hyperparameter tuning to select the learning rate and weight decay parameters. We started by selecting the learning rate from $\mathrm { { } _ { 1 } \left\{ 1 0 ^ { - 2 } , 1 0 ^ { - 1 . 5 } , \bar { 1 0 } ^ { - 1 } , 1 0 ^ { - 0 . 5 } , \bar { 1 . 0 } , 1 0 ^ { 0 . 5 } \right\} }$ and the weight decay from $\{ 1 0 ^ { - 4 . 5 } , 1 0 ^ { - 4 } , 1 0 ^ { - 3 . 5 } , 1 0 ^ { - 3 } \}$ , where we parameterize the weight decay so that it is divided by the learning rate. We manually inspected hyperparameter grids and expanded the learning rate and weight decay ranges when the best accuracy was on the edge of the searched grid. After finding the best hyperparameters in this coarse search, we performed a finer search in the vicinity of the best coarse hyperparameters with double the granularity, e.g., for an optimal learning rate of $1 0 ^ { - 1 }$ in the coarse search, our fine grid would include learning rates of $\{ \dot { 1 } 0 ^ { - 0 . 5 } , 1 0 ^ { - 0 . 7 5 } , 1 0 ^ { - 1 } , 1 0 ^ { - 1 . 2 5 } , 1 0 ^ { - 1 . 5 } \}$ . All results show optimal hyperparameters from this finer grid. During both coarse and fine hyperparameter tuning, we computed accuracies averaged over 5 different initializations for each configuration to reduce the bias toward selecting high-variance hyperparameter combinations when searching over a large number of configurations. Hyperparameters are shown in Table A.2.
323
+
324
+ The architecture we used for CIFAR-10 experiments was based on All-CNN-C architecture of Springenberg et al. (2014), with batch normalization added between layers and the global average pooling operation moved before the final convolutional layer. On CIFAR-100, we used the Wide ResNet 16-8 architecture from Zagoruyko & Komodakis (2016). Our CIFAR-100 architecture applied weight decay to batch normalization parameters, but our CIFAR-10 architecture did not.
325
+
326
+ Table A.2: Hyperparameters for CIFAR. $\eta$ is the learning rate and $\tilde { \lambda }$ is the product of the learning rate and the weight decay added to the loss, i.e., the weight decay loss is $\begin{array} { r } { \mathcal { L } _ { \mathrm { w e i g h t \_ d e c a y } } = \frac { \tilde { \lambda } } { 2 \eta } \| \mathbf { w } \| ^ { 2 } } \end{array}$ .
327
+
328
+ <table><tr><td>Loss/regularizer</td><td>CIFAR-10 (All-CNN-C + BN)</td><td>CIFAR-100 (WRN 16-8)</td></tr><tr><td>Squared error</td><td>η = 0.1,λ= 10-3.5, 5,κ=8,M = 0.83</td><td>n = 0.1,= 10-3.75, 5,κ = 6,M =12</td></tr><tr><td>Softmax</td><td>n= 10-0.75,X= 10-3.75</td><td>η = 0.1,λ= 10-4</td></tr><tr><td>Logit normalization</td><td>n=0.01,λ=104, =0.14</td><td>n = 10-2.25,λ = 10-3.75, 5,τ = 0.11</td></tr><tr><td>Extra final layer L²</td><td>n=0.1=1.5,fal=15</td><td>n=0.1,=1.5fnal=10.</td></tr><tr><td>Cosine softmax</td><td>n=10-225,X=10-4,=0.08</td><td>η = 0.01,λ= 10-3.75, 5,T =0.1</td></tr><tr><td>Dropout</td><td>5,ρ= 0.65 η= 0.1,λ= 10-3.75,</td><td>n = 10-1.25,X=10-3.75, 5,p = 0.75</td></tr><tr><td>Sigmoid</td><td>η =1,λ= 10-3.75</td><td>η = 0.1,λ= 10-3.75</td></tr><tr><td>Label smoothing</td><td>η = 0.1,λ= 10-3.75, 5,α = 0.04</td><td>n=0.1,=105,=018</td></tr><tr><td>Logit penalty</td><td>n=10-0.75,=103.75,β=12.83</td><td>n=10-125,=10-3.75,β=102.8</td></tr></table>
329
+
330
+ # A.2 TRAINING AND TUNING MULTINOMIAL LOGISTIC REGRESSION CLASSIFIERS
331
+
332
+ To train multinomial logistic regression classifiers on fixed features, we follow a similar approach to Kornblith et al. (2019b). We first extracted features for every image in the training set, by resizing them to 224 pixels on the shortest side and taking a $2 2 4 \times 2 2 4$ pixel center crop. We held out a validation set from the training set, and used this validation set to select the $L ^ { \frac { \mathbf { \lambda } } { 2 } }$ regularization hyperparameter, which we selected from 45 logarithmically spaced values between $1 0 ^ { - 6 }$ and $1 0 ^ { 5 }$ , applied to the sum of the per-example losses. Because the optimization problem is convex, we used the previous weights as a warm start as we increased the $L ^ { 2 }$ regularization hyperparameter. After finding the optimal hyperparameter on this validation set, we retrained on the entire training set and evaluated accuracy on the test set.
333
+
334
+ # B ADDITIONAL EVALUATION OF PERFORMANCE OF REGULARIZERS AND LOSSES
335
+
336
+ Table B.1: Regularizers and alternative losses improve Inception v3 accuracy on ImageNet. Accuracy (mean $\pm$ standard error of 3 models) with different losses/regularizers on the ImageNet validation set. Losses are sorted from lowest to highest top-1 accuracy. Accuracy values not significantly different from the best $( p > 0 . 0 5$ , t-test) are bold-faced.
337
+
338
+ <table><tr><td>Loss/regularizer</td><td>Top-1 Acc. (%)</td><td>Top-5 Acc. (%)</td></tr><tr><td>Squared error</td><td>77.7 ± 0.03</td><td>93.28 ± 0.01</td></tr><tr><td>Softmax</td><td>78.6 ± 0.03</td><td>94.24 ± 0.03</td></tr><tr><td>Logit normalization</td><td>78.8 ± 0.11</td><td>94.34 ± 0.04</td></tr><tr><td>Label smoothing</td><td>78.8 ± 0.03</td><td>94.60 ± 0.03</td></tr><tr><td>Cosine softmax</td><td>78.9 ±0.06</td><td>94.38 ± 0.03</td></tr><tr><td>Logit penalty</td><td>78.9 ±0.06</td><td>94.63 ± 0.02</td></tr><tr><td>Dropout</td><td>79.0±0.02</td><td>94.50 ± 0.04</td></tr><tr><td>Extra final layer L2</td><td>79.0± 0.03</td><td>94.52 ± 0.01</td></tr><tr><td>Sigmoid</td><td>79.1± 0.07</td><td>94.17 ± 0.02</td></tr></table>
339
+
340
+ Table B.2: Regularizers and alternative losses improve performance on out-of-distribution test sets. Ac curacy averaged over 8 ResNet-50 models per loss.
341
+
342
+ <table><tr><td>Loss/regularizer</td><td>ImageNet-v2 (%)</td><td>ImageNet-A (%)</td><td>IN-Sketch (%)</td><td>ImageNet-R (%)</td><td>ImageNet-C (mCE)</td></tr><tr><td>Softmax</td><td>65.0±0.1</td><td>2.7±0.0</td><td>21.8 ±0.1</td><td>36.8 ± 0.1</td><td>75.9 ± 0.1</td></tr><tr><td>Squared error</td><td>65.3± 0.1</td><td>4.5 ± 0.1</td><td>22.4±0.1</td><td>36.3 ± 0.1</td><td>74.6 ± 0.1</td></tr><tr><td>Dropout</td><td>65.4±0.0</td><td>3.1±0.1</td><td>23.0±0.1</td><td>37.2 ± 0.1</td><td>74.5 ± 0.1</td></tr><tr><td>Label smoothing</td><td>65.7 ± 0.1</td><td>3.8± 0.1</td><td>22.5 ±0.1</td><td>37.8 ± 0.1</td><td>75.2 ± 0.1</td></tr><tr><td>Extra final layer L²</td><td>65.8±0.1</td><td>3.3± 0.0</td><td>23.1 ± 0.1</td><td>37.7 ± 0.1</td><td>74.1 ± 0.1</td></tr><tr><td>Logit penalty</td><td>65.8±0.0</td><td>4.5± 0.0</td><td>22.8 ±0.1</td><td>38.1± 0.1</td><td>74.3 ± 0.1</td></tr><tr><td>Logit normalization</td><td>65.8 ± 0.1</td><td>4.8 ± 0.1</td><td>23.7± 0.1</td><td>39.2 ± 0.1</td><td>73.2 ± 0.1</td></tr><tr><td>Cosine softmax</td><td>65.8±0.1</td><td>4.6± 0.1</td><td>24.8 ±0.1</td><td>38.7 ±0.1</td><td>72.5 ± 0.1</td></tr><tr><td>Sigmoid</td><td>65.9±0.1</td><td>3.3±0.0</td><td>22.6±0.1</td><td>36.6 ± 0.1</td><td>74.6 ± 0.1</td></tr></table>
343
+
344
+ Table B.3: Regularizers and alternative losses may or may not improve calibration. We report negative log likelihood (NLL) and expected calibration error (ECE) for each loss on the ImageNet validation set, before and after scaling the temperature of the probability of the distribution to minimize NLL, as in Guo et al. (2017). ECE is computed with 15 evenly spaced bins. For networks trained with sigmoid loss, we normalize the probability distribution by summing probabilities over all classes.
345
+
346
+ <table><tr><td rowspan="2">Loss/regularizer</td><td colspan="2">Uncalibrated</td><td colspan="2">With temperature scaling</td></tr><tr><td>NLL</td><td>ECE</td><td>NLL</td><td>ECE</td></tr><tr><td>Softmax</td><td>0.981 ± 0.002</td><td>0.073 ± 0.0001</td><td>0.917 ± 0.002</td><td>0.027 ± 0.0004</td></tr><tr><td>Dropout</td><td>0.971 ± 0.002</td><td>0.074± 0.0009</td><td>0.905 ± 0.002</td><td>0.031 ± 0.0002</td></tr><tr><td>Label smoothing</td><td>0.947 ± 0.001</td><td>0.016 ± 0.0007</td><td>0.941 ± 0.001</td><td>0.044 ± 0.0004</td></tr><tr><td>Extra final layer L2</td><td>0.976 ± 0.002</td><td>0.081 ± 0.0003</td><td>0.908 ± 0.002</td><td>0.038 ± 0.0006</td></tr><tr><td>Logit penalty</td><td>1.041 ± 0.001</td><td>0.090 ± 0.0003</td><td>0.995 ± 0.001</td><td>0.055 ± 0.0004</td></tr><tr><td>Logit normalization</td><td>0.965 ± 0.001</td><td>0.069 ± 0.0002</td><td>0.949 ± 0.001</td><td>0.049 ± 0.0003</td></tr><tr><td>Cosine softmax</td><td>0.912 ± 0.002</td><td>0.066 ± 0.0006</td><td>0.895 ± 0.002</td><td>0.043 ± 0.0008</td></tr><tr><td>Sigmoid</td><td>0.944 ± 0.002</td><td>0.044 ± 0.0003</td><td>0.914 ± 0.002</td><td>0.019 ± 0.0002</td></tr></table>
347
+
348
+ Table B.4: Training accuracy of ResNet-50 models.
349
+
350
+ <table><tr><td>Loss/regularizer</td><td>Top-1 Acc. (%)</td><td>Top-5 Acc. (%)</td></tr><tr><td>Softmax</td><td>93.61 ± 0.01</td><td>99.33 ± 0.002</td></tr><tr><td>Squared error</td><td>91.65 ± 0.01</td><td>98.59 ± 0.002</td></tr><tr><td>Dropout</td><td>92.25 ± 0.01</td><td>99.03 ± 0.003</td></tr><tr><td>Label smoothing</td><td>93.62 ± 0.04</td><td>99.43 ± 0.007</td></tr><tr><td>Extra final layer L2</td><td>91.62 ± 0.01</td><td>98.85 ± 0.003</td></tr><tr><td>Logit penalty</td><td>93.04 ± 0.01</td><td>99.13 ± 0.002</td></tr><tr><td>Logit normalization</td><td>92.86 ± 0.01</td><td>99.01 ± 0.003</td></tr><tr><td>Cosine softmax</td><td>92.47 ± 0.01</td><td>98.75 ± 0.004</td></tr><tr><td>Sigmoid</td><td>93.22 ± 0.01</td><td>99.19 ± 0.002</td></tr></table>
351
+
352
+ # C RESULTS OF COMBINING REGULARIZERS/LOSSES
353
+
354
+ Table C.1: Combining final-layer regularizers and/or improved losses does not enhance performance. ImageNet holdout set accuracy of ResNet-50 models when combining losses and regularizers between models. All results reflect the maximum accuracy on the holdout set at any point during training, averaged across 3 training runs. Accuracy numbers are higher on the holdout set than the official ImageNet validation set. This difference in accuracy is likely due to a difference in image distributions between the ImageNet training and validation sets, as previously noted in Section C.3.1 of Recht et al. (2019).
355
+
356
+ <table><tr><td></td><td>Baseline</td><td>Label smoothing (a = 0.1)</td><td>Sigmoid</td><td>Cosine softmax (T = 0.05)</td></tr><tr><td>Baseline</td><td>79.9</td><td>80.4</td><td>80.6</td><td>80.6</td></tr><tr><td>Dropout (β = 0.7)</td><td>80.3</td><td>80.3</td><td>80.3</td><td>80.2</td></tr><tr><td>Dropout (β = 0.8)</td><td>80.2</td><td>80.4</td><td>80.4</td><td>80.4</td></tr><tr><td>Dropout (β = 0.9)</td><td></td><td>80.3</td><td>80.5</td><td>80.6</td></tr><tr><td>Dropout (β = 0.95)</td><td></td><td>80.4</td><td>80.6</td><td>80.7</td></tr><tr><td>Logit penalty (γ = 5 × 10-5)</td><td>80.4</td><td>80.3</td><td>80.5</td><td>80.6</td></tr><tr><td>Logit penalty (γ = 1 × 10-4)</td><td>80.4</td><td>80.3</td><td>80.5</td><td>80.5</td></tr><tr><td>Logit penalty (γ = 2 × 10-4)</td><td>80.4</td><td>80.3</td><td>80.4</td><td>80.5</td></tr><tr><td>Logit penalty (γ = 4 × 10-4)</td><td>80.4</td><td>80.2</td><td>80.3</td><td>80.5</td></tr><tr><td>Logit penalty (γ = 6 × 10-4)</td><td>80.5</td><td>80.2</td><td>80.3</td><td>80.5</td></tr><tr><td>Logit normalization (T = 0.02)</td><td></td><td></td><td>80.4</td><td></td></tr><tr><td>Logit normalization (T = 0.03)</td><td>80.3</td><td></td><td>80.6</td><td></td></tr><tr><td>Logit normalization (T = 0.04)</td><td>80.4</td><td></td><td>80.6</td><td></td></tr><tr><td>Logit normalization (T =( 0.05)</td><td>80.3 80.3</td><td></td><td>80.5 80.5</td><td></td></tr><tr><td>Logit normalization (T = 0.06)</td><td>80.6</td><td></td><td>80.5</td><td></td></tr><tr><td>Cosine normalization (T = 0.045)</td><td>80.6</td><td></td><td>80.6</td><td></td></tr><tr><td>Cosine normalization (T = 0.05)</td><td>80.4</td><td></td><td>75.3</td><td></td></tr><tr><td>Cosine normalization (T = 0.06)</td><td></td><td></td><td></td><td></td></tr></table>
357
+
358
+ Table C.2: AutoAugment and Mixup provide consistent accuracy gains beyond well-tuned losses and regularizers. Top-1 accuracy of ResNet-50 models trained with and without AutoAugment, averaged over 3 (with AutoAugment) or 8 (without AutoAugment) runs. Models trained with AutoAugment use the loss hyperparameters chosen for models trained without AutoAugment, but the point at which to stop training was chosen independently on our holdout set. For models trained with Mixup, the mixing parameter $\alpha$ is chosen from [0.1, 0.2, 0.3, 0.4] on the holdout set. Best results in each column, as well as results insignificantly different from the best $( p > 0 . 0 5$ , t-test), are bold-faced.
359
+
360
+ <table><tr><td></td><td colspan="2"> Standard Augmentation</td><td colspan="2">AutoAugment</td><td colspan="2">Mixup</td></tr><tr><td>Loss/regularizer</td><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>Softmax</td><td>77.0 ± 0.06</td><td>93.40 ± 0.02</td><td>77.7± 0.05</td><td>93.74 ± 0.05</td><td>78.0±0.05</td><td>93.98 ± 0.03</td></tr><tr><td>Sigmoid</td><td>77.9± 0.05</td><td>93.50±0.02</td><td>78.5± 0.04</td><td>93.82 ±0.02</td><td>78.5± 0.07</td><td>93.94 ± 0.04</td></tr><tr><td>Logit penalty</td><td>77.7± 0.02</td><td>93.83 ± 0.02</td><td>78.3 ± 0.05</td><td>94.10±0.03</td><td>78.0±0.05</td><td>93.95 ± 0.05</td></tr><tr><td>Cosine softmax</td><td>77.9± 0.02</td><td>93.86 ± 0.01</td><td>78.3± 0.02</td><td>94.12 ± 0.04</td><td>78.4±0.04</td><td>94.14 ± 0.02</td></tr></table>
361
+
362
+ Table C.3: Comparison with state-of-the-art. All results are for ResNet-50 models trained with AutoAugment. Loss hyperparameters are the same as in Table C.2, but the learning schedule decays exponentially at a rate of 0.985 per epoch, rather than 0.975 per epoch. This learning rate schedule takes approximately $2 \times$ as many epochs before it reaches peak accuracy, and provides a ${ \sim } 0 . 4 \%$ improvement in top-1 accuracy across settings.
363
+
364
+ <table><tr><td>Loss</td><td>Epochs</td><td>Top-1 (%)</td><td>Top-5 (%)</td></tr><tr><td>Softmax (Cubuk et al., 2019)</td><td>270</td><td>77.6</td><td>93.8</td></tr><tr><td>Supervised contrastive (Khosla et al., 2020)</td><td>700</td><td>78.8</td><td>93.9</td></tr><tr><td>Ours:</td><td></td><td></td><td></td></tr><tr><td>Softmax</td><td>306</td><td>77.9 ± 0.02</td><td>93.77 ± 0.03</td></tr><tr><td>Sigmoid</td><td>324</td><td>78.9± 0.04</td><td>93.96 ± 0.06</td></tr><tr><td>Logit penalty</td><td>346</td><td>78.6 ± 0.07</td><td>94.30 ± 0.01</td></tr><tr><td>Cosine softmax</td><td>308</td><td>78.7 ± 0.04</td><td>94.24± 0.02</td></tr><tr><td>Ours (with Mixup):</td><td></td><td></td><td></td></tr><tr><td>Sigmoid</td><td>384</td><td>79.1 ± 0.06</td><td>94.28 ± 0.03</td></tr><tr><td>Cosine softmax</td><td>348</td><td>79.1 ± 0.09</td><td>94.49 ± 0.01</td></tr></table>
365
+
366
+ # D SIMILARITY OF MODEL PREDICTIONS
367
+
368
+ ![](images/a744bf015809ff92ab5bc68b1128d6507984512f4e8b88a9f8d8ecbbf044db00.jpg)
369
+ Figure D.1: Different ways of measuring similarity of single-model ResNet-50 predictions yield similar qualitative results. See also Figure 1.
370
+
371
+ ![](images/69773fc7f0e010ae168d451228cfe77713fdc638e337ce4886f0ba1e2ae298ff.jpg)
372
+ Figure D.2: Ensemble predictions are substantially more similar than single-model predictions. Predictions of the ensemble were computed by taking 8 ResNet-50 models trained from different random initializations with the same loss and picking the most common top-1 prediction for each example.
373
+
374
+ ![](images/8b6793225ea5e088f93dce4a599afc06837d82b4b3f9accd2a9822c2fc38439c.jpg)
375
+ Figure D.3: Ensembling models trained with different losses provides only modest performance benefits. Ensembles consist of 8 ResNet-50 models, half of which are trained with the objective on the $\mathbf { X }$ -axis, the other half with the objective on the y-axis. The ensemble prediction is the modal class prediction of the 8 models.
376
+
377
+ # E OTHER CLASS SEPARATION METRICS
378
+
379
+ Table E.1: Comparison of class separation under different distance metrics. Cosine (mean-subtracted) subtracts the mean of the activations before computing the cosine distance. All results reported for ResNet-50 on the ImageNet training set.
380
+
381
+ <table><tr><td>Loss/regularizer</td><td>Cosine</td><td>Cosine (mean- subtracted)</td><td>Euclidean distance</td></tr><tr><td>Softmax</td><td>0.3494 ± 0.0002</td><td>0.3472 ± 0.0002</td><td>0.3366 ± 0.0002</td></tr><tr><td>Squared error</td><td>0.8452 ± 0.0002</td><td>0.8450 ± 0.0002</td><td>0.8421 ± 0.0007</td></tr><tr><td>Dropout</td><td>0.4606 ± 0.0003</td><td>0.4559 ± 0.0002</td><td>0.4524 ± 0.0003</td></tr><tr><td>Label smoothing</td><td>0.4197 ± 0.0003</td><td>0.4124 ± 0.0004</td><td>0.3662 ± 0.0005</td></tr><tr><td>Extra final layer L2</td><td>0.5718 ± 0.0006</td><td>0.5629 ± 0.0005</td><td>0.5561 ± 0.0005</td></tr><tr><td>Logit penalty</td><td>0.6012 ± 0.0004</td><td>0.5950 ± 0.0004</td><td>0.5672 ± 0.0004</td></tr><tr><td>Logit normalization</td><td>0.5167 ± 0.0002</td><td>0.5157 ± 0.0002</td><td>0.5326 ± 0.0002</td></tr><tr><td>Cosine softmax</td><td>0.6406 ± 0.0003</td><td>0.6389 ± 0.0003</td><td>0.6406 ± 0.0003</td></tr><tr><td>Sigmoid</td><td>0.4267 ± 0.0003</td><td>0.4315 ± 0.0003</td><td>0.4272 ± 0.0003</td></tr></table>
382
+
383
+ ![](images/9e8582d8a88c36487147afdb73b30ff651d8253f442b027972693f615e4dae54.jpg)
384
+ Figure E.1: Angular visual hardness of different loss functions. Kernel density estimate of the angular visual hardness (Chen et al., 2019) scores of the 50,000 examples in the ImageNet validation set, computed with a Gaussian kernel of bandwidth $5 \times 1 0 ^ { - 6 }$ , for ResNet-50 networks trained with different losses. Legend shows ImageNet top-1 accuracy for each loss function in parentheses. Although alternative loss functions generally reduce angular visual hardness vs. softmax loss, sigmoid loss does not, yet it is tied for the highest accuracy of any loss function.
385
+
386
+ ![](images/cc97a3574c747477c74c796b64c1db0b38a4c40d1f8022b2d2a57ecbf8c989dd.jpg)
387
+ Figure E.2: Singular value spectra of activations and weights learned by different losses. Singular value spectra computed for penultimate layer activations, final layer weights, and class centroids of ResNet-50 models on the ImageNet training set. Penultimate layer activations and final layer weights fail to differentiate sigmoid cross-entropy from softmax cross-entropy. By contrast, the singular value spectrum of the class centroids clearly distinguishes these losses.
388
+
389
+ ![](images/a72be8331dd4bee2a1faebfac25a791b4c661f280ded210125647a83b1f1bd57.jpg)
390
+ Figure E.3: The distribution of cosine distance between examples. Kernel density estimate of the cosine distance between examples of the same class (solid lines) and of different classes (dashed lines), for penultimate layer embeddings of 10,000 training set examples from ResNet-50 on ImageNet. Top and bottom plots show the same data with different y scales.
md/train/kN4mGdGWc92/kN4mGdGWc92.md ADDED
@@ -0,0 +1,542 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Practical Schemes for Finding Near-Stationary Points of Convex Finite-Sums
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 The problem of finding near-stationary points in convex optimization has not been
11
+ 2 adequately studied yet, unlike other optimality measures such as the function
12
+ 3 value. Even in the deterministic case, the optimal method (OGM-G, due to Kim
13
+ 4 and Fessler [33]) has just been discovered recently. In this work, we conduct a
14
+ 5 systematic study of algorithmic techniques for finding near-stationary points of
15
+ 6 convex finite-sums. Our main contributions are several algorithmic discoveries:
16
+ 7 (1) we discover a memory-saving variant of OGM-G based on the performance
17
+ 8 estimation problem approach [19]; (2) we design a new accelerated SVRG variant
18
+ 9 that can simultaneously achieve fast rates for minimizing both the gradient norm
19
+ 10 and function value; (3) we propose an adaptively regularized accelerated SVRG
20
+ 11 variant, which does not require the knowledge of some unknown initial constants
21
+ 12 and achieves near-optimal complexities. We put an emphasis on the simplicity and
22
+ 13 practicality of the new schemes, which could facilitate future developments.
23
+
24
+ # 14 1 Introduction
25
+
26
+ 15 Classic convex optimization usually focuses on providing guarantees for minimizing function value.
27
+ 16 For this task, the optimal (up to constant factors) Nesterov’s accelerated gradient method (NAG)
28
+ 17 [40, 41] has been known for decades, and there are even methods that can exactly match the lower
29
+ 18 complexity bounds [30, 17, 55, 18]. On the other hand, in general non-convex optimization, near
30
+ 19 stationarity is the typical optimality measure, and there has been a flurry of recent research devoted to
31
+ 20 this topic [25, 26, 23, 28, 21, 60]. Recently, there has been growing interest on devising fast schemes
32
+ 21 for finding near-stationary points in convex optimization [42, 2, 22, 7, 31, 32, 33, 27, 15, 14]. This
33
+ 22 line of research is basically driven by the following facts.
34
+ 23 • Nesterov [42] studied the problem with a linear constraint: $f ( x ^ { \star } ) = \textstyle \operatorname* { m i n } _ { x \in Q } { \big \{ } f ( x ) : A x = b { \big \} }$ ,
35
+ 24 where $Q$ is a convex set and $f$ is strongly convex. Assuming that $Q$ and $f$ are simple, we can focus
36
+ 25 on the dual problem $\begin{array} { r } { \phi ( y ^ { \star } ) = \operatorname* { m a x } _ { y } \{ \phi ( y ) \triangleq \operatorname* { m i n } _ { x \in Q } \left\{ f ( x ) + \langle y , b - A x \rangle \right\} \} } \end{array}$ . Clearly, the dual
37
+ 26 objective $- \phi ( y )$ is smooth convex. Letting $x _ { y }$ be the unique solution to the inner problem, we have
38
+ 27 $\nabla \phi ( y ) = b - A x _ { y }$ . Note tha $\mathfrak { t } f ( x _ { y } ) - \breve { f } ( x ^ { \star } ) = \phi ( y ) \dot { - } \langle y , \nabla \phi ( y ) \rangle - \phi ( y ^ { \star } ) \dot { \leq } \| y \| \| \nabla \phi ( y ) \|$ k .
39
+ 28 Thus, in this problem, the quantity $| | \nabla \phi ( y ) | |$ serves as a measure of both primal optimality
40
+ 29 $f ( x _ { y } ) - f ( x ^ { \star } )$ and feasibility $\| b - A x _ { y } \|$ , which is better than just measuring the function value.
41
+ 30 • Matrix scaling [50] is a convex problem and its goal is to find near-stationary points [4, 9].
42
+ 31 • Gradient norm is readily available, unlike other optimality measures $( f ( x ) - f ( x ^ { \star } )$ and $\| x - x ^ { \star } \| )$ ,
43
+ 32 and is thus usable as a stopping criterion. This fact motivates the design of several parameter-free
44
+ 33 algorithms [43, 39, 27], and their guarantees are established on the gradient norm.
45
+ 34 • Designing schemes for minimizing the gradient norm can inspire new non-convex optimization
46
+ 35 methods. For example, SARAH [46] was designed for convex finite-sums with gradient-norm mea
47
+ 36 sure, but was later discovered to be the near-optimal method for non-convex finite-sums [21, 47].
48
+
49
+ Table 1: Finding near-stationary points $\| \nabla f ( x ) \| \leq \epsilon$ of convex finite-sums.
50
+
51
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Algorithm</td><td rowspan=1 colspan=1>Complexity</td><td rowspan=1 colspan=1>Remark</td></tr><tr><td rowspan=7 colspan=1>1FC</td><td rowspan=1 colspan=1>GD [33]</td><td rowspan=1 colspan=1>0()</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Regularized NAG* [7]</td><td rowspan=1 colspan=1>0( log1)</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>OGM-G [33]</td><td rowspan=1 colspan=1>0()</td><td rowspan=1 colspan=1>O(¹ +d) memory,optimal in e</td></tr><tr><td rowspan=1 colspan=1> M-OGM-G [Section 3.1]</td><td rowspan=1 colspan=1>0()</td><td rowspan=1 colspan=1>O(d) memory, optimal in e</td></tr><tr><td rowspan=1 colspan=1>L2S [37]</td><td rowspan=1 colspan=1>0(n+)</td><td rowspan=1 colspan=1>Loopless variant of SARAH [46]</td></tr><tr><td rowspan=1 colspan=1>Regularized Katyusha* [2]</td><td rowspan=1 colspan=1>O((n+)log1)</td><td rowspan=1 colspan=1>Requires the knowledge of △o</td></tr><tr><td rowspan=1 colspan=1> R-Acc-SVRG-G* [Section 5]</td><td rowspan=1 colspan=1>O(nlog¹ +√)log¹)</td><td rowspan=1 colspan=1>Without the knowledge of △o</td></tr><tr><td rowspan=9 colspan=1>IDC</td><td rowspan=1 colspan=1>GD [42, 54]</td><td rowspan=1 colspan=1>0()</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>NAG /NAG + GD [32]/ [42]</td><td rowspan=1 colspan=1>0()</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Regularized NAG* [42, 27]</td><td rowspan=1 colspan=1>0(log)</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>NAG + OGM-G [45]</td><td rowspan=1 colspan=1>0()</td><td rowspan=1 colspan=1>O( + d) memory, optimal in e</td></tr><tr><td rowspan=1 colspan=1>NAG + M-OGM-G [Section 3.1]</td><td rowspan=1 colspan=1>()</td><td rowspan=1 colspan=1>O(d) memory, optimal in e</td></tr><tr><td rowspan=1 colspan=1>Katyusha + L2S [Appendix E]</td><td rowspan=1 colspan=1>O(nlog+)</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Acc-SVRG-G [Section 4]</td><td rowspan=1 colspan=1>O(nl0g¹ +²/3)n2/3)1</td><td rowspan=1 colspan=1>O(n log¹ + √=) for function at the same time, simple and elegant</td></tr><tr><td rowspan=1 colspan=1>Regularized Katyusha* [2]</td><td rowspan=1 colspan=1>O(n+√=)log¹)</td><td rowspan=1 colspan=1>Requires the knowledge of Ro</td></tr><tr><td rowspan=1 colspan=1>R-Acc-SVRG-G* [Section 5]</td><td rowspan=1 colspan=1>O((nlog¹+√=)log¹)</td><td rowspan=1 colspan=1> Without the knowledge of Ro</td></tr></table>
52
+
53
+ ∗ Indirect methods (using regularization).
54
+
55
+ 37 Moreover, finding near-stationary points is a harder task than minimizing function value, because NAG has the optimal guarantee for 38 $f ( x ) - f ( x ^ { \star } )$ but is only suboptimal for minimizing $\| \nabla f ( x ) \|$ .
56
+
57
+ In this work, we consider the prob39 m $\operatorname* { m i n } _ { x \in \mathbb { R } ^ { d } }$ $\begin{array} { r } { f ( x ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } f _ { i } ( x ) } \end{array}$ , where each $f _ { i }$ is $L$ -smooth
58
+ 40 and convex. We focus on finding an $\epsilon$ -stationary point of this objective, i.e., a point with $\| \nabla f ( x ) \| \leq \epsilon$ .
59
+ 41 We use $\mathcal { X } ^ { \star }$ to denote the set of optimal solutions, which is assumed to be nonempty. There are two
60
+ 42 different assumptions on the initial point $x _ { 0 }$ , namely, the Initial bounded-Function Condition (IFC):
61
+ 43 $f ( x _ { 0 } ) - f ( x ^ { \star } ) \mathbf { \bar { \leq } } \Delta _ { 0 }$ , and the Initial bounded-Distance Condition $\mathbf { ( I D C ) }$ : $\| x _ { 0 } - x ^ { \star } \| \leq R _ { 0 }$ for some
62
+ 44 $x ^ { \star } \in \mathcal { X } ^ { \star }$ . This subtlety results in drastically different best achievable rates as studied in [7, 22].
63
+ 45 Below we categorize existing algorithmic techniques into three classes (relating to Table 1).
64
+
65
+ (i) $' I D C + I F C "$ . Nesterov [42] showed that we can combine the guarantees of a method minimizing function value under IDC and a method finding near-stationary points under IFC to produce a faster one for minimizing gradient norm under IDC. For example, NAG produces $\begin{array} { r } { \dot { f } ( x _ { K _ { 1 } } ) - f ( x ^ { \star } ) = O ( \frac { L R _ { 0 } ^ { 2 } } { K _ { 1 } ^ { 2 } } ) } \end{array}$ [40] and GD produces $\begin{array} { r } { \left\| \nabla f ( x _ { K _ { 2 } } ) \right\| ^ { 2 } = O \big ( \frac { L ( f ( x _ { 0 } ) - f ( x ^ { \star } ) ) } { K _ { 2 } } \big ) } \end{array}$ [33] under IFC. Letting $x _ { 0 } = x _ { K _ { 1 } }$ and $K = K _ { 1 } + K _ { 2 }$ , by balancing the ratio of $K _ { 1 }$ and $K _ { 2 }$ , we obtain the guarantee $\begin{array} { r } { \| \nabla f ( x _ { K } ) \| ^ { 2 } = O ( \frac { L ^ { 2 } R _ { 0 } ^ { 2 } } { K ^ { 3 } } ) } \end{array}$ for $\mathrm { ^ { 6 6 } N A G + G D ^ { 3 } }$ . We point out that we can use this technique to combine the guarantees of Katyusha [1] and $\mathrm { \bf S A R A H } ^ { 2 }$ [46]; see Appendix E.
66
+
67
+ (ii) Regularization. Nesterov [42] used NAG (strongly convex variant) to solve the regularized objective, and showed that it achieves near-optimal complexity (optimal up to logarithmic factors). Inspired by this technique, Allen-Zhu [2] proposed recursive regularization for stochastic approximation algorithms, which also achieves near-optimal complexities [22].
68
+
69
+ 57 (iii) Direct methods. Due to the lack of insight, existing direct methods are mostly derived or
70
+ 58 analyzed with the help of computer-aided tools [31, 32, 54, 33]. The computer-aided approach
71
+ 59 was pioneered by Drori and Teboulle [19], who introduced the performance estimation
72
+ 60 problem (PEP). The only known optimal method OGM-G [33] was designed based on the
73
+ 61 PEP approach.
74
+ 62 Observe that since $f ( x ) - f ( x ^ { \star } ) \leq \| \nabla f ( x ) \| \| x - x ^ { \star } \|$ , the lower bound for finding near-stationary
75
+ 63 points must be of the same order as for minimizing function value [44]. Thus, under IDC, the lower
76
+ 64 bound is $\Omega ( n + \sqrt { \frac { n } { \epsilon } } )$ due to [58]. Under IFC, we can establish an $\begin{array} { r } { \Omega ( n + \frac { \sqrt { n } } { \epsilon } ) } \end{array}$ lower bound using
77
+ 65 the techniques in [7, 58]. The main contributions of this work are three new algorithmic schemes that
78
+ 66 improve the practicalities of existing methods as summarized below (highlighted in Table 1).
79
+
80
+ • (Section 3) We propose a memory-saving variant of OGM-G for the deterministic case $( n = 1$ ), which does not require a pre-computed and stored parameter sequence. The derivation of the new variant is inspired by the numerical solution to a PEP problem. • (Section 4) We propose a new accelerated SVRG [29, 59] variant that can simultaneously achieve fast convergence rates for minimizing both the gradient norm and function value, that is, O(n log 1 + n2/32/3 ) complexity for gradient norm and $O ( n \log { \frac { 1 } { \epsilon } } + \sqrt { \frac { n } { \epsilon } } )$ complexity for function value. Note that other stochastic approaches in Table 1 do not have this property. • (Section 5) We propose an adaptively regularized accelerated SVRG variant, which does not require the knowledge of $R _ { 0 }$ or $\Delta _ { 0 }$ and achieves a near-optimal complexity under IDC or IFC.
81
+
82
+ 76 We put in extra efforts to make the proposed schemes as simple and elegant as possible. We believe
83
+ 7 that the simplicity makes the extensions of the new schemes easier.
84
+
85
+ # 78 2 Preliminaries
86
+
87
+ 79 Throughout this paper, we use $\langle \cdot , \cdot \rangle$ and $\lVert \cdot \rVert$ to denote the inner product and the Euclidean norm,
88
+ 80 respectively. We let $[ n ]$ denote the set $\{ 1 , 2 , \ldots , n \}$ , $\mathbb { E }$ denote the total expectation and $\mathbb { E } _ { i _ { k } }$ denote
89
+ 81 the expectation with respect to a random sample $i _ { k }$ . We say that a function $f : { \mathbb { R } ^ { d } } \to { \mathbb { R } }$ is $L$ -smooth
90
+ 82 if it has $L$ -Lipschitz continuous gradients, i.e.,
91
+
92
+ $$
93
+ \forall x , y \in \mathbb { R } ^ { d } , \| \nabla f ( x ) - \nabla f ( y ) \| \leq L \left\| x - y \right\| .
94
+ $$
95
+
96
+ 83 A continuously differentiable $f$ is called $\mu$ -strongly convex if
97
+
98
+ $$
99
+ \forall x , y \in \mathbb { R } ^ { d } , f ( x ) - f ( y ) - \langle \nabla f ( y ) , x - y \rangle \geq { \frac { \mu } { 2 } } \left\| x - y \right\| ^ { 2 } .
100
+ $$
101
+
102
+ 84 Other equivalent definitions of these two assumptions can be found in the textbook [44]. The
103
+ 85 following is an important consequence of a function $f$ being $L$ -smooth and convex:
104
+
105
+ $$
106
+ \forall x , y \in \mathbb { R } ^ { d } , f ( x ) - f ( y ) - \langle \nabla f ( y ) , x - y \rangle \geq { \frac { 1 } { 2 L } } \left\| \nabla f ( x ) - \nabla f ( y ) \right\| ^ { 2 } .
107
+ $$
108
+
109
+ 86 We call (1) the interpolation condition at $( x , y )$ following [56]. If $f$ is both $L$ -smooth and $\mu$ -strongly
110
+ 87 convex, we can define a “shifted” function $h ( x ) = f ( x ) - f ( x ^ { \star } ) - { \textstyle { \frac { \mu } { 2 } } } \left\| x - x ^ { \star } \right\| ^ { 2 }$ following [63]. It
111
+ 88 can be easily verified that $h$ is $( L - \mu )$ -smooth and convex, and thus from (1),
112
+
113
+ $$
114
+ \forall x , y \in \mathbb { R } ^ { d } , h ( x ) - h ( y ) - \langle \nabla h ( y ) , x - y \rangle \geq { \frac { 1 } { 2 ( L - \mu ) } } \left\| \nabla h ( x ) - \nabla h ( y ) \right\| ^ { 2 } ,
115
+ $$
116
+
117
+ 9 which is equivalent to the strongly convex interpolation condition discovered in [56].
118
+
119
+ Oracle complexity (or simply complexity) refers to the required number of stochastic gradient $\nabla f _ { i }$ computations to find an $\epsilon$ -accurate solution.
120
+
121
+ # 3 OGM-G: “Momentum” Reformulation and a Memory-Saving Variant
122
+
123
+ In this section, we focus on the IFC case, i.e., 93 $f ( x _ { 0 } ) - f ( x ^ { \star } ) \leq \Delta _ { 0 }$ . We use $N$ to denote the total 94 iteration number to prevent confusion (in other sections, we use $K$ ). Proofs in this section are given in
124
+
125
+ # Algorithm 1 OGM-G: “Momentum” reformulation
126
+
127
+ Input: initial guess $x _ { 0 } \in \mathbb { R } ^ { d }$ , total iteration number $N$ .
128
+ Initialize: vector $v _ { 0 } = \mathbf { 0 }$ , scalars $\theta _ { N } = 1$ and $\theta _ { k } ^ { 2 } - \theta _ { k } = \theta _ { k + 1 } ^ { 2 }$ , for $k = 0 \dots N - 1$ . 1: for $k = 0 , \ldots , N - 1$ do
129
+ 2: $\begin{array} { r } { v _ { k + 1 } = v _ { k } + \frac { 1 } { L \theta _ { k } \theta _ { k + 1 } ^ { 2 } } \nabla f ( x _ { k } ) . } \end{array}$ .
130
+ 3: $\begin{array} { r } { x _ { k + 1 } = x _ { k } - \frac { 1 } { L } \nabla f ( x _ { k } ) - ( 2 \theta _ { k + 1 } ^ { 3 } - \theta _ { k + 1 } ^ { 2 } ) v _ { k + 1 } . } \end{array}$
131
+ 4: end for
132
+ Output: $x _ { N }$ .
133
+
134
+ 95 Appendix B. Recall that OGM-G has the following updates [33]. Let $y _ { 0 } = x _ { 0 }$ . For $k = 0 , \ldots , N - 1$ ,
135
+ 96
136
+
137
+ $$
138
+ \begin{array} { l } { \displaystyle y _ { k + 1 } = x _ { k } - \frac { 1 } { L } \nabla f ( x _ { k } ) , } \\ { \displaystyle x _ { k + 1 } = y _ { k + 1 } + \frac { ( \theta _ { k } - 1 ) \left( 2 \theta _ { k + 1 } - 1 \right) } { \theta _ { k } \left( 2 \theta _ { k } - 1 \right) } ( y _ { k + 1 } - y _ { k } ) + \frac { 2 \theta _ { k + 1 } - 1 } { 2 \theta _ { k } - 1 } ( y _ { k + 1 } - x _ { k } ) , } \end{array}
139
+ $$
140
+
141
+ where 97 is recursively defined: and $\begin{array} { r } { \int \theta _ { k } ^ { 2 } - \theta _ { k } = \theta _ { k + 1 } ^ { 2 } \quad k = 1 \dots N - 1 , } \end{array}$ $\{ \theta _ { k } \}$ $\theta _ { N } = 1$
142
+
143
+ 98 OGM-G was discovered from the numerical solution to an SDP problem and its analysis is to show
144
+ 99 that the step coefficients in (3) specify a feasible solution to the SDP problem. While this analysis is
145
+ 100 natural for the PEP approach, it is hard to understand how each coefficient affects the rate, especially
146
+ 101 if one wants to generalize the scheme. Here we provide a simple algebraic analysis for OGM-G.
147
+ 102 We start with a reformulation3 of OGM-G in Algorithm 1, which aims to simplify the proof. We
148
+ 103 adopt a consistent $\{ \theta _ { k } \}$ : $\theta _ { N } = 1$ and $\theta _ { k } ^ { 2 } - \theta _ { k } = \bar { \theta _ { k + 1 } ^ { 2 } } , k = 0 \dots N - 1$ , which only costs a constant
149
+ 104 factor.4 Interestingly, the reformulated scheme resembles the heavy-ball momentum method [49].
150
+ 105 However, it can be shown that Algorithm 1 is not covered by the heavy-ball momentum scheme.
151
+ 106 Defining $\theta _ { N + 1 } ^ { 2 } = \theta _ { N } ^ { 2 } - \theta _ { N } = 0$ , we provide the one-iteration analysis in the following proposition:
152
+
153
+ 107 Proposition 3.1. In Algorithm $\cdot$ , the following holds at any iteration $k \in \{ 0 , \ldots , N - 1 \}$ :
154
+
155
+ $$
156
+ \begin{array} { r l r } { \displaystyle A _ { k } + B _ { k + 1 } + C _ { k + 1 } + E _ { k + 1 } \leq A _ { k + 1 } + B _ { k } + C _ { k } + E _ { k } - \theta _ { k + 1 } \left. \nabla f ( x _ { k + 1 } ) , v _ { k + 1 } \right. } & { { } \quad } & { \displaystyle ( 4 ) } \\ { \displaystyle + \sum _ { i = k + 1 } ^ { N } \frac { \theta _ { i } } { L \theta _ { k } \theta _ { k + 1 } ^ { 2 } } \left. \nabla f ( x _ { k } ) , \nabla f ( x _ { i } ) \right. , } & { { } \quad } & { \displaystyle ( 4 ) } \end{array}
157
+ $$
158
+
159
+ $$
160
+ \begin{array} { r l } & { w i t h A _ { k } \triangleq \frac { 1 } { \theta _ { k } ^ { 2 } } ( f ( x _ { N } ) - f ( x ^ { \star } ) - \frac { 1 } { 2 L } \left. \nabla f ( x _ { N } ) \right. ^ { 2 } ) , B _ { k } \triangleq \frac { 1 } { \theta _ { k } ^ { 2 } } ( f ( x _ { k } ) - f ( x ^ { \star } ) ) , C _ { k } \triangleq \frac { 1 } { 2 L \theta _ { k } ^ { 2 } } \left. \nabla f ( x _ { k } ) \right. ^ { 2 } } \\ & { E _ { k } \triangleq \frac { \theta _ { k + 1 } ^ { 2 } } { \theta _ { k } } \left. \nabla f ( x _ { k } ) , v _ { k } \right. . } \end{array}
161
+ $$
162
+
163
+ 110 Remark 3.1.1. A recent work [15] also conducted an algebraic analysis of OGM-G under a potential
164
+ 111 function framework. Their potential function decrease can be directly obtained from Proposition 3.1
165
+ 112 by summing up (4). By contrast, our “momentum” vector $\{ v _ { k } \}$ naturally merges into the analysis,
166
+ 113 which significantly simplifies the analysis. Moreover, it provides a better interpretation on how
167
+ 114 OGM-G utilizes the past gradients to achieve acceleration.
168
+ 115 From (4), we see that only the last two terms do not telescope. Note that the “momentum” vector is a
169
+ 116 weighted sum of the past gradients, i.e., vk+1 = Pki=0 1Lθiθ2 . If we sum the terms up from
170
+ 117 $k = 0 , \ldots , N - 1$ , it can be verified that they exactly sum up to 0. The presence of these special
171
+ 118 terms prevents OGM-G to have a usual potential function (e.g., those in [6]). Then, by telescoping
172
+ 119 the remaining terms, we obtain the final convergence guarantee.
173
+
174
+ Theorem 3.1. The output of Algorithm 1 satisfies 20 $\begin{array} { r } { \left\| \nabla f ( x _ { N } ) \right\| ^ { 2 } \leq \frac { 8 L \Delta _ { 0 } } { ( N + 2 ) ^ { 2 } } } \end{array}$ .
175
+
176
+ 121 We observe two drawbacks of OGM-G (same as the algorithm description in [15]): (1) it requires storing a pre-computed parameter sequence, which costs 122 $O ( \textstyle { \frac { 1 } { \epsilon } } )$ floats; (2) except for the last iterate,
177
+
178
+ # Algorithm 2 M-OGM-G: Memory-saving OGM-G
179
+
180
+ Input: initial guess $x _ { 0 } \in \mathbb { R } ^ { d }$ , total iteration number $N$
181
+
182
+ Initialize: vector $v _ { 0 } = \mathbf { 0 }$ .
183
+
184
+ Output: $x _ { N }$ or $\begin{array} { r l } { { \operatorname { a r g m i n } _ { x \in \{ x _ { 0 } , \ldots , x _ { N } \} } \| \nabla f ( x ) \| } ~ } & { { } } \end{array}$
185
+
186
+ 123 all other iterates are not known to have guarantees. We resolve these issues by proposing another
187
+ 124 parameterization of Algorithm 1 in the next subsection.
188
+
189
+ # 25 3.1 Memory-Saving OGM-G
190
+
191
+ A straightforward idea to resolve the aforementioned issues is to generalize Algorithm 1. However, we find it rather difficult since the parameters in the analysis are rather strict (despite that the proof is already simple). We choose to rely on computer-aided techniques [19]. The derivation of this variant (Algorithm 2) is based on the following numerical experiment.
192
+
193
+ 130 Numerical experiment. OGM-G was discovered when considering the relaxed PEP problem [33]:
194
+
195
+ $$
196
+ \begin{array} { r l } & { \qquad \displaystyle \operatorname* { m a x } _ { \mathbf { \theta } } \quad \left\| \nabla f ( { x } _ { N } ) \right\| ^ { 2 } } \\ & { \displaystyle \nabla f ( { x } _ { 0 } ) , . . . , \nabla f ( { x } _ { N } ) { \in } \mathbb { R } ^ { d } } \\ & { f ( { x } _ { 0 } ) , . . . , f ( { x } _ { N } ) , f ( { x } ^ { \star } ) { \in } \mathbb { R } } \\ & { \displaystyle \left\{ \begin{array} { l c } { \mathrm { i n t e r p o l a t i o n ~ c o n d i t i o n ~ ( \omega ~ ) ~ a t ~ } ( { x } _ { k } , { x } _ { k + 1 } ) , } & { k = 0 , . . . , N - 1 , } \\ { \mathrm { i n t e r p o l a t i o n ~ c o n d i t i o n ~ ( \omega ~ ) ~ a t ~ } ( { x } _ { N } , { x } _ { k } ) , } & { k = 0 , . . . , N - 1 , } \\ { \mathrm { i n t e r p o l a t i o n ~ c o n d i t i o n ~ ( \omega ~ ) ~ a t ~ } ( { x } _ { N } , { x } ^ { \star } ) , } & { f ( { x } _ { 0 } ) - f ( { x } ^ { \star } ) \leq \Delta _ { 0 } , } \end{array} \right. } \end{array}
197
+ $$
198
+
199
+ 131 where the sequence $\{ x _ { k } \}$ is defined as $\begin{array} { r } { x _ { k + 1 } = x _ { k } - \frac { 1 } { L } \sum _ { i = 0 } ^ { k } h _ { k + 1 , i } \nabla f ( x _ { i } ) , k = 0 , \ldots , N - 1 } \end{array}$ for
200
+ 132 some step coefficients $h \in \mathbb { R } ^ { N ( N + 1 ) / 2 }$ . Given $N$ , the step coefficients of OGM-G correspond to
201
+ 133 a numerical solution to the problem: arg $\operatorname* { m i n } _ { h } \left\{ \begin{array} { r l r } \end{array} \right.$ {Lagrangian dual of $\left( \mathrm { P } \right) \}$ , which is denoted as (HD).
202
+ 134 Conceptually, solving problem (HD) would give us the fastest possible step coefficients under the
203
+ 135 constraints. 5 We expect there to be some constant-time slower schemes, which are neglected when
204
+ 136 solving (HD). To identify such schemes, we relax a set of interpolation conditions in problem (P):
205
+
206
+ $$
207
+ f ( x _ { N } ) - f ( x _ { k } ) - \langle \nabla f ( x _ { k } ) , x _ { N } - x _ { k } \rangle \geq { \frac { 1 } { 2 L } } \left. \nabla f ( x _ { N } ) - \nabla f ( x _ { k } ) \right. ^ { 2 } - \rho \left. \nabla f ( x _ { k } ) \right. ^ { 2 } ,
208
+ $$
209
+
210
+ 137 for $k = 0 , \ldots , N - 1$ and some $\rho > 0$ . After this relaxation, solving (HD) will no longer give us the
211
+ 138 step coefficients of OGM-G. By trying different $\rho$ and checking the dependence on $N$ , we discover
212
+ 139 Algorithm 2 when $\begin{array} { r } { \rho = \frac { 1 } { 2 L } } \end{array}$ . Similar to our analysis of OGM-G, we provide a simple algebraic analysis
213
+ 140 for the new variant in the following theorem.
214
+
215
+ Theorem 3.2. Define 141 $\begin{array} { r } { \delta _ { k + 1 } \triangleq \frac { 1 2 } { ( N - k + 1 ) ( N - k + 2 ) ( N - k + 3 ) } , k = 0 , \dots , N . } \end{array}$ In Algorithm 2, it holds that
216
+
217
+ $$
218
+ \sum _ { k = 0 } ^ { N } \frac { \delta _ { k + 1 } } { 2 } \left\| \nabla f ( x _ { k } ) \right\| ^ { 2 } \leq \frac { 1 2 L \Delta _ { 0 } } { ( N + 2 ) ( N + 3 ) } .
219
+ $$
220
+
221
+ 143 Remark 3.2.1. Algorithm 2 converges optimally on the last iterate (note that $\delta _ { N + 1 } = 2 _ { , }$ ) and the
222
+ 144 minimum gradient since
223
+
224
+ $$
225
+ \operatorname* { m i n } _ { k \in \{ 0 , \ldots , N \} } \| \nabla f ( x _ { k } ) \| ^ { 2 } \leq \frac { 1 } { \sum _ { k = 0 } ^ { N } \frac { \delta _ { k + 1 } } { 2 } } \sum _ { k = 0 } ^ { N } \frac { \delta _ { k + 1 } } { 2 } \left\| \nabla f ( x _ { k } ) \right\| ^ { 2 } \leq \frac { 8 L \Delta _ { 0 } } { ( N + 2 ) ( N + 3 ) - 2 } .
226
+ $$
227
+
228
+ 145 Clearly, the parameters of this variant can be computed on the fly and from (5), each iterate has a
229
+ 146 guarantee (although the guarantee degenerates quickly as $k 0$ since $1 / \delta _ { k + 1 } = \Omega ( ( N - k ) ^ { 3 } ) )$ .
230
+ 147 Moreover, we can extend the benefits into the IDC case using the ideas in [42] as summarized below.
231
+
232
+ Input: parameters $\{ \tau _ { k } \} , \{ p _ { k } \}$ , initial guess $x _ { 0 } \in \mathbb { R } ^ { d }$ , total iteration number $K$ . Initialize: vectors z0 = ˜x0 = x0 and scalars αk = 1 $\begin{array} { r } { \alpha _ { k } = \frac { L \tau _ { k } } { 1 - \tau _ { k } } , \forall k } \end{array}$ Lτk−τ , ∀k and τ = PK−1k=0 τ −2k .
233
+ 1: for $k = 0 , \ldots , K - 1$ do
234
+ 2: $\begin{array} { r } { y _ { k } = \tau _ { k } z _ { k } + ( 1 - \tau _ { k } ) \left( \tilde { x } _ { k } - \frac { 1 } { L } \nabla f ( \tilde { x } _ { k } ) \right) . } \end{array}$ .
235
+ 3: $z _ { k + 1 } = \arg \operatorname* { m i n } _ { x } \Big \{ \langle \mathcal { G } _ { k } , x \rangle + ( \alpha _ { k } / 2 ) \left. x - z _ { k } \right. ^ { 2 } \Big \} .$
236
+ 4: $/ / \mathcal { G } _ { k } \triangleq \nabla f _ { i _ { k } } ( y _ { k } ) - \nabla f _ { i _ { k } } ( \tilde { x } _ { k } ) + \nabla f ( \tilde { x } _ { k } )$ , where $i _ { k }$ is sampled uniformly in $[ n ]$ . $\tilde { x } _ { k + 1 } = \left\{ \begin{array} { l } { y _ { k } } \\ { \tilde { x } _ { k } } \end{array} \right.$ with probability with probability $p _ { k }$ .
237
+ 5: $1 - p _ { k }$
238
+
239
+ 6: end for
240
+
241
+ Output (for gradient): $x _ { \mathrm { o u t } }$ is sampled from $\begin{array} { r l } & { \Bigl \{ \mathrm { P r o b } \{ x _ { \mathrm { o u t } } = \tilde { x } _ { k } \} = \frac { \tau _ { k } ^ { - 2 } } { \tilde { \tau } } \Big | k \in \{ 0 , \dots , K - 1 \} \Bigr \} . } \end{array}$ Output (for function value): $\tilde { x } _ { K }$ .
242
+
243
+ 148 Corollary 3.2.1 (IDC case). If we first run $N / 2$ iterations of NAG and then continue with $N / 2$ iterations of Algorithm 2, we obtain an output satisfying 149 $\begin{array} { r } { \| \nabla f ( x _ { N } ) \| = O ( \frac { L R _ { 0 } } { N ^ { 2 } } ) } \end{array}$ .
244
+
245
+ # 150 4 Accelerated SVRG: Fast Rates for Both Gradient Norm and Objective
246
+
247
+ 151 In this section, we focus on the IDC case, i.e., $\| x _ { 0 } - x ^ { \star } \| \le R _ { 0 }$ for some $x ^ { \star } \in \mathcal { X } ^ { \star }$ . From the
248
+ 152 development in the previous section, it is natural to ask whether we can use the PEP approach to
249
+ 153 motivate new stochastic schemes. However, due to the exponential growth of the number of possible
250
+ 154 states $( i _ { 0 } , i _ { 1 } , \ldots )$ , we cannot directly adopt this approach. A feasible alternative is to first fix an
251
+ 155 algorithmic framework and a family of potential functions, and then use the potential-based PEP
252
+ 156 approach in [54]. However, this approach is much more restrictive. For example, it cannot identify
253
+ 157 special constructions like (4) in OGM-G. Fortunately, as we will see, we can get some inspiration
254
+ 158 from the recent development of deterministic methods. Proofs in this section are given in Appendix C.
255
+
256
+ Our proposed scheme is given in Algorithm 3. We adopt the elegant loopless design of SVRG in [34]. Note that the full gradient $\nabla f ( \tilde { x } _ { k } )$ is computed and stored only when $\tilde { x } _ { k + 1 } = y _ { k }$ at Step 5. We summarize our main technical novelty as follows.
257
+
258
+ 162 Main algorithmic novelty. The design of stochastic accelerated methods is largely inspired by
259
+ 163 NAG. To make it clear, by setting $n = 1$ , we see that Katyusha [1], MiG [61], SSNM [62], Varag [36],
260
+ 164 VRADA [52], ANITA [38], the acceleration framework in [16] and AC-SA [35, 24] all reduce to one
261
+ 165 of the following variants of NAG. We say that these methods are under the NAG framework.
262
+
263
+ $$
264
+ \begin{array} { r } { \left\{ \begin{array} { l l } { x _ { k } = \tau _ { k } z _ { k } + ( 1 - \tau _ { k } ) y _ { k } , } \\ { z _ { k + 1 } = z _ { k } - \alpha _ { k } \nabla f ( x _ { k } ) , } \\ { y _ { k + 1 } = \tau _ { k } z _ { k + 1 } + ( 1 - \tau _ { k } ) y _ { k } . } \end{array} \right. \qquad \left\{ \begin{array} { l l } { x _ { k } = \tau _ { k } z _ { k } + ( 1 - \tau _ { k } ) y _ { k } , } \\ { z _ { k + 1 } = z _ { k } - \alpha _ { k } \nabla f ( x _ { k } ) , } \\ { y _ { k + 1 } = x _ { k } - \eta _ { k } \nabla f ( x _ { k } ) . } \end{array} \right. } \end{array}
265
+ $$
266
+
267
+ Auslender and Teboulle [5]
268
+
269
+ Linear Coupling [64]
270
+
271
+ 166 See [57, 12] for other variants of NAG. When $n = 1$ , Algorithm 3 reduces to the following scheme:
272
+
273
+ $$
274
+ \left\{ \begin{array} { l } { y _ { k } = \tau _ { k } z _ { k } + \left( 1 - \tau _ { k } \right) \left( y _ { k - 1 } - \frac { 1 } { L } \nabla f ( y _ { k - 1 } ) \right) , } \\ { z _ { k + 1 } = z _ { k } - \frac { 1 } { \alpha _ { k } } \nabla f ( y _ { k } ) . } \end{array} \right.
275
+ $$
276
+
277
+ # Optimized Gradient Method (OGM) [19, 30]
278
+
279
+ 167 Algorithm 3 reduces to the scheme of OGM when $n = 1$ (this point is clearer in the formulation of
280
+ 168 ITEM in [55]). OGM has a constant-time faster worst-case rate than NAG, which exactly matches
281
+ 169 the lower complexity bound established in [17]. In the following proposition, we show that the OGM
282
+ 170 framework helps us conduct a tight one-iteration analysis, which gives room for achieving our goal.
283
+
284
+ Proposition 4.1. In Algorithm 3, the following holds at any iteration 171 $k \geq 0$ and $\forall x ^ { \star } \in \mathcal { X } ^ { \star }$ :
285
+
286
+ $$
287
+ \begin{array} { r l } & { \quad \left( \displaystyle \frac { 1 - \tau _ { k } } { \tau _ { k } ^ { 2 } p _ { k } } \mathbb { E } \left[ f ( \tilde { x } _ { k + 1 } ) - f ( x ^ { \star } ) \right] + \displaystyle \frac { L } { 2 } \mathbb { E } \left[ \| z _ { k + 1 } - x ^ { \star } \| ^ { 2 } \right] \right) + \displaystyle \frac { ( 1 - \tau _ { k } ) ^ { 2 } } { 2 L \tau _ { k } ^ { 2 } } \mathbb { E } \left[ \| \nabla f ( \tilde { x } _ { k } ) \| ^ { 2 } \right] } \\ & { \le \left( \displaystyle \frac { ( 1 - \tau _ { k } p _ { k } ) ( 1 - \tau _ { k } ) } { \tau _ { k } ^ { 2 } p _ { k } } \mathbb { E } \left[ f ( \tilde { x } _ { k } ) - f ( x ^ { \star } ) \right] + \displaystyle \frac { L } { 2 } \mathbb { E } \left[ \| z _ { k } - x ^ { \star } \| ^ { 2 } \right] \right) . } \end{array}
288
+ $$
289
+
290
+ 172 The terms inside the parentheses form the commonly used potential function of SVRG variants. The
291
+ 173 additional $\mathbb { E } [ \| \nabla f ( \tilde { x } _ { k } ) \| ^ { 2 } ]$ term is created by adopting the OGM framework. In other words, we use
292
+ 174 the following potential function for Algorithm 3 $( a _ { k } , b _ { k } , c _ { k } \ge 0 )$ :
293
+
294
+ $$
295
+ T _ { k } = a _ { k } \mathbb { E } \left[ f ( \tilde { x } _ { k } ) - f ( x ^ { \star } ) \right] + b _ { k } \mathbb { E } \left[ \left. z _ { k } - x ^ { \star } \right. ^ { 2 } \right] + \sum _ { i = 0 } ^ { k - 1 } c _ { i } \mathbb { E } \left[ \left. \nabla f ( \tilde { x } _ { i } ) \right. ^ { 2 } \right] .
296
+ $$
297
+
298
+ 175 We first provide a simple parameter choice, which leads to a simple and clean analysis.
299
+
300
+ Theorem 4.1 (Single-stage parameter choice). In Algorithm 3, if we choose 176 $\begin{array} { r } { p _ { k } \equiv \frac { 1 } { n } , \tau _ { k } = \frac { 3 } { k / n + 6 } } \end{array}$ , 177 then the following holds at the outputs:
301
+
302
+ $$
303
+ \begin{array} { r l } & { \mathbb { E } \left[ \| \nabla f ( x _ { 0 \mathrm { u t } } ) \| ^ { 2 } \right] = O \left( \frac { n ^ { 3 } L \left( f ( x _ { 0 } ) - f ( x ^ { \star } ) \right) + n ^ { 2 } L ^ { 2 } R _ { 0 } ^ { 2 } } { K ^ { 3 } } \right) , } \\ & { } \\ & { \mathbb { E } \left[ f ( \tilde { x } _ { K } ) \right] - f ( x ^ { \star } ) = O \left( \frac { n ^ { 2 } \left( f ( x _ { 0 } ) - f ( x ^ { \star } ) \right) + n L R _ { 0 } ^ { 2 } } { K ^ { 2 } } \right) . } \end{array}
304
+ $$
305
+
306
+ In other words, to guarantee that 178 $\mathbb { E } \left[ \lVert \nabla f ( x _ { \mathrm { o u t } } ) \rVert \right] \leq \epsilon _ { g }$ and $\mathbb { E } \left[ f ( \tilde { x } _ { K } ) \right] - f ( x ^ { \star } ) \le \epsilon _ { f }$ , the oracle complexities are O n(L(f(x0)−f(x?)))1/32/3179 $\begin{array} { r } { O \Big ( \frac { n ( L ( f ( x _ { 0 } ) - f ( x ^ { \star } ) ) ) ^ { 1 / 3 } } { \epsilon _ { g } ^ { 2 / 3 } } + \frac { ( n L R _ { 0 } ) ^ { 2 / 3 } } { \epsilon _ { g } ^ { 2 / 3 } } \Big ) } \end{array}$ and $\begin{array} { r } { O \Big ( n \sqrt { \frac { f ( x _ { 0 } ) - f ( x ^ { \star } ) } { \epsilon _ { f } } } + \frac { \sqrt { n L } R _ { 0 } } { \sqrt { \epsilon _ { f } } } \Big ) } \end{array}$ , respectively.
307
+
308
+ 180 From (7), we see that Algorithm 3 achieves fast $O \big ( \frac { 1 } { K ^ { 1 . 5 } } \big )$ and $\begin{array} { r } { O ( \frac { 1 } { K ^ { 2 } } ) } \end{array}$ rates for minimizing the
309
+ 181 gradient norm and function value at the same time. However, despite being a simple choice, the oracle
310
+ 182 complexities are not better than the deterministic methods in Table 1. Below we provide a two-stage
311
+ 183 parameter choice, which is inspired by the idea of including a “warm-up phase” in [3, 36, 52, 38].
312
+ 184
313
+
314
+ 185 Theorem 4.2 (Two-stage parameter choice). In Algorithm 3, let $\begin{array} { r } { p _ { k } = \operatorname* { m a x } \{ \frac { 6 } { k + 8 } , \frac { 1 } { n } \} , \tau _ { k } = \frac { 3 } { p _ { k } ( k + 8 ) } } \end{array}$ The oracle complexities needed to guarantee 186 $\mathbb { E } \left[ \lVert \nabla f ( x _ { \mathrm { o u t } } ) \rVert \right] \leq \epsilon _ { g }$ and $\mathbb { E } \left[ f ( { \tilde { x } } _ { K } ) \right] - f ( x ^ { \star } ) \leq \epsilon _ { f }$ are
315
+
316
+ $$
317
+ O \left( n \operatorname* { m i n } \left\{ \log \frac { L R _ { 0 } } { \epsilon _ { g } } , \log n \right\} + \frac { ( n L R _ { 0 } ) ^ { 2 / 3 } } { \epsilon _ { g } ^ { 2 / 3 } } \right) a n d O \left( n \operatorname* { m i n } \left\{ \log \frac { L R _ { 0 } ^ { 2 } } { \epsilon _ { f } } , \log n \right\} + \frac { \sqrt { n L } R _ { 0 } } { \sqrt { \epsilon _ { f } } } \right) ,
318
+ $$
319
+
320
+ 187 respectively.
321
+
322
+ 188 If $\epsilon$ is large or $n$ is very large, the recently proposed ANITA [38] achieves an $O ( n )$ complexity, which
323
+ 189 matches the lower complexity bound $\Omega ( n )$ in this case [58]. Since ANITA uses the NAG framework,
324
+ 190 we show that similar results can be derived under the OGM framework in the following theorem:
325
+ 191 Theorem 4.3 (Low accuracy parameter choice). In Algorithm 3, let iteration $N$ be the first time
326
+ 192 Step $^ { 5 }$ updates $\tilde { x } _ { k + 1 } = y _ { k }$ . If we choose $\begin{array} { r } { p _ { k } \equiv \frac { 1 } { n } } \end{array}$ $\begin{array} { r } { \tau _ { k } \equiv 1 - \frac { 1 } { \sqrt { n + 1 } } } \end{array}$ and terminate Algorithm $^ 3$ at
327
+ 193 iteration $N$ , then the following holds at $\tilde { x } _ { N + 1 }$ :
328
+
329
+ $$
330
+ \mathbb { E } \left[ \Vert \nabla f ( \tilde { x } _ { N + 1 } ) \Vert ^ { 2 } \right] \leq \frac { 8 L ^ { 2 } R _ { 0 } ^ { 2 } } { 5 ( \sqrt { n + 1 } + 1 ) } a n d \mathbb { E } \left[ f ( \tilde { x } _ { N + 1 } ) \right] - f ( x ^ { \star } ) \leq \frac { L R _ { 0 } ^ { 2 } } { \sqrt { n + 1 } + 1 } .
331
+ $$
332
+
333
+ In particular, if the required accuracies are low (or 194 $n$ is very large), i.e., $\begin{array} { r } { \epsilon _ { g } ^ { 2 } \ge \frac { 8 L ^ { 2 } R _ { 0 } ^ { 2 } } { 5 ( \sqrt { n + 1 } + 1 ) } } \end{array}$ and 195 $\begin{array} { r } { \epsilon _ { f } \ge \frac { L R _ { 0 } ^ { 2 } } { \sqrt { n + 1 } + 1 } } \end{array}$ , then Algorithm 3 only has an $O ( n )$ oracle complexity.
334
+
335
+ 196 In the low accuracy region (specified above), the choice in Theorem 4.3 removes the $O ( \log \frac { 1 } { \epsilon } )$ factor
336
+ 197 in the complexity of Theorem 4.2. We include some numerical justifications of Algorithm 3 in
337
+ 198 Appendix A. We believe that the potential-based PEP approach in [54] can help us identify better
338
+ 199 parameter choices of Algorithm 3, which we leave for future work.
339
+ Input: accuracy $\epsilon > 0$ , parameters $\delta _ { 0 } = L , \beta > 1$ , initial guess $x _ { 0 } \in \mathbb { R } ^ { d }$ .
340
+ 1: for $t = 0 , 1 , 2 , \ldots$ do
341
+ 2: Define $\begin{array} { r } { f ^ { \delta _ { t } } ( x ) = ( 1 / n ) \sum _ { i = 1 } ^ { n } f _ { i } ^ { \delta _ { t } } ( x ) } \end{array}$ , where $f _ { i } ^ { \delta _ { t } } ( x ) = f _ { i } ( x ) + ( \delta _ { t } / 2 ) \| x - x _ { 0 } \| ^ { 2 }$ .
342
+ 3: Initialize vectors $z _ { 0 } = \tilde { x } _ { 0 } = x _ { 0 }$ and set $\tau _ { x } , \tau _ { z } , \alpha , p , C _ { \mathrm { I D C } } , C _ { \mathrm { I F C } }$ according to Proposition 5.1.
343
+ 4: for $k = 0 , 1 , 2 , \ldots$ . do
344
+ 5: $y _ { k } = \tau _ { x } z _ { k } + \left( 1 - \tau _ { x } \right) \tilde { x } _ { k } + \tau _ { z } \left( \delta _ { t } ( \tilde { x } _ { k } - z _ { k } ) - \nabla f ^ { \delta _ { t } } ( \tilde { x } _ { k } ) \right) .$
345
+ 6: $\begin{array} { r l } & { y _ { k } - \iota _ { x } { \sim } k \stackrel { \iota _ { 1 } } { \sim } \iota _ { 1 } \stackrel { \iota _ { x } } { \sim } \iota _ { k } \stackrel { \iota _ { 1 } } { \sim } \iota _ { 2 } \stackrel { \iota _ { z } } { \sim } \iota _ { k } \stackrel { \iota _ { x } } { \sim } \iota _ { k } / \stackrel { \textsf { v } _ { j } } { \sim } \iota _ { k } / \jmath \cdot } \\ & { z _ { k + 1 } = \arg \operatorname* { m i n } _ { x } \Big \{ \left. { Q _ { k } ^ { \delta _ { t } } } , x \right. + ( \alpha / 2 ) \left\| x - z _ { k } \right\| ^ { 2 } + \left( \delta _ { t } / 2 \right) \left\| x - y _ { k } \right\| ^ { 2 } \Big \} . } \end{array}$
346
+ 7: $/ / \mathcal { G } _ { k } ^ { \delta _ { t } } \triangleq \nabla f _ { i _ { k } } ^ { \delta _ { t } } ( y _ { k } ) - \nabla f _ { i _ { k } } ^ { \delta _ { t } } ( \tilde { x } _ { k } ) + \nabla f ^ { \delta _ { t } } ( \tilde { x } _ { k } )$ , where $i _ { k }$ is sampled uniformly in $[ n ]$ .
347
+ 8: x˜k+1 二 yk with probability x˜k with probability $p$ ,− p.
348
+ 9: if $^ 6 \| \nabla f ( \tilde { x } _ { k } ) \| \le \epsilon$ then output $\tilde { x } _ { k }$ and terminate the algorithm.
349
+ 10: if under IDC and $\begin{array} { r } { ( 1 + \frac { \delta _ { t } } { \alpha } ) ^ { k } \ge \sqrt { C _ { \mathrm { I D C } } } / \delta _ { t } } \end{array}$ then break the inner loop.
350
+ 11: if under IFC and $\begin{array} { r } { ( 1 + \frac { \delta _ { t } } { \alpha } ) ^ { k } \ge \sqrt { C _ { \mathrm { I F C } } / 2 \delta _ { t } } } \end{array}$ then break the inner loop.
351
+ 12: end for
352
+ 13: $\delta _ { t + 1 } = \delta _ { t } / \beta$ .
353
+ 14: end for
354
+
355
+ # 200 5 Near-Optimal Accelerated SVRG with Adaptive Regularization
356
+
357
+ 201 Currently, there is no known stochastic method that directly achieves the optimal rate in $\epsilon$ . To get near
358
+ 202 optimal rates, the existing strategy is to use a carefully designed regularization technique [42, 2] with
359
+ 203 a method that solves strongly convex problems; see, e.g., [42, 2, 22, 11]. However, the regularization
360
+ 204 parameter requires the knowledge of $R _ { 0 }$ or $\Delta _ { 0 }$ , which significantly limits its practicality.
361
+ 205 Inspired by the recently proposed adaptive regularization technique [27], we develop a near-optimal
362
+ 206 accelerated SVRG variant (Algorithm 4) that does not require the knowledge of $R _ { 0 }$ or $\Delta _ { 0 }$ . Note
363
+ 207 that this technique was originally proposed for NAG under the IDC assumption. Our development√
364
+ 208 extends this technique to the stochastic setting, which brings an $O ( { \sqrt { n } } )$ rate improvement. Moreover,
365
+ 209 we consider both IFC and IDC cases. Proofs in this section are provided in Appendix D.
366
+ 210 Detailed design. Algorithm 4 has a “guess-and-check” framework. In the outer loop, we first
367
+ 211 define the regularized objective $f ^ { \delta _ { t } }$ using the current estimate of regularization parameter $\delta _ { t }$ , and
368
+ 212 then we initialize an accelerated SVRG method (the inner loop) to solve the $\delta _ { t }$ -strongly convex $f ^ { \delta _ { t } }$
369
+ 213 If the inner loop breaks at Step 10 or 11, indicating the poor quality of the current estimate $\delta _ { t }$ , $\delta _ { t }$ will
370
+ 214 be divided by a fixed $\beta$ . Thus, conceptually, we can adopt any method that solves strongly convex
371
+ 215 finite-sums at the optimal rate as the inner loop. However, since the constructions of Step 10 or 11
372
+ 216 require some algorithm-dependent constants, we have to fix one method as the inner loop.
373
+ 217 The inner loop we adopted is a loopless variant of BS-SVRG [63]. This is because (i) BS-SVRG is
374
+ 218 the fastest known accelerated SVRG variant (for ill-conditioned problems) and (ii) it has a simple
375
+ 219 scheme, especially after using the loopless construction [34]. However, its original guarantee is built
376
+ 220 upon $\left\{ z _ { k } \right\}$ . Clearly, we cannot implement the stopping criterion (Step 9) on $\| \bar { \nabla } f ( z _ { k } ) \|$ . Interestingly,
377
+ 221 we discover that its sequence $\left\{ \widetilde { x } _ { k } \right\}$ works perfectly in our regularization framework, even if we can
378
+ 222 neither establish convergence on $f ( \tilde { x } _ { k } ) - f ( x ^ { \star } )$ nor on $\| \tilde { x } _ { k } - x ^ { \star } \| ^ { 2 }$ . 7 Moreover, we find that the
379
+ 223 loopless construction significantly simplifies the parameter constraints of BS-SVRG, which originally
380
+ 224 involves $\Theta ( n )$ th-order inequality. We provide the detailed parameter choice as follows:
381
+
382
+ Proposition 5.1 (Parameter choice). In Algorithm 4, we set $\begin{array} { r } { \tau _ { x } = \frac { \alpha + \delta _ { t } } { \alpha + L + \delta _ { t } } } \end{array}$ tα+L+δt , τz = $\begin{array} { r } { \tau _ { z } = \frac { \tau _ { x } } { \delta _ { t } } - \frac { \alpha ( 1 - \tau _ { x } ) } { \delta _ { t } L } } \end{array}$ and $\textstyle p = { \frac { 1 } { n } }$ . We set $\alpha$ as the (unique) positive root of the cubic equation $\begin{array} { r } { \left( 1 - \frac { p ( \alpha + \delta _ { t } ) } { \alpha + L + \delta _ { t } } \right) \left( 1 + \frac { \delta _ { t } } { \alpha } \right) ^ { 2 } = 1 } \end{array}$ and specify $\begin{array} { r } { C _ { \mathrm { I D C } } = L ^ { 2 } + \frac { L \alpha ^ { 2 } p } { L + ( 1 - p ) ( \alpha + \delta _ { t } ) } , C _ { \mathrm { I F C } } = 2 L + \frac { 2 L \alpha ^ { 2 } p } { ( L + ( 1 - p ) ( \alpha + \delta _ { t } ) ) \delta _ { t } } } \end{array}$ . Under these choices, we have $\begin{array} { r } { \frac { \alpha } { \delta _ { t } } = O \big ( n + \sqrt { n ( L / \delta _ { t } + 1 ) } \big ) , C _ { \mathrm { I D C } } = O \big ( ( L + \delta _ { t } ) ^ { 2 } \big ) } \end{array}$ , and $C _ { \mathrm { I F C } } = O ( L )$ .
383
+
384
+ 29 Under the choices of $\tau _ { x }$ and $\tau _ { z }$ , the $\alpha$ above is the optimal choice in our analysis. Then, we can
385
+ 30 characterize the progress of the inner loop in the following proposition:
386
+ 231 Proposition 5.2 (The inner loop of Algorithm 4). Using the parameters specified in Proposition 5.1,
387
+ 232 after running the inner loop (Step 4-12) of Algorithm 4 for $k$ iterations, we can conclude that
388
+
389
+ (i) under IDC, i.e., $\| x _ { 0 } - x ^ { \star } \| \leq R _ { 0 }$ for some $x ^ { \star } \in \mathcal { X } ^ { \star }$ ,
390
+
391
+ $$
392
+ \mathbb { E } \left[ \lVert \nabla f ( \tilde { x } _ { k } ) \rVert \right] \leq \left( \delta _ { t } + \left( 1 + \frac { \delta _ { t } } { \alpha } \right) ^ { - k } \sqrt { C _ { \mathrm { I D C } } } \right) R _ { 0 } ,
393
+ $$
394
+
395
+ 234
396
+
397
+ (ii) under IFC, i.e., $f ( x _ { 0 } ) - f ( x ^ { \star } ) \leq \Delta _ { 0 }$ ,
398
+
399
+ $$
400
+ \mathbb { E } \left[ \Vert \nabla f ( \tilde { x } _ { k } ) \Vert \right] \leq \left( \sqrt { 2 \delta _ { t } } + \left( 1 + \frac { \delta _ { t } } { \alpha } \right) ^ { - k } \sqrt { C _ { \mathrm { I F C } } } \right) \sqrt { \Delta _ { 0 } } .
401
+ $$
402
+
403
+ 235 The above results motivate the design of Step 10 and 11. For example, in the IDC case, when the
404
+ 236 inner loop breaks at Step 10, using $( i )$ above, we obtain $\mathbb { E } \left[ \lVert \nabla f ( \tilde { x } _ { k } ) \rVert \right] \leq 2 \delta _ { t } R _ { 0 }$ . Then, by discussing
405
+ 237 the relative size of $\delta _ { t }$ and a certain constant, we can estimate the complexity of Algorithm 4. The
406
+ 238 same methodology is used for the IFC case.
407
+
408
+ Theorem 5.1 (IDC case). Denote δ?IDC = q2R f or some $q \in ( 0 , 1 )$ and let the outer iteration $t = \ell$ be the first time8 $\delta _ { \ell } \leq \delta _ { \mathrm { I D C } } ^ { \star }$ . The following assertions hold:
409
+
410
+ (i) At outer iteration $\ell _ { i }$ , Algorithm 4 terminates with probability at least $1 - q$ .9 (ii) The total expected oracle complexity of the $\ell + 1$ outer loops is
411
+
412
+ $$
413
+ O \left( \left( n \log \frac { L R _ { 0 } } { \epsilon q } + \sqrt { \frac { n L R _ { 0 } } { \epsilon q } } \right) \log \frac { L R _ { 0 } } { \epsilon q } \right) .
414
+ $$
415
+
416
+ Theorem 5.2 (IFC case). Denote 243 $\begin{array} { r } { \delta _ { \mathrm { I F C } } ^ { \star } = \frac { \epsilon ^ { 2 } q ^ { 2 } } { 8 \Delta _ { 0 } } } \end{array}$ for some $q \in ( 0 , 1 )$ and let the outer iteration $t = \ell$ be the first time 244 $\delta _ { \ell } \leq \delta _ { \mathrm { I F C } } ^ { \star }$ . The following assertions hold:
417
+
418
+ (i) At outer iteration $\ell ,$ , Algorithm 4 terminates with probability at least $1 - q$ . $( i i )$ The total expected oracle complexity of the $\ell + 1$ outer loops is
419
+
420
+ $$
421
+ O \left( \left( n \log \frac { \sqrt { L \Delta _ { 0 } } } { \epsilon q } + \frac { \sqrt { n L \Delta _ { 0 } } } { \epsilon q } \right) \log \frac { \sqrt { L \Delta _ { 0 } } } { \epsilon q } \right) .
422
+ $$
423
+
424
+ 247 Compared with regularized Katyusha in Table 1, the adaptive regularization approach drops the need
425
+ 248 to estimate $R _ { 0 }$ or $\Delta _ { 0 }$ at the cost of a mere $\log { \frac { 1 } { \epsilon } }$ factor in the non-dominant term (if $\epsilon$ is small).
426
+
427
+ # 6 Discussion
428
+
429
+ In this work, we proposed several simple and practical schemes that complement existing works (Table 1). Admittedly, the new schemes are currently only limited to the unconstrained Euclidean setting, because our techniques heavily rely on the interpolation conditions (1) and (2). On the other hand, methods such as OGM [30], TM [51] and ITEM [55, 10], which also rely on these conditions, are still not known to have their proximal variants. We list a few future directions as follows.
430
+
431
+ (1) It is not clear how to naturally connect the parameters of M-OGM-G (Algorithm 2) to OGM-G (Algorithm 1). The parameters of both algorithms seem to be quite restrictive and hardly generalizable due to the special construction in (4). Does there exist an optimal method for minimizing the gradient norm that has a proper potential function (at each iteration)?
432
+
433
+ (2) Is this new “momentum” in OGM-G beneficial for training neural nets? Other classic momentum schemes such as NAG [40] or heavy-ball momentum method [49] are extremely effective for this task [53], and they were also originally proposed for convex objectives.
434
+
435
+ (3) Can we directly accelerate SARAH (L2S)? By extending OGM-G? It seems that existing stochastic acceleration techniques fail to accelerate SARAH (or result in poor dependence on $n$ as in [16]).
436
+
437
+ # References
438
+
439
+ [1] Z. Allen-Zhu. Katyusha: The first direct acceleration of stochastic gradient methods. Journal of Machine Learning Research, 18(1):8194–8244, 2017. 2, 6, 26 [2] Z. Allen-Zhu. How to make the gradients small stochastically: Even faster convex and nonconvex sgd. In Advances in Neural Information Processing Systems, pages 1157–1167, 2018. 1, 2, 8 [3] Z. Allen-Zhu and Y. Yuan. Improved SVRG for Non-Strongly-Convex or Sum-of-Non-Convex Objectives. In Proceedings of The 33rd International Conference on Machine Learning, pages 1080–1089, 2016. 7 [4] Z. Allen-Zhu, Y. Li, R. M. de Oliveira, and A. Wigderson. Much Faster Algorithms for Matrix Scaling. In C. Umans, editor, 58th IEEE Annual Symposium on Foundations of Computer Science, pages 890–901, 2017. 1 [5] A. Auslender and M. Teboulle. Interior gradient and proximal methods for convex and conic optimization. SIAM Journal on Optimization, 16(3):697–725, 2006. 6 [6] N. Bansal and A. Gupta. Potential-Function Proofs for Gradient Methods. Theory of Computing, 15(4):1–32, 2019. 4 [7] Y. Carmon, J. C. Duchi, O. Hinder, and A. Sidford. Lower bounds for finding stationary points ii: first-order methods. Mathematical Programming, 185(1-2), 2021. 1, 2, 3 [8] C.-C. Chang and C.-J. 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. 13, 14 [9] M. B. Cohen, A. Madry, D. Tsipras, and A. Vladu. Matrix Scaling and Balancing via Box Constrained Newton’s Method and Interior Point Methods. In IEEE 58th Annual Symposium on Foundations of Computer Science, pages 902–913. IEEE, 2017. 1
440
+ [10] A. d’Aspremont, D. Scieur, and A. Taylor. Acceleration methods. arXiv preprint arXiv:2101.09545, 2021. 9
441
+ [11] D. Davis and D. Drusvyatskiy. Complexity of finding near-stationary points of convex functions stochastically. arXiv preprint arXiv:1802.08556, 2018. 8
442
+ [12] A. Defazio. On the Curved Geometry of Accelerated Optimization. In Advances in Neural Information Processing Systems, volume 32, pages 1764–1773, 2019. 6
443
+ [13] A. Defazio, F. R. Bach, and S. Lacoste-Julien. SAGA: A Fast Incremental Gradient Method With Support for Non-Strongly Convex Composite Objectives. In Advances in Neural Information Processing Systems, pages 1646–1654, 2014. 14
444
+ [14] J. Diakonikolas and C. Guzmán. Complementary Composite Minimization, Small Gradients in General Norms, and Applications to Regression Problems. arXiv preprint arXiv:2101.11041, 2021. 1
445
+ [15] J. Diakonikolas and P. Wang. Potential Function-based Framework for Making the Gradients Small in Convex and Min-Max Optimization. arXiv preprint arXiv:2101.12101, 2021. 1, 4
446
+ [16] D. Driggs, M. J. Ehrhardt, and C.-B. Schönlieb. Accelerating variance-reduced stochastic gradient methods. Mathematical Programming, 2020. doi: 10.1007/s10107-020-01566-2. 6, 9
447
+ [17] Y. Drori. The exact information-based complexity of smooth convex minimization. Journal of Complexity, 39:1–16, 2017. 1, 6
448
+ [18] Y. Drori and A. Taylor. On the oracle complexity of smooth strongly convex minimization. arXiv preprint arXiv:2101.09740, 2021. 1
449
+ [19] Y. Drori and M. Teboulle. Performance of first-order methods for smooth convex minimization: a novel approach. Mathematical Programming, 145(1-2):451–482, 2014. 1, 3, 5, 6
450
+ [20] D. Dua and C. Graff. UCI machine learning repository, 2017. URL http://archive.ics. uci.edu/ml. 13, 14
451
+ [21] C. Fang, C. J. Li, Z. Lin, and T. Zhang. SPIDER: Near-Optimal Non-Convex Optimization via Stochastic Path-Integrated Differential Estimator. In Advances in Neural Information Processing Systems, pages 687–697, 2018. 1
452
+
453
+ 315 [22] D. J. Foster, A. Sekhari, O. Shamir, N. Srebro, K. Sridharan, and B. Woodworth. The Complexity
454
+ 316 of Making the Gradient Small in Stochastic Convex Optimization. In Proceedings of the Thirty
455
+ 317 Second Conference on Learning Theory, pages 1319–1345, 2019. 1, 2, 8
456
+ 318 [23] R. Ge, F. Huang, C. Jin, and Y. Yuan. Escaping From Saddle Points — Online Stochastic
457
+ 319 Gradient for Tensor Decomposition. In Proceedings of The 28th Conference on Learning
458
+ 320 Theory, pages 797–842, 2015. 1
459
+ 321 [24] S. Ghadimi and G. Lan. Optimal stochastic approximation algorithms for strongly convex
460
+ 322 stochastic composite optimization i: A generic algorithmic framework. SIAM Journal on
461
+ 323 Optimization, 22(4):1469–1492, 2012. 6
462
+ 324 [25] S. Ghadimi and G. Lan. Stochastic first-and zeroth-order methods for nonconvex stochastic
463
+ 325 programming. SIAM Journal on Optimization, 23(4):2341–2368, 2013. 1
464
+ 326 [26] S. Ghadimi and G. Lan. Accelerated gradient methods for nonconvex nonlinear and stochastic
465
+ 327 programming. Mathematical Programming, 156(1-2):59–99, 2016. 1
466
+ 328 [27] M. Ito and M. Fukuda. Nearly optimal first-order methods for convex optimization under
467
+ 329 gradient norm measure: An adaptive regularization approach. Journal of Optimization Theory
468
+ 330 and Applications, 188(3):770–804, 2021. 1, 2, 8
469
+ 331 [28] C. Jin, R. Ge, P. Netrapalli, S. M. Kakade, and M. I. Jordan. How to Escape Saddle Points
470
+ 332 Efficiently. In Proceedings of the 34th International Conference on Machine Learning, pages
471
+ 333 1724–1732, 2017. 1
472
+ 334 [29] R. Johnson and T. Zhang. Accelerating Stochastic Gradient Descent using Predictive Variance
473
+ 335 Reduction. In Advances in Neural Information Processing Systems, pages 315–323, 2013. 3, 14
474
+ 336 [30] D. Kim and J. A. Fessler. Optimized first-order methods for smooth convex minimization.
475
+ 337 Mathematical Programming, 159(1):81–107, 2016. 1, 6, 9
476
+ 338 [31] D. Kim and J. A. Fessler. Another Look at the Fast Iterative Shrinkage/Thresholding Algorithm
477
+ 339 (FISTA). SIAM Journal on Optimization, 28(1):223–250, 2018. 1, 3
478
+ 340 [32] D. Kim and J. A. Fessler. Generalizing the optimized gradient method for smooth convex
479
+ 341 minimization. SIAM Journal on Optimization, 28(2):1920–1950, 2018. 1, 2, 3
480
+ 342 [33] D. Kim and J. A. Fessler. Optimizing the efficiency of first-order methods for decreasing the
481
+ 343 gradient of smooth convex functions. Journal of Optimization Theory and Applications, 188(1):
482
+ 344 192–219, 2021. 1, 2, 3, 4, 5
483
+ 345 [34] D. Kovalev, S. Horváth, and P. Richtárik. Don’t jump through hoops and remove those loops:
484
+ 346 SVRG and Katyusha are better without the outer loop. In Algorithmic Learning Theory, pages
485
+ 347 451–467. PMLR, 2020. 6, 8
486
+ 348 [35] G. Lan. An optimal method for stochastic composite optimization. Mathematical Programming,
487
+ 349 133(1-2):365–397, 2012. 6
488
+ 350 [36] G. Lan, Z. Li, and Y. Zhou. A unified variance-reduced accelerated gradient method for
489
+ 351 convex optimization. In Advances in Neural Information Processing Systems, volume 32, pages
490
+ 352 10462–10472, 2019. 6, 7
491
+ 353 [37] B. Li, M. Ma, and G. B. Giannakis. On the Convergence of SARAH and Beyond. In Proceedings
492
+ 354 of the Twenty Third International Conference on Artificial Intelligence and Statistics, pages
493
+ 355 223–233, 2020. 2, 14, 27
494
+ 356 [38] Z. Li. ANITA: An Optimal Loopless Accelerated Variance-Reduced Gradient Method. arXiv
495
+ 357 preprint arXiv:2103.11333, 2021. 6, 7
496
+ 358 [39] Q. Lin and L. Xiao. An Adaptive Accelerated Proximal Gradient Method and its Homotopy
497
+ 359 Continuation for Sparse Optimization. In Proceedings of the 31th International Conference on
498
+ 360 Machine Learning, pages 73–81, 2014. 1
499
+ 361 [40] Y. Nesterov. A method for solving the convex programming problem with convergence rate
500
+ 362 $O ( 1 / k ^ { 2 } )$ . In Dokl. akad. nauk Sssr, volume 269, pages 543–547, 1983. 1, 2, 9
501
+ 363 [41] Y. Nesterov. Introductory lectures on convex optimization: A basic course, volume 87. Springer
502
+ 364 Science & Business Media, 2003. 1
503
+ 365 [42] Y. Nesterov. How to make the gradients small. Optima. Mathematical Optimization Society
504
+ 366 Newsletter, (88):10–11, 2012. 1, 2, 5, 8, 22, 27
505
+
506
+ 67 [43] Y. Nesterov. Gradient methods for minimizing composite functions. Mathematical Programming, 140(1):125–161, 2013. 1 [44] Y. Nesterov. Lectures on convex optimization, volume 137. Springer, 2018. 3, 18 [45] Y. Nesterov, A. Gasnikov, S. Guminov, and P. Dvurechensky. Primal–dual accelerated gradient methods with small-dimensional relaxation oracle. Optimization Methods and Software, pages 1–38, 2020. 2 [46] L. M. Nguyen, J. Liu, K. Scheinberg, and M. Takác. SARAH: A Novel Method for Ma- ˇ chine Learning Problems Using Stochastic Recursive Gradient. In Proceedings of the 34th International Conference on Machine Learning, pages 2613–2621, 2017. 1, 2 [47] N. H. Pham, L. M. Nguyen, D. T. Phan, and Q. Tran-Dinh. ProxSARAH: An efficient algorithmic framework for stochastic composite nonconvex optimization. Journal of Machine Learning Research, 21(110):1–48, 2020. 1 [48] J. Platt. Sequential minimal optimization: A fast algorithm for training support vector machines. 1998. 14 [49] B. T. Polyak. Some methods of speeding up the convergence of iteration methods. Ussr computational mathematics and mathematical physics, 4(5):1–17, 1964. 4, 9 [50] U. G. Rothblum and H. Schneider. Scalings of matrices which have prespecified row sums and column sums via optimization. Linear Algebra and its Applications, 114:737–764, 1989. 1 [51] B. V. Scoy, R. A. Freeman, and K. M. Lynch. The Fastest Known Globally Convergent FirstOrder Method for Minimizing Strongly Convex Functions. IEEE Control Systems Letters, 2(1): 49–54, 2017. 9 [52] C. Song, Y. Jiang, and Y. Ma. Variance Reduction via Accelerated Dual Averaging for FiniteSum Optimization. In Advances in Neural Information Processing Systems, volume 33, pages 833–844, 2020. 6, 7 [53] I. Sutskever, J. Martens, G. Dahl, and G. Hinton. On the importance of initialization and momentum in deep learning. In Proceedings of the 30th International Conference on Machine Learning, pages 1139–1147, 2013. 9 [54] A. Taylor and F. Bach. Stochastic first-order methods: non-asymptotic and computer-aided analyses via potential functions. In Conference on Learning Theory, pages 2934–2992, 2019. 2, 3, 6, 7 [55] A. Taylor and Y. Drori. An optimal gradient method for smooth strongly convex minimization. arXiv preprint arXiv:2101.09741, 2021. 1, 6, 9 [56] A. B. Taylor, J. M. Hendrickx, and F. Glineur. Smooth strongly convex interpolation and exact worst-case performance of first-order methods. Mathematical Programming, 161(1-2):307–345, 2017. 3 [57] P. Tseng. On accelerated proximal gradient methods for convex-concave optimization. https: //www.mit.edu/\~dimitrib/PTseng/papers/apgm.pdf, 2008. Accessed May 1, 2020. 6 [58] B. E. Woodworth and N. Srebro. Tight Complexity Bounds for Optimizing Composite Objectives. In Advances in Neural Information Processing Systems, pages 3639–3647, 2016. 3, 7 [59] L. Xiao and T. Zhang. A Proximal Stochastic Gradient Method with Progressive Variance Reduction. SIAM Journal on Optimization, 24(4):2057–2075, 2014. 3, 14 [60] D. Zhou, P. Xu, and Q. Gu. Stochastic Nested Variance Reduction for Nonconvex Optimization. Journal of Machine Learning Research, 21:103:1–103:63, 2020. 1 [61] K. Zhou, F. Shang, and J. Cheng. A Simple Stochastic Variance Reduced Algorithm with Fast Convergence Rates. In Proceedings of the 35th International Conference on Machine Learning, pages 5980–5989, 2018. 6 [62] K. Zhou, Q. Ding, F. Shang, J. Cheng, D. Li, and Z.-Q. Luo. Direct Acceleration of SAGA using Sampled Negative Momentum. In Proceedings of the Twenty Second International Conference on Artificial Intelligence and Statistics, pages 1602–1610, 2019. 6 [63] K. Zhou, A. M.-C. So, and J. Cheng. Boosting First-Order Methods by Shifting Objective: New Schemes with Faster Worst-Case Rates. In Advances in Neural Information Processing Systems, pages 15405–15416, 2020. 3, 8, 22
507
+
508
+ 20 [64] Z. A. Zhu and L. Orecchia. Linear Coupling: An Ultimate Unification of Gradient and Mirror Descent. In 8th Innovations in Theoretical Computer Science Conference, volume 67 of LIPIcs, pages 3:1–3:22, 2017. 6
509
+
510
+ # Checklist
511
+
512
+ 1. For all authors...
513
+
514
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
515
+ (b) Did you describe the limitations of your work? [Yes] See Section 6.
516
+ (c) Did you discuss any potential negative societal impacts of your work? [N/A] We are not aware of clear negative societal impacts since we focus on developing generic algorithms for convex optimization.
517
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
518
+
519
+ 2. If you are including theoretical results...
520
+
521
+ (a) Did you state the full set of assumptions of all theoretical results? [Yes] See the introduction. (b) Did you include complete proofs of all theoretical results? [Yes]
522
+
523
+ 3. If you ran experiments...
524
+
525
+ (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]
526
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix A.
527
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See Figure 1.
528
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Appendix A.
529
+
530
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
531
+
532
+ (a) If your work uses existing assets, did you cite the creators? [Yes] See Appendix A.
533
+ (b) Did you mention the license of the assets? [Yes] LIBSVM [8] is under the BSD license.
534
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes]
535
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes] Details can be found in the online dataset repositories [8, 20].
536
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes] Details can be found in the online dataset repositories [8, 20].
537
+
538
+ 5. If you used crowdsourcing or conducted research with human subjects...
539
+
540
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
541
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
542
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/r1lIKlSYvH/r1lIKlSYvH.md ADDED
@@ -0,0 +1,592 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # THE USUAL SUSPECTS? REASSESSING BLAME FOR VAE POSTERIOR COLLAPSE
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ In narrow asymptotic settings Gaussian VAE models of continuous data have been shown to possess global optima aligned with ground-truth distributions. Even so, it is well known that poor solutions whereby the latent posterior collapses to an uninformative prior are sometimes obtained in practice. However, contrary to conventional wisdom that largely assigns blame for this phenomena on the undue influence of KL-divergence regularization, we will argue that posterior collapse is, at least in part, a direct consequence of bad local minima inherent to the loss surface of deep autoencoder networks. In particular, we prove that even small nonlinear perturbations of affine VAE decoder models can produce such minima, and in deeper models, analogous minima can force the VAE to behave like an aggressive truncation operator, provably discarding information along all latent dimensions in certain circumstances. Regardless, the underlying message here is not meant to undercut valuable existing explanations of posterior collapse, but rather, to refine the discussion and elucidate alternative risk factors that may have been previously underappreciated.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ The variational autoencoder (VAE) (Kingma & Welling, 2014; Rezende et al., 2014) represents a powerful generative model of data points that are assumed to possess some complex yet unknown latent structure. This assumption is instantiated via the marginalized distribution
12
+
13
+ $$
14
+ \begin{array} { r } { p _ { \theta } ( { \pmb x } ) = \int p _ { \theta } ( { \pmb x } | z ) p ( z ) d z , } \end{array}
15
+ $$
16
+
17
+ which forms the basis of prevailing VAE models. Here $z \in \mathbb { R } ^ { \kappa }$ is a collection of unobservable latent factors of variation that, when drawn from the prior $p ( z )$ , are colloquially said to generate an observed data point $\pmb { x } \in \mathbb { R } ^ { d }$ through the conditional distribution $p _ { \boldsymbol { \theta } } ( \boldsymbol { x } | \boldsymbol { z } )$ . The latter is controlled by parameters $\theta$ that can, at least conceptually speaking, be optimized by maximum likelihood over $p _ { \theta } ( { \pmb x } )$ given available training examples.
18
+
19
+ In particular, assuming $n$ training points $\pmb { X } = [ \pmb { x } ^ { ( 1 ) } , \ldots , \pmb { x } ^ { ( n ) } ]$ , maximum likelihood estimation is
20
+ tantamount to minimizing the negative log-ling further, because the marginalization over elihood expression in (1) is often intra $\begin{array} { r } { \frac { 1 } { n } \sum _ { i } - \log \left[ p _ { \theta } \left( \pmb { x } ^ { ( i ) } \right) \right] } \end{array}$ . Proceed- minimizes $_ z$
21
+ a convenient variational upper bound given by ${ \mathcal { L } } ( \theta , \phi )$ ,
22
+
23
+ $$
24
+ \begin{array} { r l } { \texttt { \small s s m v s u m ~ v a t a t o r o u a t o r p r a t ~ w o u n g e } \texttt { \small s t v a n g e } } & { \sim \texttt { \small s t } _ { \forall } , } \\ { \frac { 1 } { n } \displaystyle \sum _ { i = 1 } ^ { n } \left\{ - \mathbb { E } _ { q _ { \phi } \left( z \mid x ^ { ( i ) } \right) } \left[ \log p _ { \theta } \left( x ^ { ( i ) } | z \right) \right] + \mathbb { E } \mathbb { L } \left[ q _ { \phi } ( z | x ^ { ( i ) } | | p ( z ) \right] \right\} } & { \geq \texttt { \small \frac { 1 } { n } } \displaystyle \sum _ { i = 1 } ^ { n } - \log \left[ p _ { \theta } \left( x ^ { ( i ) } \right) \right] , } \end{array}
25
+ $$
26
+
27
+ with equality iff $q _ { \phi } ( \pmb { z } | \pmb { x } ^ { ( i ) } ) = p _ { \theta } ( \pmb { z } | \pmb { x } ^ { ( i ) } )$ for all $i$ . The additional parameters $\phi$ govern the shape of the variational distribution $q _ { \phi } ( \pmb { z } | \pmb { x } )$ that is designed to approximate the true but often intractable latent posterior $p _ { \theta } ( \pmb { z } | \pmb { x } )$ .
28
+
29
+ The VAE energy from (2) is composed of two terms, a data-fitting loss that borrows the basic structure of an autoencoder (AE), and a KL-divergence-based regularization factor. The former incentivizes assigning high probability to latent codes $_ z$ that facilitate accurate reconstructions of each $\pmb { x } ^ { ( i ) }$ . In fact, if $q _ { \phi } ( \pmb { z } | \pmb { x } )$ is a Dirac delta function, this term is exactly equivalent to a deterministic AE with data reconstruction loss defined by $- \log p _ { \theta } \left( \pmb { x } | z \right)$ . Overall, it is because of this association that $q _ { \phi } ( \pmb { z } | \pmb { x } )$ is generally referred to as the encoder distribution, while $p _ { \boldsymbol { \theta } } \left( \boldsymbol { \mathbf { \mathcal { x } } } | \boldsymbol { z } \right)$ denotes the decoder distribution. Additionally, the $\mathrm { K L }$ regularizer ${ \mathbb K } { \mathbb L } \left[ q _ { \phi } ( { \pmb z } | { \pmb x } ) | | p ( { \pmb z } ) \right]$ pushes the encoder distribution towards the prior without violating the variational bound.
30
+
31
+ For continuous data, which will be our primary focus herein, it is typical to assume that
32
+
33
+ $$
34
+ p ( z ) = { \mathcal { N } } ( z | \mathbf { 0 } , I ) , \ p _ { \theta } \left( x | z \right) = { \mathcal { N } } ( x | \mu _ { x } , \gamma I ) .
35
+ $$
36
+
37
+ where $\gamma > 0$ is a scalar variance parameter, while the Gaussian moments $\mu _ { x } \equiv \mu _ { x } \left( z ; \theta \right)$ , $\mu _ { z } \equiv$ $\mu _ { z } \left( x ; \phi \right)$ , and $\Sigma _ { z } \equiv \mathrm { d i a g } [ \pmb { \sigma } _ { z } ( \pmb { x } ; \bar { \phi } ) ] ^ { 2 }$ are computed via feedforward neural network layers. The encoder network parameterized by $\phi$ takes $_ { \textbf { \em x } }$ as an input and outputs $\pmb { \mu } _ { z }$ and $\Sigma _ { z }$ . Similarly the decoder network parameterized by $\theta$ converts a latent code $_ z$ into $\mu _ { x }$ . Given these assumptions, the generic VAE objective from (2) can be refined to
38
+
39
+ $$
40
+ \begin{array} { r l r } { \mathcal { L } ( \boldsymbol { \theta } , \boldsymbol { \phi } ) } & { = } & { \frac { 1 } { n } \displaystyle \sum _ { i = 1 } ^ { n } \left\{ \mathbb { E } _ { \boldsymbol { q } _ { \boldsymbol { \phi } } \left( \boldsymbol { z } \mid \boldsymbol { x } ^ { ( i ) } \right) } \left[ \frac { 1 } { \gamma } \| \mathbf { x } ^ { ( i ) } - \boldsymbol { \mu } _ { \boldsymbol { x } } \left( \boldsymbol { z } ; \boldsymbol { \theta } \right) \| _ { 2 } ^ { 2 } \right] \right. } \\ & { } & { \left. + d \log \gamma + \left\| \sigma _ { \boldsymbol { z } } \left( \mathbf { x } ^ { ( i ) } ; \boldsymbol { \phi } \right) \right\| _ { 2 } ^ { 2 } - \log \left| \mathrm { d i a g } \left[ \sigma _ { \boldsymbol { z } } \left( \mathbf { x } ^ { ( i ) } ; \boldsymbol { \phi } \right) \right] ^ { 2 } \right| + \left\| \boldsymbol { \mu } _ { \boldsymbol { z } } \left( \mathbf { x } ^ { ( i ) } ; \boldsymbol { \phi } \right) \right\| _ { 2 } ^ { 2 } \right\} , } \end{array}
41
+ $$
42
+
43
+ excluding an inconsequential factor of $1 / 2$ . This expression can be optimized over using SGD and a simple reparameterization strategy (Kingma & Welling, 2014; Rezende et al., 2014) to produce parameter estimates $\{ \theta ^ { * } , \phi ^ { * } \}$ . Among other things, new samples approximating the training data can then be generated via the ancestral process $z ^ { n \bar { e } w } \sim \mathcal { N } ( z | \bar { 0 } , I )$ and $\pmb { x } ^ { n e w } \sim \bar { p } \theta ^ { * } ( \pmb { x } | z ^ { n e w } )$ .
44
+
45
+ Although it has been argued that global minima of (4) may correspond with the optimal recovery of ground truth distributions in certain asymptotic settings (Dai & Wipf, 2019), it is well known that in practice, VAE models are at risk of converging to degenerate solutions where, for example, it may be that $q _ { \phi } \left( z | \pmb { x } \right) = p ( z )$ . This phenomena, commonly referred to as VAE posterior collapse (He et al., 2019; Razavi et al., 2019), has been acknowledged and analyzed from a variety of different perspectives as we detail in Section 2. That being said, we would argue that there remains lingering ambiguity regarding the different types and respective causes of posterior collapse. Consequently, Section 3 provides a useful taxonomy that will serve to contextualize our main technical contributions. These include the following:
46
+
47
+ • Building upon existing analysis of affine VAE decoder models, in Section 4 we prove that even arbitrarily small nonlinear activations can introduce suboptimal local minima exhibiting posterior collapse.
48
+ • We demonstrate in Section 5 that if the encoder/decoder networks are incapable of sufficiently reducing the VAE reconstruction errors, even in a deterministic setting with no KL-divergence regularizer, there will exist an implicit lower bound on the optimal value of $\gamma$ . Moreover, we prove that if this $\gamma$ is sufficiently large, the VAE will behave like an aggressive thresholding operator, enforcing exact posterior collapse, i.e., $q _ { \phi } \left( z | \pmb { x } \right) = p ( z )$ .
49
+ • Based on these observations, we present experiments in Section 6 establishing that as network depth/capacity is increased, even for deterministic AE models with no regularization, reconstruction errors become worse. This bounds the effective VAE trade-off parameter $\gamma$ such that posterior collapse is essentially inevitable. Collectively then, we provide convincing evidence that posterior collapse is, at least in certain settings, the fault of deep AE local minima, and need not be exclusively a consequence of usual suspects such as the KL-divergence term.
50
+
51
+ We conclude in Section 7 with practical take-home messages, and motivate the search for improved AE architectures and training regimes that might be leveraged by analogous VAE models.
52
+
53
+ # 2 RECENT WORK AND THE USUAL SUSPECTS FOR INSTIGATING COLLAPSE
54
+
55
+ Posterior collapse under various guises is one of the most frequently addressed topics related to VAE performance. Depending on the context, arguably the most common and seemingly transparent suspect for causing collapse is the KL regularization factor that is obviously minimized by $q _ { \phi } ( z | \pmb { x } ) = p ( z )$ . This perception has inspired various countermeasures, including heuristic annealing of the KL penalty or KL warm-start (Bowman et al., 2015; Huang et al., 2018; Sønderby et al., 2016), tighter bounds on the log-likelihood (Burda et al., 2015; Rezende & Mohamed, 2015), more complex priors (Bauer & Mnih, 2018; Tomczak & Welling, 2018), modified decoder architectures (Cai et al., 2017; Dieng et al., 2018; Yeung et al., 2017), or efforts to explicitly disallow the prior from ever equaling the variational distribution (Razavi et al., 2019). Thus far though, most published results do not indicate success generating high-resolution images, and in the majority of cases, evaluations are limited to small images and/or relatively shallow networks. This suggests that there may be more nuance involved in pinpointing the causes and potential remedies of posterior collapse. One notable exception though is the BIVA model from (Maaløe et al., 2019), which employs a bidirectional hierarchy of latent variables, in part to combat posterior collapse. While improvements in NLL scores have been demonstrated with BIVA using relatively deep encoder/decoders, this model is significantly more complex and difficult to analyze.
56
+
57
+ On the analysis side, there have been various efforts to explicitly characterize posterior collapse in restricted settings. For example, Lucas et al. (2019) demonstrate that if $\gamma$ is fixed to a sufficiently large value, then a VAE energy function with an affine decoder mean will have minima that overprune latent dimensions. A related linearized approximation to the VAE objective is analyzed in (Rolinek et al., 2019); however, collapsed latent dimensions are excluded and it remains somewhat unclear how the surrogate objective relates to the original. Posterior collapse has also been associated with data-dependent decoder covariance networks $\Sigma _ { x } ( z ; \theta ) \neq \gamma I$ (Mattei & Frellsen, 2018), which allows for degenerate solutions assigning infinite density to a single data point and a diffuse, collapsed density everywhere else. Finally, from the perspective of training dynamics, (He et al., 2019) argue that a lagging inference network can also lead to posterior collapse.
58
+
59
+ # 3 TAXONOMY OF POSTERIOR COLLAPSE
60
+
61
+ Although there is now a vast literature on the various potential causes of posterior collapse, there remains ambiguity as to exactly what this phenomena is referring to. In this regard, we believe that it is critical to differentiate five subtle yet quite distinct scenarios that could reasonably fall under the generic rubric of posterior collapse:
62
+
63
+ (i) Latent dimensions of $_ z$ that are not needed for providing good reconstructions of the training data are set to the prior, meaning $q _ { \phi } ( z _ { j } | \pmb { x } ) \approx p ( z _ { j } ) = N ( 0 , 1 )$ at any superfluous dimension $j$ . Along other dimensions $\sigma _ { z } ^ { 2 }$ will be near zero and $\pmb { \mu } _ { z }$ will provide a usable predictive signal leading to accurate reconstructions of the training data. This case can actually be viewed as a desirable form of selective posterior collapse that, as argued in (Dai & Wipf, 2019), is a necessary (albeit not sufficient) condition for generating good samples.
64
+ (ii) The decoder variance $\gamma$ is not learned but fixed to a large value1 such that the KL term from (2) is overly dominant, forcing most or all dimensions of $_ z$ to follow the prior $\mathcal { N } ( 0 , 1 )$ . In this scenario, the actual global optimum of the VAE energy (conditioned on $\gamma$ being fixed) will lead to deleterious posterior collapse and the model reconstructions of the training data will be poor. In fact, even the original marginal log-likelihood can potentially default to a trivial/useless solution if $\gamma$ is fixed too large, assigning a small marginal likelihood to the training data, provably so in the affine case (Lucas et al., 2019).
65
+ (iii) As mentioned previously, if the Gaussian decoder covariance is learned as a separate network structure (instead of simply $\pmb { \Sigma } _ { x } ( z ; \theta ) = \gamma \pmb { I } )$ ), there can exist degenerate solutions that assign infinite density to a single data point and a diffuse, isotropic Gaussian elsewhere (Mattei & Frellsen, 2018). This implies that (4) can be unbounded from below at what amounts to a posterior collapsed solution and bad reconstructions almost everywhere.
66
+ (iv) When powerful non-Gaussian decoders are used, and in particular those that can parameterize complex distributions regardless of the value of $_ z$ (e.g., PixelCNN-based (Van den Oord et al., 2016)), it is possible for the VAE to assign high-probability to the training data even if $q _ { \phi } ( z | \pmb { x } ) = p ( z )$ (Alemi et al., 2017; Bowman et al., 2015; Chen et al., 2016). This category of posterior collapse is quite distinct from categories (ii) and (iii) above in that, although the reconstructions are similarly poor, the associated NLL scores can still be good.
67
+ (v) The previous four categories of posterior collapse can all be directly associated with emergent properties of the VAE global minimum under various modeling conditions. In contrast, a fifth type of collapse exists that is the explicit progeny of bad VAE local minima. More
68
+
69
+ specifically, as we will argue shortly, when deeper encoder/decoder networks are used, the risk of converging to bad, overregularized solutions increases.
70
+
71
+ The remainder of this paper will primarily focus on category (v), with brief mention of the other types for comparison purposes where appropriate. Our rationale for this selection bias is that, unlike the others, category (i) collapse is actually advantageous and hence need not be mitigated. In contrast, while category (ii) is undesirable, it be can be avoided by learning $\gamma$ . As for category (iii), this represents an unavoidable consequence of models with flexible decoder covariances capable of detecting outliers (Dai et al., 2019). In fact, even simpler inlier/outlier decomposition models such as robust PCA are inevitably at risk for this phenomena (Candes et al., 2011). Regardless, when \` $\begin{array} { r } { \pmb { \Sigma } _ { z } ( \pmb { x } ; \pmb { \theta } ) = \gamma \pmb { I } } \end{array}$ this problem goes away. And finally, we do not address category (iv) in depth simply because it is unrelated to the canonical Gaussian VAE models of continuous data that we have chosen to examine herein. Regardless, it is still worthwhile to explicitly differentiate these five types and bare them in mind when considering attempts to both explain and improve VAE models.
72
+
73
+ # 4 INSIGHTS FROM SIMPLIFIED CASES
74
+
75
+ Because different categories of posterior collapse can be impacted by different global/local minima structures, a useful starting point is a restricted setting whereby we can comprehensively characterize all such minima. For this purpose, we first consider a VAE model with the decoder network set to an affine function. As is often assumed in practice, we choose $\Sigma _ { x } = \gamma I$ , where $\gamma > 0$ is a scalar parameter within the parameter set $\theta$ . In contrast, for the mean function we choose $\pmb { \mu } _ { x } = \pmb { W } _ { x } \pmb { z } + \pmb { b } _ { x }$ for some weight matrix $W _ { x }$ and bias vector $b _ { x }$ . The encoder can be arbitrarily complex (although the optimal structure can be shown to be affine as well).
76
+
77
+ Given these simplifications, and assuming the training data has $r \geq \kappa$ nonzero singular values, it has been demonstrated that at any global optima, the columns of $W _ { x }$ will correspond with the first $\kappa$ principal components of $\boldsymbol { X }$ provided that we simultaneously learn $\gamma$ or set it to the optimal value (which is available in closed form) (Dai et al., 2019; Lucas et al., 2019; Tipping & Bishop, 1999). Additionally, it has also be shown that no spurious, suboptimal local minima will exist. Note also that if $r < \kappa$ the same basic conclusions still apply; however, $W _ { x }$ will only have $r$ nonzero columns, each corresponding with a different principal component of the data. The unused latent dimensions will satisfy $q _ { \phi } ( z | \bar { x } ) = \mathcal { N } ( \mathbf { 0 } , I )$ , which represents the canonical form of the benign category (i) posterior collapse. Collectively, these results imply that if we converge to any local minima of the VAE energy, we will obtain the best possible linear approximation to the data using a minimal number of latent dimensions, and malignant posterior collapse is not an issue, i.e., categories (ii)-(v) will not arise.
78
+
79
+ Even so, if instead of learning $\gamma$ , we choose a fixed value that is larger than any of the significant singular values of $X X ^ { \top }$ , then category (ii) posterior collapse can be inadvertently introduced. More specifically, let $\tilde { r } _ { \gamma }$ denote the number of such singular values that are smaller than some fixed $\gamma$ value. Then along $\kappa - \tilde { r } _ { \gamma }$ latent dimensions $q _ { \phi } ( z | \bar { x } ) = \mathcal { N } ( \mathbf { 0 } , I )$ , and the corresponding columns of $W _ { x }$ will be set to zero at the global optima (conditioned on this fixed $\gamma$ ), regardless of whether or not these dimensions are necessary for accurately reconstructing the data. And it has been argued that the risk of this type of posterior collapse at a conditionally-optimal global minimum will likely be inherited by deeper models as well (Lucas et al., 2019), although learning $\gamma$ can ameliorate this problem.
80
+
81
+ Of course when we move to more complex architectures, the risk of bad local minima or other suboptimal stationary points becomes a new potential concern, and it is not clear that the affine case described above contributes to reliable, predictive intuitions. To illustrate this point, we will now demonstrate that the introduction of an arbitrarily small nonlinearity can nonetheless produce a pernicious local minimum that exhibits category (v) posterior collapse. For this purpose, we assume the decoder mean function
82
+
83
+ $$
84
+ \begin{array} { r } { \mu _ { x } = \pi _ { \alpha } \left( W _ { x } z \right) + b _ { x } , \mathrm { ~ w i t h ~ } \pi _ { \alpha } ( u ) \stackrel { \Delta } { = } \mathrm { s i g n } ( u ) \left( | u | - \alpha \right) _ { + } , \alpha \geq 0 . } \end{array}
85
+ $$
86
+
87
+ The function $\pi _ { \alpha }$ is nothing more than a soft-threshold operator as is commonly used in neural network architectures designed to reflect unfolded iterative algorithms for representation learning (Gregor & LeCun, 2010; Sprechmann et al., 2015). In the present context though, we choose this nonlinearity largely because it allows (5) to reflect arbitrarily small perturbations away from a strictly affine model, and indeed if $\alpha = 0$ the exact affine model is recovered. Collectively, these specifications lead to the parameterization $\theta = \{ W _ { x } , b _ { x } , \gamma \}$ and $\phi = \{ \pmb { \mu } _ { z } ^ { ( i ) } , \pmb { \sigma } _ { z } ^ { ( i ) } \} _ { i = 1 } ^ { n }$ and energy (excluding irrelevant scale factors and constants) given by
88
+
89
+ $$
90
+ \begin{array} { r l r } { \mathcal { L } ( \theta , \phi ) } & { = } & { \displaystyle \sum _ { i = 1 } ^ { n } \left\{ \mathbb { E } _ { q _ { \phi } \left( \boldsymbol { z } \mid \mathbf { x } ^ { ( i ) } \right) } \left[ \frac { 1 } { \gamma } \left\| \mathbf { x } ^ { ( i ) } - \boldsymbol { \pi } _ { \alpha } \left( W _ { x } \boldsymbol { z } \right) - \boldsymbol { b } _ { x } \right\| _ { 2 } ^ { 2 } \right] \right. } \\ & { } & { \left. + d \log \gamma + \left\| \boldsymbol { \sigma } _ { { z } } ^ { ( i ) } \right\| _ { 2 } ^ { 2 } - \log \left| \operatorname { d i a g } \left[ \boldsymbol { \sigma } _ { { z } } ^ { ( i ) } \right] ^ { 2 } \right| + \left\| \boldsymbol { \mu } _ { { z } } ^ { ( i ) } \right\| _ { 2 } ^ { 2 } \right\} , } \end{array}
91
+ $$
92
+
93
+ where $\mu _ { z } ^ { ( i ) }$ and $\pmb { \sigma } _ { z } ^ { ( i ) }$ denote arbitrary encoder moments for data point $i$ (this is consistent with the assumption of an arbitrarily complex encoder as used in previous analysis of affine decoder models). Now define $\begin{array} { r } { \bar { \gamma } \triangleq \frac { 1 } { n d } \sum _ { i } \| \pmb { x } ^ { ( i ) } - \bar { \pmb { x } } \| _ { 2 } ^ { 2 } } \end{array}$ , with $\begin{array} { r } { \bar { \mathbf { x } } \triangleq \frac { 1 } { n } \sum _ { i } \mathbf { x } ^ { ( i ) } } \end{array}$ . We then have the following result:
94
+
95
+ Proposition 4.1 For any $\alpha > 0$ , there will always exist data sets $\boldsymbol { X }$ such that (6) has a global minimum that perfectly reconstructs the training data, but also a bad local minimum characterized by
96
+
97
+ $$
98
+ q _ { \phi } ( z | \mathbf { x } ) = { \mathcal { N } } ( z | \mathbf { 0 } , I ) a n d p _ { \theta } ( \mathbf { x } ) = { \mathcal { N } } ( \mathbf { x } | { \bar { \mathbf { x } } } , { \bar { \boldsymbol { \gamma } } } I ) .
99
+ $$
100
+
101
+ Hence the moment we allow for nonlinear (or more precisely, non-affine) decoders there can exist a poor local minimum, across all parameters including a learnable $\gamma$ , that exhibits category (v) posterior collapse.2 In other words, no predictive information about $_ { \textbf { \em x } }$ passes through the latent space, and a useless/non-informative distribution $p _ { \theta } ( { \pmb x } )$ emerges that is incapable of assigning high probability to the data (except obviously in the trivial degenerate case where all the data points are equal to the empirical mean $\bar { \mathbf { x } }$ ). We will next investigate the degree to which such concerns can influence behavior in arbitrarily deep architectures.
102
+
103
+ # 5 EXTRAPOLATING TO PRACTICAL DEEP ARCHITECTURES
104
+
105
+ Previously we have demonstrated the possibility of local minima aligned with category (v) posterior collapse the moment we allow for decoders that deviate ever so slightly from an affine model. But nuanced counterexamples designed for proving technical results notwithstanding, it is reasonable to examine what realistic factors are largely responsible for leading optimization trajectories towards such potential bad local solutions. For example, is it merely the strength of the KL regularization term, and if so, why can we not just use KL warm-start to navigate around such points? In this section we will elucidate a deceptively simple, alternative risk factor that will be corroborated empirically in Section 6.
106
+
107
+ From the outset, we should mention that with deep encoder/decoder architectures commonly used in practice, a stationary point can more-or-less always exist at solutions exhibiting posterior collapse. As a representative and ubiquitous example, please see Appendix A.4. But of course without further details, this type of stationary point could conceivably manifest as a saddle point (stable or unstable), a local maximum, or a local minimum. For the strictly affine decoder model mentioned in Section 4, there will only be a harmless unstable saddle point at any collapsed solution (the Hessian has negative eigenvalues). In contrast, for the special nonlinear case elucidated via Proposition 4.1 we can instead have a bad local minima. We will now argue that as the depth of common feedforward architectures increases, the risk of converging to category (v)-like solutions with most or all latent dimensions stuck at bad stationary points can also increase.
108
+
109
+ Somewhat orthogonal to existing explanations of posterior collapse, our basis for this argument is not directly related to the VAE KL-divergence term. Instead, we consider a deceptively simple yet potentially influential alternative: Unregularized, deterministic AE models can have bad local solutions with high reconstruction errors when sufficiently deep. This in turn can directly translate to category (v) posterior collapse when training a corresponding VAE model with a matching deep architecture. Moreover, to the extent that this is true, KL warm-start or related countermeasures will likely be ineffective in avoiding such suboptimal minima. We will next examine these claims in greater depth followed by a discussion of practical implications.
110
+
111
+ # 5.1 FROM DEEPER ARCHITECTURES TO INEVITABLE POSTERIOR COLLAPSE
112
+
113
+ Consider the deterministic AE model formed by composing the encoder mean $\mu _ { x } \equiv \mu _ { x } \left( \cdot ; \theta \right)$ and decoder mean $\pmb { \mu } _ { z } \equiv \pmb { \mu } _ { z } \left( \cdot ; \phi \right)$ networks from a VAE model, i.e., reconstructions $\hat { \pmb x }$ are computed via $\hat { \textbf { \textit { x } } } = \mu _ { x } \left[ \pmb { \mu } _ { z } \left( \pmb { x } ; \phi \right) ; \theta \right]$ . We then train this AE to minimize the squared-error loss $\begin{array} { r } { \frac { 1 } { n d } \sum _ { i = 1 } ^ { n } \bigg \| \pmb { x } ^ { ( i ) } - \hat { \pmb { x } } ^ { ( i ) } \bigg \| _ { 2 } ^ { 2 } } \end{array}$ , producing parameters $\{ \theta _ { a e } , \phi _ { a e } \}$ . Analogously, the corresponding VAE trained to minimize (4) arrives at a parameter set denoted $\{ \theta _ { v a e } , \phi _ { v a e } \}$ . In this scenario, it will typically follow that
114
+
115
+ $$
116
+ \frac { 1 } { n d } \sum _ { i = 1 } ^ { n } \left. x ^ { ( i ) } - \mu _ { x } \left[ \mu _ { z } \left( x ^ { ( i ) } ; \phi _ { a e } \right) ; \theta _ { a e } \right] \right. _ { 2 } ^ { 2 } \leq \frac { 1 } { n d } \sum _ { i = 1 } ^ { n } \mathbb { E } _ { q _ { \phi _ { v a c } } \left( z | X ^ { ( i ) } \right) } \left[ \left. x ^ { ( i ) } - \mu _ { x } \left( z ; \theta _ { v a e } \right) \right. _ { 2 } ^ { 2 } \right] ,
117
+ $$
118
+
119
+ meaning that the deterministic AE reconstruction error will generally be smaller than the stochastic VAE version. Note that if $\sigma _ { z } ^ { 2 } \to 0$ , the VAE defaults to the same deterministic encoder as the AE and hence will have identical representational capacity; however, the KL regularization prevents this from happening, and any $\sigma _ { z } ^ { 2 } > 0$ can only make the reconstructions worse.3 Likewise, the KL penalty factor $\| \bar { \mu } _ { z } ^ { 2 } \| _ { 2 } ^ { 2 }$ can further restrict the effective capacity and increase the reconstruction error of the training data. Beyond these intuitive arguments, we have never empirically found a case where (8) does not hold (see Section 6 for examples).
120
+
121
+ We next define the set
122
+
123
+ $$
124
+ S _ { \varepsilon } \ \triangleq \ \left\{ \theta , \phi : \ { \frac { 1 } { n d } } \sum _ { i = 1 } ^ { n } \left\| { \pmb x } ^ { ( i ) } - { \hat { \pmb x } } ^ { ( i ) } \right\| _ { 2 } ^ { 2 } \leq \varepsilon \right\}
125
+ $$
126
+
127
+ for any $\epsilon > 0$ . Now suppose that the chosen encoder/decoder architecture is such that with high probability, achievable optimization trajectories (e.g., via SGD or related) lead to parameters $\{ \theta _ { a e } , \phi _ { a e } \} \not \in { \mathcal { S } } _ { \varepsilon }$ , i.e., Prob $( \{ \theta _ { a e } , \phi _ { a e } \} \in S _ { \varepsilon } ) \approx 0$ . It then follows that the optimal VAE noise variance denoted $\gamma ^ { * }$ , when conditioned on practically-achievable values for other network parameters, will satisfy
128
+
129
+ $$
130
+ \begin{array} { r l } { \gamma ^ { * } \ = \ \frac { 1 } { n d } \displaystyle \sum _ { i = 1 } ^ { n } \mathbb { E } _ { q _ { \phi _ { v a e } } \left( z | \pmb { x } ^ { ( i ) } \right) } \left[ \left\| \pmb { x } ^ { ( i ) } - \pmb { \mu } _ { x } \left( z ; \theta _ { v a e } \right) \right\| _ { 2 } ^ { 2 } \right] \ \geq \ \varepsilon . } \end{array}
131
+ $$
132
+
133
+ The equality in (10) can be confirmed by simply differentiating the VAE cost w.r.t. $\gamma$ and equating to zero, while the inequality comes from (8) and the fact that $\{ \bar { \theta } _ { a e } , \phi _ { a e } \} \not \in { \mathcal S } _ { \varepsilon }$ .
134
+
135
+ From inspection of the VAE energy from (4), it is readily apparent that larger values of $\gamma$ will discount the data-fitting term and therefore place greater emphasis on the KL divergence. Since the latter is minimized when the latent posterior equals the prior, we might expect that whenever $\varepsilon$ and therefore $\gamma ^ { * }$ is increased per (10), we are at a greater risk of nearing collapsed solutions. But the nature of this approach is not at all transparent, and yet this subtlety has important implications for understanding the VAE loss surface in regions at risk of posterior collapse.
136
+
137
+ For example, one plausible hypothesis is that only as $\gamma ^ { * } \to \infty$ do we risk full category (v) collapse. If this were the case, we might have less cause for alarm since the reconstruction error and by association $\gamma ^ { * }$ will typically be bounded from above at any local minimizer. However, we will now demonstrate that even finite values can exactly collapse the posterior. In formally showing this, it is helpful to introduce a slightly narrower but nonetheless representative class of VAE models.
138
+
139
+ Specifically, let $\begin{array} { r l r } { f \left( \pmb { \mu } _ { z } , \pmb { \sigma } _ { z } , \theta , \pmb { x } ^ { ( i ) } \right) } & { \triangleq } & { \mathbb { E } _ { q _ { \phi } \left( \pmb { z } | \pmb { x } ^ { ( i ) } \right) } \left[ \| \pmb { x } ^ { ( i ) } - \pmb { \mu } _ { x } \left( \pmb { z } ; \theta \right) \| _ { 2 } ^ { 2 } \right] } \end{array}$ , i.e., the VAE data term evaluated at a single data point without the $1 / \gamma$ scale factor. We then define a wellbehaved $V A E$ as a model with energy function (4) designed such that $\nabla _ { \mu _ { z } } f \left( \mu _ { z } , \pmb { \sigma } _ { z } , \theta , \pmb { x } ^ { ( i ) } \right)$ and $\nabla _ { \sigma _ { z } } f \left( \mu _ { z } , \pmb { \sigma } _ { z } , \theta , \pmb { x } ^ { ( i ) } \right)$ are Lipschitz continuous gradients for all $i$ . Furthermore, we specify a nondegenerate decoder as any $\mu _ { x } ( z ; \theta = \tilde { \theta } )$ with $\theta$ set to a $\tilde { \theta }$ value such that $\nabla _ { \sigma _ { z } } f \left( \mu _ { z } , \sigma _ { z } , \tilde { \theta } , \mathbf { x } ^ { ( i ) } \right) \geq$ $c$ for some constant $c > 0$ that can be arbitrarily small. This ensures that $f$ is an increasing function of $\pmb { \sigma } _ { z }$ , a quite natural stipulation given that increasing the encoder variance will generally only serve to corrupt the reconstruction, unless of course the decoder is completely blocking the signal from the encoder. In the latter degenerate situation, it would follow that $\nabla _ { \mu _ { z } } \bar { f } \left( \mu _ { z } , \pmb { \sigma } _ { z } , \pmb { \theta } , \pmb { x } ^ { ( i ) } \right) =$ $\nabla _ { \sigma _ { z } } f \left( \mu _ { z } , \sigma _ { z } , \theta , \mathbf { x } ^ { ( i ) } \right) = 0$ , which is more-or-less tantamount to category (v) posterior collapse.
140
+
141
+ Based on these definitions, we can now present the following:
142
+
143
+ Proposition 5.1 For any well-behaved VAE with arbitrary, non-degenerate decoder $\mu _ { x } ( z ; \theta = \tilde { \theta } )$ , there will always exist a $\gamma ^ { \prime } < \infty$ such that the trivial solution $\mu _ { x } ( z ; \theta \neq { \tilde { \theta } } ) = { \bar { x } }$ and $q _ { \phi } ( { \pmb z } | { \pmb x } ) =$ $p ( z )$ will have lower cost.
144
+
145
+ Around any evaluation point, the sufficient condition we applied to demonstrate posterior collapse (see proof details) can also be achieved with some $\gamma ^ { \prime \prime } < \gamma ^ { \prime }$ if we allow for partial collapse, i.e., $q _ { \phi ^ { * } } ( z _ { j } | \pmb { x } ) = p ( z _ { j } )$ along some but not all latent dimensions $j \in \{ 1 , \ldots , \kappa \}$ . Overall, the analysis loosely suggests that the number of dimensions vulnerable to exact collapse will increase monotonically with $\gamma$ .
146
+
147
+ Proposition 5.1 also provides evidence that the VAE behaves like a strict thresholding operator, completely shutting off latent dimensions using a finite value for $\gamma$ . This is analogous to the distinction between using the $\ell _ { 1 }$ versus $\ell _ { 2 }$ norm for solving regularized regression problems of the standard form $\mathrm { m i n } _ { \pmb { u } } \| \bar { \mathbf { x } } - \pmb { A } \pmb { u } \| _ { 2 } ^ { 2 } + \gamma \eta ( \pmb { u } )$ , where $\pmb { A }$ is a design matrix and $\eta$ is a penalty function. When $\eta$ is the $\ell _ { 1 }$ norm, some or all elements of $\textbf { \em u }$ can be pruned to exactly zero with a sufficiently large but finite $\gamma$ Zhao & Yu (2006). In contrast, when the $\ell _ { 2 }$ norm is applied, the coefficients will be shrunk to smaller values but never pushed all the way to zero unless $\gamma \to \infty$ .
148
+
149
+ # 5.2 PRACTICAL IMPLICATIONS
150
+
151
+ In aggregate then, if the AE base model displays unavoidably high reconstruction errors, this implicitly constrains the corresponding VAE model to have a large optimal $\gamma$ value, which can potentially lead to undesirable posterior collapse per Proposition 5.1. In Section 6 we will demonstrate empirically that training unregularized AE models can become increasingly difficult and prone to bad local minima (or at least bad stable stationary points) as the depth increases; and this difficulty can persist even with counter-measures such as skip connections. Therefore, from this vantage point we would argue that it is the AE base architecture that is effectively the guilty party when it comes to category (v) posterior collapse.
152
+
153
+ The perspective described above also helps to explain why heuristics like KL warm-start are not always useful for improving VAE performance. With the standard Gaussian model (4) considered herein, KL warm-start amounts to adopting a pre-defined schedule for incrementally increasing $\gamma$ starting from a small initial value, the motivation being that a small $\gamma$ will steer optimization trajectories away from overregularized solutions and posterior collapse.
154
+
155
+ However, regardless of how arbitrarily small $\gamma$ may be fixed at any point during this process, the VAE reconstructions are not likely to be better than the analogous deterministic AE (which is roughly equivalent to forcing $\gamma = 0$ within the present context). This implies that there can exist an implicit $\gamma ^ { * }$ as computed by (10) that can be significantly larger such that, even if KL warm-start is used, the optimization trajectory may well lead to a collapsed posterior stationary point that has this $\gamma ^ { * }$ as the optimal value in terms of minimizing the VAE cost with other parameters fixed. Note that if full posterior collapse does occur, the gradient from the KL term will equal zero and hence, to be at a stationary point it must be that the data term gradient is also zero. In such situations, varying $\gamma$ manually will not impact the gradient balance anyway.
156
+
157
+ # 6 EMPIRICAL ASSESSMENTS
158
+
159
+ In this section we empirically demonstrate the existence of bad AE local minima with high reconstruction errors at increasing depth, as well as the association between these bad minima and imminent VAE posterior collapse. For this purpose, we first train fully connected AE and VAE models with 1, 2, 4, 6, 8 and 10 hidden layers on the Fashion-MNIST dataset (Xiao et al., 2017). Each hidden layer is 512-dimensional and followed by ReLU activations (see Appendix A.1 for further details). The reconstruction error is shown in Figure 1(left). As the depth of the network increases, the reconstruction error of the AE model first decreases because of the increased capacity. However, when the network becomes too deep, the error starts to increase, indicating convergence to a bad local minima (or at least stable stationary point/plateau) that is unrelated to KL-divergence regularization. The reconstruction error of a VAE model is always worse than that of the corresponding AE model as expected. Moreover, while KL warm-start/annealing can help to improve the VAE reconstructions to some extent, performance is still worse than the AE as expected.
160
+
161
+ ![](images/53c6a921f2f87592d004f4cadf6080fc89f3a0e22621768b64fd5093b47cd345.jpg)
162
+ Figure 1: Reconstruction errors for various encoder/decoder models of varying complexity. Left: Fully connected networks with different depths trained on Fashion-MNIST. Middle: Convolution networks with increasing depth/# of spatial scales trained on Cifar100. Right: Averaged AE results from residual networks with varying number of residual blocks and block depth trained on SVHN, Cifar10, Cifar100 and CelebA. In all plots, once the encoder/decoder complexity is sufficiently high, the reconstruction errors begin to increase.
163
+
164
+ We next train AE and VAE models using a more complex convolutional network on Cifar100 data (Krizhevsky & Hinton, 2009). At each spatial scale, we use 1 to 5 convolution layers followed by ReLU activations. We also apply $2 \times 2$ max pooling to downsample the feature maps to a smaller spatial scale in the encoder and use a transposed convolution layer to upscale the feature map in the decoder. The reconstruction errors are shown in Figure 1(middle). Again, the trend is similar to the fully-connected network results. See Appendix A.1 for an additional ImageNet example.
165
+
166
+ It has been argued in the past that skip connections can increase the mutual information between observations $\pmb { x } ^ { ( i ) }$ and the inferred latent variables $_ z$ (Dieng et al., 2018), reducing the risk of posterior collapse. And it is well-known that ResNet architectures based on skip connections can improve performance on numerous recognition tasks (He et al., 2016). To this end, we train a number of AE models using ResNet-inspired encoder/decoder architectures on multiple datasets including Cifar10, Cifar100, SVHN and CelebA. Similar to the convolution network structure from above, we use 1, 2, and 4 residual blocks within each spatial scale. Inside each block, we apply 2 to 5 convolution layers. For aggregate comparison purposes, we normalize the reconstruction error obtained on each dataset by dividing it with the corresponding error produced by the most shallow network structure (1 residual block with 2 convolution layers). We then average the normalized reconstruction errors over all four datasets. The average normalized errors are shown in Figure $1 ( r i g h t )$ , where we observe that adding more convolution layers inside each residual block can increase the reconstruction error when the network is too deep. Moreover, adding more residual blocks can also lead to higher reconstruction errors. And empirical results obtained using different datasets and networks architectures, beyond the conditions of Figure 1, also show a general trend of increased reconstruction error once the effective depth is sufficiently deep.
167
+
168
+ We emphasize that in all these models, as the network complexity/depth increases, the simpler models are always contained within the capacity of the larger ones. Therefore, because the reconstruction error on the training data is becoming worse, it must be the case that the AE is becoming stuck at bad local minima or plateaus. Again since the AE reconstruction error serves as a probable lower bound for that of the VAE model, a deeper VAE model will likely suffer the same problem, only exacerbated by the KL-divergence term in the form of posterior collapse. This implies that there will be more $\pmb { \sigma } _ { z }$ values moving closer to 1 as the VAE model becomes deeper; similarly $\pmb { \mu } _ { z }$ values will push towards 0. The corresponding dimensions will encode no information and become completely useless.
169
+
170
+ ![](images/8c74295589cd8d90b17cac95ca4b9a5f31e8504b71dc6b4daec56af0549477ad.jpg)
171
+ Figure 2: Histogram of $\pmb { \sigma } _ { z }$ values as VAE encoder/decoder network depth is varied. There are 2, 4 and 5 convolution layers in each spatial scale from left to right. As depth increases, the reconstruction error grows and more $\pmb { \sigma } _ { z }$ values are near 1, indicative of impending posterior collapse.
172
+
173
+ To help corroborate this association between bad AE local minima and VAE posterior collapse, we plot histograms of VAE $\pmb { \sigma } _ { z }$ values as network depth is varied in Figure 2. The models are trained on CelebA and the number of convolution layers in each spatial scale is 2, 4 and 5 from left to right. As the depth increases, the reconstruction error becomes larger and there are more $\pmb { \sigma } _ { z }$ near 1.
174
+
175
+ # 7 DISCUSSION
176
+
177
+ In this work we have emphasized the previously-underappreciated role of bad local minima in trapping VAE models at posterior collapsed solutions. Unlike affine decoder models whereby all local minima are provably global, Proposition 4.1 stipulates that even infinitesimal nonlinear perturbations can introduce suboptimal local minima characterized by deleterious posterior collapse. Furthermore, we have demonstrated that the risk of converging to such a suboptimal minima increases with decoder depth. In particular, we outline the following practically-likely pathway to posterior collapse:
178
+
179
+ 1. Deeper AE architectures are essential for modeling high-fidelity images or similar, and yet counter-intuitively, increasing AE depth can actually produce larger reconstruction errors on the training data because of bad local minima (with or without skip connections). An analogous VAE model with the same architecture will likely produce even worse reconstructions because of the additional KL regularization term, which is not designed to steer optimization trajectories away from poor reconstructions.
180
+ 2. At any such bad local minima, the value of $\gamma$ will necessarily be large, i.e., if it is not large, we cannot be at a local minimum.
181
+ 3. But because of the thresholding behavior of the VAE as quantified by Proposition 5.1, as $\gamma$ becomes larger there is an increased risk of exact posterior collapse along excessive latent dimensions. And complete collapse along all dimensions will occur for some finite $\gamma$ sufficiently large. Furthermore, explicitly forcing $\gamma$ to be small does not fix this problem, since in some sense the implicit $\gamma ^ { * }$ is still large as discussed in Section 5.2.
182
+
183
+ While we believe that this message is interesting in and of itself, there are nonetheless several practically-relevant implications. For example, complex hierarchical VAEs like BIVA notwithstanding, skip connections and KL warm-start have modest ability to steer optimization trajectories towards good solutions; however, this underappreciated limitation will not generally manifest until networks are sufficiently deep as we have considered. Fortunately, any advances or insights gleaned from developing deeper unregularized AEs, e.g., better AE architectures, training procedures, or initializations (Li & Nguyen, 2019), could likely be adapted to reduce the risk of posterior collapse in corresponding VAE models.
184
+
185
+ In closing, we should also mention that, although this work has focused on Gaussian VAE models, many of the insights translate into broader non-Gaussian regimes. For example, a variety of recent VAE enhancements involve replacing the fixed Gaussian latent-space prior $p ( z )$ with a parameterized non-Gaussian alternative (Bauer & Mnih, 2019; Tomczak & Welling, 2018). This type of modification provides greater flexibility in modeling the aggregated posterior in the latent space, which is useful for generating better samples (Makhzani et al., 2016). However, it does not immunize VAEs against the bad local minima introduced by deep decoders, and good reconstructions are required by models using Gaussian or non-Gaussian priors alike. Therefore, our analysis herein still applies in much the same way.
186
+
187
+ # REFERENCES
188
+
189
+ A. Alemi, B. Poole, I. Fischer, J. Dillon, R. Saurous, and K. Murphy. Fixing a broken ELBO. arXiv preprint arXiv:1711.00464, 2017.
190
+ M. Bauer and A. Mnih. Resampled priors for variational autoencoders. arXiv preprint arXiv:1810.11428, 2018.
191
+ M. Bauer and A. Mnih. Resampled priors for variational autoencoders. International Conference on Artificial Intelligence and Statistics, 2019.
192
+ S. Bowman, L. Vilnis, O. Vinyals, A. Dai, R. Jozefowicz, and S. Bengio. Generating sentences from a continuous space. arXiv preprint arXiv:1511.06349, 2015.
193
+ Y. Burda, R. Grosse, and R. Salakhutdinov. Importance weighted autoencoders. arXiv preprint arXiv:1509.00519, 2015.
194
+ L. Cai, H. Gao, and S. Ji. Multi-stage variational auto-encoders for coarse-to-fine image generation. arXiv preprint arXiv:1705.07202, 2017.
195
+ E. Candes, X. Li, Y. Ma, and J. Wright. Robust principal component analysis? \` J. ACM, 58(2), 2011.
196
+ X. Chen, D. Kingma, T. Salimans, Y. Duan, P. Dhariwal, J. Schulman, I. Sutskever, and P. Abbeel. Variational lossy autoencoder. arXiv preprint arXiv:1611.02731, 2016.
197
+ B. Dai and D. Wipf. Diagnosing and enhancing VAE models. International Conference on Learning Representations, 2019.
198
+ B. Dai, Y. Wang, J. Aston, G. Hua, and D. Wipf. Hidden talents of the variational autoencoder. arXiv preprint arXiv:1706.05148, 2019.
199
+ A. Dieng, Y. Kim, A. Rush, and D. Blei. Avoiding latent variable collapse with generative skip models. arXiv preprint arXiv:1807.04863, 2018.
200
+ K. Gregor and Y. LeCun. Learning fast approximations of sparse coding. International Conference on Machine Learning, 2010.
201
+ J. He, D. Spokoyny, G. Neubig, and T. Berg-Kirkpatrick. Lagging inference networks and posterior collapse in variational autoencoders. International Conference on Learning Representations, 2019.
202
+ K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. CVPR, 2016.
203
+ I. Higgins, L. Matthey, A. Pal, C. Burgess, 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.
204
+ C. Huang, S. Tan, A. Lacoste, and A. Courville. Improving explorability in variational inference with annealed variational objectives. Advances in Neural Information Processing Systems, 2018.
205
+ K. Kawaguchi. Deep learning without poor local minima. Advances in Neural Information Processing Systems, 2016.
206
+ D. Kingma and M. Welling. Auto-encoding variational Bayes. International Conference on Learning Representations, 2014.
207
+ A. Krizhevsky and G. Hinton. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
208
+ P. Li and P.M. Nguyen. On random deep weight-tied autoencoders: Exact asymptotic analysis, phase transitions, and implications to training. International Conference on Learning Representations, 2019.
209
+ J. Lucas, G. Tucker, R. Grosse, and M. Norouzi. Understanding posterior collapse in generative latent variable models. International Conference on Learning Representations, Workshop Paper, 2019.
210
+ L. Maaløe, M. Fraccaro, V. Lievin, and O. Winther. BIVA: A very deep hierarchy of latent variables ´ for generative modeling. arXiv preprint arXiv:1902.02102, 2019.
211
+ A. Makhzani, J. Shlens, N. Jaitly, I. Goodfellow, and B. Frey. Adversarial autoencoders. arXiv preprint arXiv:1511.05644, 2016.
212
+ P.A. Mattei and J. Frellsen. Leveraging the exact likelihood of deep latent variable models. Advances in Neural Information Processing Systems, 2018.
213
+ E. Orjebin. A recursive formula for the moments of a truncated univariate normal distribution. 2014. URL https://people.smp.uq.edu.au/YoniNazarathy/teaching_ projects/studentWork/EricOrjebin_TruncatedNormalMoments.pdf.
214
+ A. Razavi, A. Oord, B. Poole, and O. Vinyals. Preventing posterior collapse with $\delta$ -VAEs. International Conference on Learning Representations, 2019.
215
+ D. Rezende and S. Mohamed. Variational inference with normalizing flows. arXiv preprint arXiv:1505.05770, 2015.
216
+ D. Rezende, S. Mohamed, and D. Wierstra. Stochastic backpropagation and approximate inference in deep generative models. International Conference on Machine Learning, 2014.
217
+ M. Rolinek, D. Zietlow, and G. Martius. Variational autoencoders pursue PCA directions (by accident). 2019.
218
+ C. Sønderby, T. Raiko, L. Maaløe, S. Sønderby, and O. Winther. How to train deep variational autoencoders and probabilistic ladder networks. arXiv preprint arXiv:1602.02282, 2016.
219
+ P. Sprechmann, A.M. Bronstein, and G. Sapiro. Learning efficient sparse and low rank models. IEEE Trans. Pattern Analysis and Machine Intelligence, 37(9), 2015.
220
+ M. Tipping and C. Bishop. Probabilistic principal component analysis. J. Royal Statistical Society, Series B, 61(3):611–622, 1999.
221
+ J. Tomczak and M. Welling. VAE with a VampPrior. International Conference on Artificial Intelligence and Statistics, 2018.
222
+ A. Van den Oord, N. Kalchbrenner, L. Espeholt, O. Vinyals, A. Graves, and K. Kavukcuoglu. Conditional image generation with PixelCNN decoders. Advances in Neural Information Processing Systems, 2016.
223
+ Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms. arXiv preprint arXiv:1708.07747, 2017.
224
+ S. Yeung, A. Kannan, Y. Dauphin, and L. Fei-Fei. Tackling over-pruning in variational autoencoders. arXiv preprint arXiv:1706.03643, 2017.
225
+ C. Yun, S. Sra, and A. Jadbabaie. Small nonlinearities in activation functions create bad local minima in neural networks. International Conference on Learning Representations, 2019.
226
+ P. Zhao and B. Yu. On model selection consistency of Lasso. Journal of Machine learning research, 7:2541–2563, 2006.
227
+
228
+ # A APPENDIX
229
+
230
+ A.1 NETWORK STRUCTURE, EXPERIMENTAL SETTINGS, AND ADDITIONAL IMAGENET RESULTS
231
+
232
+ Three different kinds of network structures are used in the experiments: fully connected networks, convolution networks, and residual networks. For all these structures, we set the dimension of the latent variable $_ z$ to 64. We then describe the network details accordingly.
233
+
234
+ Fully Connected Netowrk: This experiment is only applied on the simple Fashion-MNIST dataset, which contains $6 0 0 0 0 \ 2 8 \times 2 8$ black-and-while images. These images are first flattened to a 784 dimensional vector. Both the encoder and decoder have multiple number of 512-dimensional hidden layers, each followed by ReLU activations.
235
+
236
+ Convolution Netowrk: The original images are either $3 2 \times 3 2 \times 3$ (Cifar10, Cifar100 and SVHN) or $6 4 \times 6 4 \times 3$ (CelebA and ImageNet). In the encoder, we use a multiple number (denoted as $t$ ) of $3 \times 3$ convolution layers for each spatial scale. Each convolution layer is followed by a ReLU activation. Then we use a $2 \times 2$ max pooling to downsample the feature map to a smaller spatial scale. The number of channels is doubled when the spatial scale is halved. We use 64 channels when the spatial scale is $3 2 \times 3 2$ . When the spatial scale reaches $4 \times 4$ (there should be 512 channels in this feature map), we use an average pooling to transform the feature map to a vector, which is then transformed into the latent variable using a fully connected layer. In the decoder, the latent variable is first transformed to a 4096-dimensional vector using a fully connected layer and then reshaped to $2 \times 2 \times 1 0 2 4$ . Again in each spatial scale, we use 1 transpose convolution layer to upscale the feature map and halve the number of channels followed by $t - 1$ convolution layers. Each convolution and transpose convolution layer is followed by a ReLU activation layer. When the spatial scale reaches that of the original image, we use a convolution layer to transofrm the feature map to 3 channels.
237
+
238
+ Residual Network: The network structure of the residual network is similar to that of a convolution network described above. We simply replace the convolution layer with a residual block. Inside the residual block, we use different numbers of convolution numbers. (The typical number of convolution layers inside a residual block is 2 or 3. In our experiments, we try 2, 3, 4 and 5.)
239
+
240
+ Training Details: All the experiments with different network structures and datasets are trained in the same procedure. We use the Adam optimization method and the default optimizer hyper parameters in Tensorflow. The batch size is 64 and we train the model for $2 5 0 K$ iterations. The initial learning rate is 0.0002 and it is halved every $1 0 0 K$ iterations.
241
+
242
+ Additional Results on ImageNet: We also show the reconstruction error for convolution networks with increasing depth trained on ImageNet in Figure 3. The trend is the same as that in Figure 1.
243
+
244
+ ![](images/67443b28d7a82d0093386988e578ae3b9167936b8963860d483103d80d524074.jpg)
245
+ Figure 3: Reconstruction error for Convolution networks with increasing depth/# of spatial scales trained on ImageNet.
246
+
247
+ # A.2 PROOF OF PROPOSITION 4.1
248
+
249
+ While the following analysis could in principle be extended to more complex datasets, for our purposes it is sufficient to consider the following simplified case for ease of exposition. Specifically, we assume that $n > 1 , d > \kappa$ , set $d = 2 , n = 2 , \kappa = 1$ , and $\pmb { x } ^ { ( 1 ) } = ( 1 , 1 ) , \pmb { x } ^ { ( 2 ) } = ( - 1 , - \bar { 1 } )$ .
250
+
251
+ Additionally, we will use the following basic facts about the Gaussian tail. Note that (12)-(13) below follow from integration by parts; see Orjebin (2014).
252
+
253
+ Lemma A.1 Let $\epsilon \sim \mathcal { N } ( 0 , 1 ) , A > 0$ ; $\phi ( { \boldsymbol { x } } ) , \Phi ( { \boldsymbol { x } } )$ be the pdf and cdf of the standard normal distribution, respectively. Then
254
+
255
+ $$
256
+ \begin{array} { r l } & { ~ 1 - \Phi ( A ) \le e ^ { - A ^ { 2 } / 2 } , } \\ & { ~ \mathbb { E } [ \epsilon \mathbf { 1 } _ { \{ \epsilon > A \} } ] = \phi ( A ) , } \\ & { \mathbb { E } [ \epsilon ^ { 2 } \mathbf { 1 } _ { \{ \epsilon > A \} } ] = 1 - \Phi ( A ) + A \phi ( A ) . } \end{array}
257
+ $$
258
+
259
+ # A.2.1 SUBOPTIMALITY OF (7)
260
+
261
+ Under the specificed conditions, the energy from (7) has a value of $^ { n d }$ . Thus to show that it is not the global minimum, it suffices to show that the following VAE, parameterized by $\delta$ , has energy $\to - \infty$ as $\delta 0$ :
262
+
263
+ $$
264
+ \begin{array} { r l } & { \mu _ { z } ^ { ( 1 ) } = 1 , \mu _ { z } ^ { ( 2 ) } = - 1 , } \\ & { W _ { x } = ( \alpha + 1 , \alpha + 1 ) , b _ { x } = 0 , } \\ & { \sigma _ { z } ^ { ( 1 ) } = \sigma _ { z } ^ { ( 2 ) } = \delta , } \\ & { \gamma = \mathbb { E } _ { \mathcal { N } ( \varepsilon \mid 0 , 1 ) } 2 ( 1 - \pi _ { \alpha } ( ( \alpha + 1 ) ( 1 + \delta \varepsilon ) ) ) ^ { 2 } . } \end{array}
265
+ $$
266
+
267
+ This follows because, given the stated parameters, we have that
268
+
269
+ $$
270
+ \begin{array} { l } { \displaystyle \mathcal { L } ( \theta , \phi ) = \sum _ { i = 1 } ^ { 2 } ( 1 + 2 \log \mathbb { E } _ { \mathcal { N } ( \varepsilon \mid 0 , 1 ) } 2 ( 1 - \pi _ { \alpha } ( ( \alpha + 1 ) ( 1 + \delta \varepsilon ) ) ) ^ { 2 } - 2 \log \delta + \delta ^ { 2 } + 1 ) } \\ { \displaystyle \qquad = \sum _ { i = 1 } ^ { 2 } ( \Theta ( 1 ) + 2 \log \mathbb { E } _ { \mathcal { N } ( \varepsilon \mid 0 , 1 ) } ( 1 - \pi _ { \alpha } ( \alpha + 1 + ( \alpha + 1 ) \delta \varepsilon ) ) ^ { 2 } - 2 \log \delta ) } \\ { \displaystyle \qquad \leq ^ { ( i ) } 4 \log \delta + \Theta ( 1 ) . } \end{array}
271
+ $$
272
+
273
+ (i) holds when $\begin{array} { r } { \delta < \frac { 1 } { \alpha + 1 } } \end{array}$ ; to see this, denote $x : = \alpha + 1 + ( \alpha + 1 ) ( \delta \varepsilon )$ . Then
274
+
275
+ $$
276
+ \begin{array} { r l } & { \mathbb E _ { \mathcal N ( \varepsilon | 0 , 1 ) } ( 1 - \pi _ { \alpha } ( x ) ) ^ { 2 } } \\ & { = \mathbb E _ { \varepsilon } [ ( 1 - \pi _ { \alpha } ( x ) ) ^ { 2 } \mathbf 1 _ { \{ x \geq \alpha \} } ] + \mathbb E _ { \varepsilon } [ ( 1 - \pi _ { \alpha } ( x ) ) ^ { 2 } \mathbf 1 _ { \{ | x | < \alpha \} } ] + \mathbb E _ { \varepsilon } [ ( 1 - \pi _ { \alpha } ( x ) ) ^ { 2 } \mathbf 1 _ { \{ x < - \alpha \} } ] } \\ & { \leq \underbrace { \mathbb E _ { \varepsilon } [ ( 1 - ( x - \alpha ) ) ^ { 2 } ] } _ { ( a ) } + \underbrace { \mathbb P ( | x | < \alpha ) } _ { ( b ) } + \underbrace { \mathbb E _ { \varepsilon } ( ( 1 - x - \alpha ) ^ { 2 } \mathbf 1 _ { \{ x < - \alpha \} } ) } _ { ( c ) } . } \end{array}
277
+ $$
278
+
279
+ In the RHS above $( a ) = [ ( \alpha + 1 ) \delta ] ^ { 2 }$ ; using (11)-(13) we then have
280
+
281
+ $$
282
+ \begin{array} { r l } & { ( b ) < \mathbb { P } ( x < \alpha ) = \mathbb { P } \left( \varepsilon < \frac { - 1 } { ( \alpha + 1 ) \delta } \right) \leq \exp \left( - \frac { 1 } { 2 [ ( \alpha + 1 ) \delta ] ^ { 2 } } \right) . } \\ & { ( c ) < \mathbb { E } _ { \varepsilon } ( ( 2 \alpha + ( \alpha + 1 ) \delta \varepsilon ) ^ { 2 } { \mathbf 1 } _ { \{ x < \alpha \} } ) } \\ & { \quad = \int _ { - \infty } ^ { \frac { - 1 } { ( \alpha + 1 ) \delta } } ( 2 \alpha + ( \alpha + 1 ) \delta \varepsilon ) ^ { 2 } \frac { 1 } { \sqrt { 2 \pi } } e ^ { - c ^ { 2 } / 2 } d \varepsilon } \\ & { \quad < \int _ { - \infty } ^ { \frac { - 1 } { ( \alpha + 1 ) \delta } } ( 4 \alpha ^ { 2 } + [ ( \alpha + 1 ) \delta \varepsilon ] ^ { 2 } ) \frac { 1 } { \sqrt { 2 \pi } } e ^ { - c ^ { 2 } / 2 } d \varepsilon } \\ & { \quad < \left\{ 4 \alpha ^ { 2 } + ( ( \alpha + 1 ) \delta ) ^ { 2 } \left[ 1 + \frac { 1 } { \sqrt { 2 \pi } } \right] \right\} \exp \left( - \frac { 1 } { 2 [ ( \alpha + 1 ) \delta ] ^ { 2 } } \right) } \end{array}
283
+ $$
284
+
285
+ $\begin{array} { r } { \delta < \frac { 1 } { \alpha + 1 } } \end{array}$
286
+
287
+ $$
288
+ \operatorname* { l i m } _ { \delta \to 0 } \frac { \mathbb { E } _ { \mathcal { N } ( \varepsilon \mid 0 , 1 ) } ( 1 - \pi _ { \alpha } ( x ) ) ^ { 2 } } { [ ( \alpha + 1 ) \delta ] ^ { 2 } } = 1 ,
289
+ $$
290
+
291
+ and
292
+
293
+ $$
294
+ \operatorname* { l i m } _ { \delta \to 0 } \{ \log \mathbb { E } _ { \mathcal { N } ( \varepsilon | 0 , 1 ) } ( 1 - \pi _ { \alpha } ( x ) ) ^ { 2 } - 2 \log \delta \} = 2 \log ( \alpha + 1 ) ,
295
+ $$
296
+
297
+ or
298
+
299
+ $$
300
+ 2 \log \mathbb { E } _ { \epsilon } ( 1 - \pi _ { \alpha } ( x ) ) ^ { 2 } = 4 \log \delta + \Theta ( 1 ) ,
301
+ $$
302
+
303
+ and we can see (i) holds.
304
+
305
+ # A.2.2 LOCAL OPTIMALITY OF (7)
306
+
307
+ We will now show that at (7), the Hessian of the energy has structure
308
+
309
+ $$
310
+ \begin{array} { c c c c c c } { { } } & { { ( W _ { x } ) } } & { { ( b _ { x } ) } } & { { ( \sigma _ { z } ^ { ( i ) } , \mu _ { z } ^ { ( i ) } ) } } & { { ( \gamma ) } } \\ { { ( W _ { x } ) } } & { { 0 } } & { { 0 } } & { { 0 } } & { { 0 } } \\ { { ( b _ { x } ) } } & { { 0 } } & { { \frac { 2 } { \gamma } I } } & { { 0 } } & { { 0 } } \\ { { ( \sigma _ { z } ^ { ( i ) } , \mu _ { z } ^ { ( i ) } ) } } & { { 0 } } & { { 0 } } & { { ( p . d . ) } } & { { 0 } } \\ { { ( \gamma ) } } & { { 0 } } & { { 0 } } & { { 0 } } & { { ( p . d . ) } } \end{array}
311
+ $$
312
+
313
+ where p.d. means the corresponding submatrix is positive definite and independent of other parameters. While the Hessian is 0 in the subspace of $W _ { x }$ , we can show that for VAEs that are only different from (7) by $W _ { x }$ , the gradient always points back to (7). Thus (7) is a strict local minima.
314
+
315
+ First we compute the Hessian matrix block-wise. We will identify $W _ { x } \in \mathbb R ^ { 2 \times 1 }$ with the vector $( W _ { j } ) _ { j = 1 } ^ { 2 }$ , and use the shorthand notations $\pmb { x } ^ { ( i ) } = ( x _ { j } ^ { ( i ) } ) _ { j = 1 } ^ { 2 }$ , $b _ { x } = ( b _ { j } ) _ { j = 1 } ^ { 2 }$ , $z ^ { ( i ) } = \mu _ { z } ^ { ( i ) } + \sigma _ { z } ^ { ( i ) } \varepsilon$ , where $\varepsilon \sim \mathcal { N } ( 0 , 1 )$ (recall that $z ^ { ( i ) }$ is a scalar in this proof).
316
+
317
+ 1. The second-order derivatives involving $W _ { x }$ can be expressed as
318
+
319
+ $$
320
+ \frac { \partial \mathcal { L } } { \partial W _ { j } } = \frac { - 2 } { \gamma } \sum _ { i = 1 } ^ { n } \mathbb { E } _ { \varepsilon } [ ( \pi _ { \alpha } ^ { \prime } ( W _ { j } z ^ { ( i ) } ) z ^ { ( i ) } ) \cdot ( x _ { j } ^ { ( i ) } - \pi _ { \alpha } ( W _ { j } z ^ { ( i ) } ) - b _ { j } ) ] ,
321
+ $$
322
+
323
+ and therefore all second-order derivatives involving $W _ { j }$ will have the form
324
+
325
+ $$
326
+ \mathbb { E } _ { \epsilon } [ \pi _ { \alpha } ^ { \prime } ( W _ { j } z ^ { ( i ) } ) F _ { 1 } + \pi _ { \alpha } ^ { \prime \prime } ( W _ { j } z ^ { ( i ) } ) F _ { 2 } ] ,
327
+ $$
328
+
329
+ where $F _ { 1 } , F _ { 2 }$ are some arbitrary functions that are finite at (7). Since $\pi _ { \alpha } ^ { \prime } ( 0 ) = \pi _ { \alpha } ^ { \prime \prime } ( 0 ) =$ $W _ { j } = 0$ , the above always evaluates to 0 at $W _ { x } = 0$ .
330
+
331
+ 2. For second-order derivatives involving $b _ { x }$ , we have
332
+
333
+ $$
334
+ \frac { \partial \mathcal { L } } { \partial b _ { x } } = \frac { - 2 } { \gamma } \mathbb { E } _ { \varepsilon } [ { \pmb x } ^ { ( i ) } - \pi _ { \alpha } ( { \pmb W } _ { x } z ^ { ( i ) } ) - b _ { x } ]
335
+ $$
336
+
337
+ and
338
+
339
+ $$
340
+ \begin{array} { r l } & { \displaystyle \frac { \partial ^ { 2 } \mathcal { L } } { \partial ( b _ { x } ) ^ { 2 } } = \frac { 2 } { \gamma } I , } \\ & { \displaystyle \frac { \partial ^ { 2 } \mathcal { L } } { \partial \gamma \partial b _ { x } } = \frac { 2 } { \gamma ^ { 2 } } \frac { \partial \mathcal { L } } { \partial b _ { x } } = 0 , \qquad ( \mathrm { s i n c e } \ W _ { x } = 0 ) ; } \end{array}
341
+ $$
342
+
343
+ and $\frac { \partial ^ { 2 } { \mathcal { L } } } { \partial \mu _ { z } ^ { ( i ) } \partial b _ { x } }$ and $\frac { \partial ^ { 2 } \mathcal { L } } { \partial \mu _ { z } ^ { ( i ) } \partial \sigma _ { z } ^ { ( i ) } }$ will also have the form of (15), thus both equal 0 at $W _ { x } = 0$ .
344
+
345
+ 3. Next consider second-order derivatives involving $\mu _ { z } ^ { ( i ) }$ or σ(ik Since the KL part of the energy, $\begin{array} { r l } { \sum _ { i = 1 } ^ { n } \mathrm { K L } ( q _ { \phi } ( \boldsymbol { z } | \boldsymbol { x } ^ { ( i ) } ) | p ( \boldsymbol { z } ) ) } & { { } } \end{array}$ , only depends on $\mu _ { z } ^ { ( i ) }$ and $\sigma _ { k } ^ { \left( i \right) }$ , and have p.d. Hessian at (7) independent of other parameters, it suffices to calculate the derivatives of the reconstruction error part, denoted as ${ \mathcal { L } } _ { \mathrm { r e c o n } }$ . Since
346
+
347
+ $$
348
+ \begin{array} { r l } & { \frac { \partial \mathcal { L } _ { \mathrm { r e c o n } } } { \partial \mu _ { z } ^ { ( i ) } } = \frac { - 2 } { \gamma } \displaystyle \sum _ { i , j } \mathbb { E } _ { \epsilon } \left[ ( x _ { j } ^ { ( i ) } - \pi _ { \alpha } ( W _ { j } z ^ { ( i ) } ) - b _ { j } ) W _ { j } \pi _ { \alpha } ^ { \prime } ( W _ { j } z ^ { ( i ) } ) \right] , } \\ & { \frac { \partial \mathcal { L } _ { \mathrm { r e c o n } } } { \partial \sigma _ { z } ^ { ( i ) } } = \frac { - 2 } { \gamma } \displaystyle \sum _ { i , j } \mathbb { E } _ { \epsilon } \left[ ( x _ { j } ^ { ( i ) } - \pi _ { \alpha } ( W _ { j } z ^ { ( i ) } ) - b _ { j } ) W _ { j } \epsilon \pi _ { \alpha } ^ { \prime } ( W _ { j } z ^ { ( i ) } ) \right] , } \end{array}
349
+ $$
350
+
351
+ all second-order derivatives will have the form of (15), and equal 0 at $W _ { x } = 0$ .
352
+
353
+ 4. For $\gamma$ , we can calculate that $\partial ^ { 2 } \mathcal { L } / \partial \gamma ^ { 2 } = 4 / \gamma ^ { 2 } > 0$ at (7).
354
+
355
+ Now, consider VAE parameters that are only different from (7) in $W _ { x }$ . Plugging ${ \pmb b } _ { x } = \bar { \pmb x } , { \pmb \mu } _ { z } ^ { ( i ) } =$ $0 , \sigma _ { k } ^ { \left( i \right) } = 1$ into (14), we have
356
+
357
+ $$
358
+ \frac { \partial \mathcal { L } } { \partial W _ { j } } = \frac { - 2 } { \gamma } \sum _ { i = 1 } ^ { n } \mathbb { E } _ { \varepsilon } [ ( \pi _ { \alpha } ^ { \prime } ( W _ { j } \varepsilon ) \varepsilon ) \cdot ( - \pi _ { \alpha } ( W _ { j } \varepsilon ) ) ] .
359
+ $$
360
+
361
+ As $( \pi _ { \alpha } ^ { \prime } ( W _ { j } \varepsilon ) \varepsilon ) \cdot ( - \pi _ { \alpha } ( W _ { j } \varepsilon ) ) \leq 0$ always holds, we can see that the gradient points back to (7).
362
+ This concludes our proof of (7) being a strict local minima.
363
+
364
+ # A.3 PROOF OF PROPOSITION 5.1
365
+
366
+ We begin by assuming an arbitrarily complex encoder for convenience. This allows us to remove the encoder-sponsored amortized inference and instead optimize independent parameters $\mu _ { z } ^ { ( i ) }$ and $\pmb { \sigma } _ { z } ^ { ( i ) }$ separately for each data point. Later we will show that this capacity assumption can be dropped and the main result still holds.
367
+
368
+ We next define
369
+
370
+ $$
371
+ m _ { z } \triangleq \left[ \left( \mu _ { z } ^ { ( 1 ) } \right) ^ { \top } , \ldots , \left( \mu _ { z } ^ { ( n ) } \right) ^ { \top } \right] ^ { \top } \in \mathbb { R } ^ { \kappa n } \mathrm { a n d } s _ { z } \triangleq \left[ \left( \sigma _ { z } ^ { ( 1 ) } \right) ^ { \top } , \ldots , \left( \sigma _ { z } ^ { ( n ) } \right) ^ { \top } \right] ^ { \top } \in \mathbb { R } ^ { \kappa n } ,
372
+ $$
373
+
374
+ which are nothing more than the concatenation of all of the decoder means and variances from each data point into the respective column vectors. It is also useful to decompose the assumed non-degenerate decoder parameters via
375
+
376
+ $$
377
+ \theta \equiv \left[ \psi , w \right] , \psi \triangleq \theta \backslash w ,
378
+ $$
379
+
380
+ where $w \in [ 0 , 1 ]$ is a scalar such that $\mu _ { x } \left( z ; \theta \right) \equiv \mu _ { x } \left( w z ; \psi \right)$ . Note that we can always reparameterize an existing deep architecture to extract such a latent scaling factor which we can then hypothetically optimize separately while holding the remaining parameters $\psi$ fixed. Finally, with slight abuse of notation, we may then define the function
381
+
382
+ $$
383
+ \begin{array} { r l r } { { f ( w \mathbf { m } _ { z } , w s _ { z } ) \triangleq } } & { ( 1 8 \operatorname { i n } _ { z } ( \sigma _ { z } ^ { ( i ) } , \sigma _ { z } ^ { ( i ) } , [ \tilde { \psi } , w ] , x ^ { ( i ) } ) ) \equiv \displaystyle \sum _ { i = 1 } ^ { n } \mathbb { E } _ { N ( z \mid \mu _ { z } ^ { ( i ) } , \mathrm { d i a g } [ \sigma _ { z } ^ { ( i ) } ] ^ { 2 } ) } [ \| x ^ { ( i ) } - \mu _ { x } ( w z ; \tilde { \psi } ) \| _ { 2 } ^ { 2 } ] . } \end{array}
384
+ $$
385
+
386
+ This is basically just the original function $f$ summed over all training points, with $\psi$ fixed at the corresponding values extracted from $\tilde { \theta }$ while $w$ serves as a free scaling parameter on the decoder.
387
+
388
+ Based on the assumption of Lipschitz continuous gradients, we can always create the upper bound
389
+
390
+ $$
391
+ \begin{array} { r l r } { f \left( \boldsymbol { u } , \boldsymbol { v } \right) } & { \leq } & { f \left( \tilde { \boldsymbol { u } } , \tilde { \boldsymbol { v } } \right) } \\ { + } & { \left( \boldsymbol { u } - \tilde { \boldsymbol { u } } \right) ^ { \top } \nabla _ { \boldsymbol { u } } f \left( \boldsymbol { u } , \boldsymbol { v } \right) | _ { \boldsymbol { u } = \tilde { \boldsymbol { u } } } + \frac { L } { 2 } \left. \boldsymbol { u } - \tilde { \boldsymbol { u } } \right. _ { 2 } ^ { 2 } + } & { \left( \boldsymbol { v } - \tilde { \boldsymbol { v } } \right) ^ { \top } \nabla _ { \boldsymbol { v } } f \left( \boldsymbol { u } , \boldsymbol { v } \right) | _ { \boldsymbol { v } = \tilde { \boldsymbol { v } } } + \frac { L } { 2 } \left. \boldsymbol { v } - \tilde { \boldsymbol { v } } \right. _ { 2 } ^ { 2 } } \end{array}
392
+ $$
393
+
394
+ where $L$ is the Lipschitz constant of the gradients and we have adopted $\mathbf { \Delta } _ { u } \triangleq w m _ { z }$ and $\mathbf { \Delta } _ { v } \triangleq w \pmb { \sigma } _ { z }$ to simplify notation. Equality occurs at the evaluation point $\{ { \pmb u } , { \pmb v } \} = \{ \tilde { { \pmb u } } , \tilde { { \pmb v } } \}$ . However, this bound does not account for the fact that we know $\nabla _ { v } f \left( u , v \right) \geq 0$ (i.e., $f \left( \pmb { u } , \pmb { v } \right)$ is increasing w.r.t. $\textbf { { v } }$ ) and that $v \geq 0$ . Given these assumptions, we can produce the refined upper bound
395
+
396
+ $$
397
+ f ^ { u b } \left( { \pmb u } , { \pmb v } \right) \ \geq \ f \left( { \pmb u } , { \pmb v } \right) ,
398
+ $$
399
+
400
+ where $f ^ { u b } \left( u , v \right)$ ,
401
+
402
+ $$
403
+ f \left( \tilde { \boldsymbol { u } } , \tilde { \boldsymbol { v } } \right) + \left( \boldsymbol { u } - \tilde { \boldsymbol { u } } \right) ^ { \top } \nabla _ { \boldsymbol { u } } f \left( \boldsymbol { u } , \boldsymbol { v } \right) \big | _ { \boldsymbol { u = \bar { u } } } + \frac { L } { 2 } \left\| \boldsymbol { u } - \tilde { \boldsymbol { u } } \right\| _ { 2 } ^ { 2 } + \sum _ { j = 1 } ^ { n d } g \left( v _ { j } , \tilde { v } _ { j } , \nabla _ { v _ { j } } f \left( \boldsymbol { u } , \boldsymbol { v } \right) \big | _ { v _ { j } = \tilde { v } _ { j } } \right)
404
+ $$
405
+
406
+ and the function $g : \mathbb { R } ^ { 3 } \mathbb { R }$ is defined as
407
+
408
+ $$
409
+ g \left( v , \tilde { v } , \delta \right) \triangleq \left\{ \begin{array} { c c } { \left( v - \tilde { v } \right) \delta + \frac { L } { 2 } \left( v - \tilde { v } \right) _ { 2 } ^ { 2 } } & { \mathrm { i f } v \geq \tilde { v } - \frac { \delta } { L } \mathrm { a n d } \{ v , \tilde { v } , \delta \} \geq 0 , } \\ { \frac { - \delta ^ { 2 } } { 2 L } } & { \mathrm { i f } v < \tilde { v } - \frac { \delta } { L } \mathrm { a n d } \{ v , \tilde { v } , \delta \} \geq 0 , } \\ { \infty } & { \mathrm { o t h e r w i s e } . } \end{array} \right.
410
+ $$
411
+
412
+ Given that
413
+
414
+ $$
415
+ \begin{array} { r } { \tilde { v } - \frac { \delta } { L } = \arg \operatorname* { m i n } _ { v } \left[ \left( v - \tilde { v } \right) \delta + \frac { L } { 2 } \left( v - \tilde { v } \right) _ { 2 } ^ { 2 } \right] \mathrm { a n d } \frac { - \delta ^ { 2 } } { 2 L } = \underset { v } { \operatorname* { m i n } } \left[ \left( v - \tilde { v } \right) \delta + \frac { L } { 2 } \left( v - \tilde { v } \right) _ { 2 } ^ { 2 } \right] , } \end{array}
416
+ $$
417
+
418
+ the function $g$ is basically just setting all values of $\begin{array} { r } { \left( v - \tilde { v } \right) \delta + \frac { L } { 2 } \left. v - \tilde { v } \right. _ { 2 } ^ { 2 } } \end{array}$ with negative slope to the minimum $\frac { - \delta ^ { 2 } } { 2 L }$ . This change is possible while retaining an upper bound because $f \left( \pmb { u } , \pmb { v } \right)$ is nondecreasing in $\textbf { { v } }$ by stated assumption. Additionally, $g$ is set to infinity for all $v \ < \ 0$ to enforce non-negatively.
419
+
420
+ While it may be possible to proceed further using $f ^ { u b }$ , we find it useful to consider a final modification. Specifically, we define the approximation
421
+
422
+ $$
423
+ f ^ { a p p r } \left( { \pmb u } , { \pmb v } \right) \ \approx \ f ^ { u b } \left( { \tilde { \pmb u } } , { \tilde { \pmb v } } \right) ,
424
+ $$
425
+
426
+ where $f ^ { a p p r } \left( \pmb { u } , \pmb { v } \right)$ ,
427
+
428
+ $$
429
+ \begin{array} { r } { ^ { \mathrm { { e } } } ( \tilde { \pmb { u } } , \tilde { \pmb { v } } ) \ + \ ( \pmb { u } - \tilde { \pmb { u } } ) ^ { \top } \ \nabla _ { \pmb { u } } f ( \pmb { u } , \pmb { v } ) | _ { \pmb { u = \tilde { u } } } \ + \ \frac { L } { 2 } \pmb { u } - \tilde { \pmb { u } } _ { 2 } ^ { 2 } + \displaystyle \sum _ { j = 1 } ^ { n d } g ^ { a p p r } ( v _ { j } , \tilde { v } _ { j } , \nabla _ { v _ { j } } f ( \pmb { u } , \pmb { v } ) | _ { v _ { j } = \tilde { v } _ { j } } ) } \end{array}
430
+ $$
431
+
432
+ and
433
+
434
+ $$
435
+ g ^ { a p p r } \left( v , \tilde { v } , \delta \right) \triangleq \left\{ \begin{array} { c c } { \frac { - \delta ^ { 2 } } { 2 L } + \frac { \delta ^ { 2 } } { 2 L \tilde { v } ^ { 2 } } v ^ { 2 } } & { \mathrm { i f ~ } \tilde { v } - \frac { \delta } { L } \geq 0 \mathrm { ~ a n d ~ } \left\{ v , \tilde { v } , \delta \right\} \geq 0 , } \\ { \left( \frac { L \tilde { v } ^ { 2 } } { 2 } - \delta \tilde { v } \right) + \left( \frac { \delta } { \tilde { v } } - \frac { L } { 2 } \right) v ^ { 2 } } & { \mathrm { i f ~ } \tilde { v } - \frac { \delta } { L } < 0 \mathrm { ~ a n d ~ } \left\{ v , \tilde { v } , \delta \right\} \geq 0 , } \\ { \infty } & { \mathrm { o t h e r w i s e } . } \end{array} \right.
436
+ $$
437
+
438
+ While slightly cumbersome to write out, $g ^ { a p p r }$ has a simple interpretation. By construction, we have that
439
+
440
+ $$
441
+ \displaystyle { \operatorname* { m i n } _ { v } g ^ { a p p r } \left( v , \tilde { v } , \delta \right) = g ^ { a p p r } \left( 0 , \tilde { v } , \delta \right) = \operatorname* { m i n } _ { v } g \left( v , \tilde { v } , \delta \right) = g \left( 0 , \tilde { v } , \delta \right) }
442
+ $$
443
+
444
+ and
445
+
446
+ $$
447
+ g ^ { a p p r } \left( \tilde { v } , \tilde { v } , \delta \right) = g \left( \tilde { v } , \tilde { v } , \delta \right) = 0 .
448
+ $$
449
+
450
+ At other points, $g ^ { a p p r }$ is just a simple quadratic interpolation but without any factor that is linear in $v$ . And removal of this linear term, while retaining (27) and (27) will be useful for the analysis that follows below. Note also that although $f ^ { a p p r } \left( \pmb { u } , \pmb { v } \right)$ is no longer a strict bound on $f \left( \pmb { u } , \pmb { v } \right)$ , it will nonetheless still be an upper bound whenever $v _ { j } \in \{ 0 , \tilde { v } _ { j } \}$ for all $j$ which will ultimately be sufficient for our purposes.
451
+
452
+ We now consider optimizing the function
453
+
454
+ $$
455
+ h ^ { a p p r } ( \boldsymbol { m } _ { z } , s _ { z } , w ) \triangleq \frac { 1 } { \gamma } f ^ { a p p r } \left( w \boldsymbol { m } _ { z } , w s _ { z } \right) + \sum _ { i = 1 } ^ { n } \left. \mu _ { z } ^ { ( i ) } \right. _ { 2 } ^ { 2 } + \left. \sigma _ { z } ^ { ( i ) } \right. _ { 2 } ^ { 2 } - \log \left. \mathrm { d i a g } \left[ \sigma _ { z } ^ { ( i ) } \right] ^ { 2 } \right. .
456
+ $$
457
+
458
+ If we define $\mathcal { L } \left( m _ { z } , s _ { z } , w \right)$ as the VAE cost from (4) under the current parameterization, then by design it follows that
459
+
460
+ $$
461
+ h ^ { a p p r } ( \tilde { m } _ { z } , \tilde { s } _ { z } , \tilde { w } ) = \mathcal { L } \left( \tilde { m } _ { z } , \tilde { s } _ { z } , \tilde { w } \right)
462
+ $$
463
+
464
+ and
465
+
466
+ $$
467
+ h ^ { a p p r } ( m _ { z } , s _ { z } , w ) \geq \mathcal { L } \left( m _ { z } , s _ { z } , w \right)
468
+ $$
469
+
470
+ whenever $w \sigma _ { j } \in \{ 0 , \tilde { w } \tilde { \sigma } _ { j } \}$ for all $j$ . Therefore if we find such a solution $\{ m _ { z } ^ { \prime } , s _ { z } ^ { \prime } , w ^ { \prime } \}$ that satisfies this condition and has $h ^ { \bar { a } \bar { p } \bar { p } r } ( m _ { z } ^ { \prime } , s _ { z } ^ { \prime } , w ^ { \prime } ) < h ^ { a p p r } ( \tilde { m } _ { z } , \tilde { s } _ { z } , \tilde { w } )$ , it necessitates that $\mathcal { L } ( \dot { m } _ { z } ^ { \prime } , s _ { z } ^ { \prime } , w ^ { \prime } ) <$ $\mathcal { L } ( \tilde { m } _ { z } , \tilde { s } _ { z } , \tilde { w } )$ as well. This then ensures that $\{ \tilde { m } _ { z } , \tilde { s } _ { z } , \tilde { w } \}$ cannot be a local minimum.
471
+
472
+ We now examine the function $h ^ { a p p r }$ more closely. After a few algebraic manipulations and excluding irrelevant constants, we have that
473
+
474
+ $$
475
+ \begin{array} { l } { { \displaystyle h ^ { a p p r } ( m _ { z } , s _ { z } , w ) \equiv } \ ~ } \\ { { \displaystyle ~ \sum _ { j = 1 } ^ { n d } \left\{ \frac { 1 } { \gamma } \left[ w m _ { z , j } \left. \nabla _ { u _ { j } } f \left( u , v \right) \right. _ { u _ { j } = \tilde { w } \tilde { m } _ { z , j } } + \frac { L } { 2 } \left( w ^ { 2 } m _ { z , j } ^ { 2 } - 2 w m _ { z , j } \tilde { w } \tilde { m } _ { z , j } \right) + c _ { j } w ^ { 2 } s _ { z , j } ^ { 2 } \right] \right. } } \\ { { \displaystyle ~ + \left. \ m _ { z , j } ^ { 2 } + s _ { z , j } ^ { 2 } - \log s _ { z , j } ^ { 2 } \right\} } , } \end{array}
476
+ $$
477
+
478
+ where $c _ { j }$ is the coefficient on the $v ^ { 2 }$ term from (26). After rearranging terms, optimizing out $m _ { z }$ and $\pmb { s } _ { z }$ , and discarding constants, we can then obtain (with slight abuse of notation) the reduced function
479
+
480
+ $$
481
+ h ^ { a p p r } ( w ) \triangleq \sum _ { j = 1 } ^ { n d } \frac { y _ { j } } { \gamma + \beta w ^ { 2 } } + \log ( \gamma + c _ { j } w ^ { 2 } ) ,
482
+ $$
483
+
484
+ where $\beta \ { \triangleq } \ { \frac { L } { 2 } }$ and $\begin{array} { r } { y _ { j } \triangleq \frac { L } { 2 } \| \tilde { w } \tilde { m } _ { z , j } - \frac { 1 } { L } \nabla _ { u _ { j } } f ( \pmb { u } , \pmb { v } ) _ { u _ { j } = \tilde { w } \tilde { m } _ { z , j } } \| _ { 2 } ^ { 2 } } \end{array}$ 2 . Note that $y _ { j }$ must be bounded since $L \neq 0 ^ { 4 }$ and $w \in [ 0 , 1 ]$ , $\nabla _ { u _ { j } } f \left( \pmb { u } , \pmb { v } \right) \big | _ { u _ { j } = \tilde { w } \tilde { m } _ { z , j } } \leq L$ , and $\tilde { m }$ are all bounded. The latter is implicitly bounded because the VAE KL term prevents infinite encoder mean functions. Furthermore, $c _ { j }$ must be strictly greater than zero per the definition of a non-degenerate decoder; this guarantees that
485
+
486
+ $$
487
+ \begin{array} { r } { g ^ { a p p r } \left( \tilde { w } \tilde { s } _ { j } , \tilde { w } \tilde { s } _ { j } , \nabla _ { v _ { j } } f \left( \pmb { u } , \pmb { v } \right) \big | _ { v _ { j } = \tilde { w } \tilde { s } _ { j } } \right) > g ^ { a p p r } \left( 0 , \tilde { w } \tilde { s } _ { j } , \nabla _ { v _ { j } } f \left( \pmb { u } , \pmb { v } \right) \big | _ { v _ { j } = \tilde { w } \tilde { s } _ { j } } \right) , } \end{array}
488
+ $$
489
+
490
+ which is only possible with $c _ { j } > 0$ . Proceeding further, because
491
+
492
+ $$
493
+ \nabla _ { w ^ { 2 } } h ^ { a p p r } ( w ) = \sum _ { j = 1 } ^ { n d } \left( \frac { - \beta y _ { j } } { \left( \gamma + \beta w ^ { 2 } \right) ^ { 2 } } + \frac { c _ { j } } { \gamma + c _ { j } w ^ { 2 } } \right) ,
494
+ $$
495
+
496
+ we observe that if $\gamma$ is increased sufficiently large, the first term will always be smaller than the second since $\beta$ and all $y _ { j }$ are bounded, and $c _ { j } > 0 \forall j$ . So there can never be a point whereby $\nabla _ { w ^ { 2 } } h ^ { a p p r } ( w ) = 0$ when $\mathbf { \boldsymbol { \gamma } } = \mathbf { \boldsymbol { \gamma } } ^ { \prime }$ sufficiently large. Therefore the minimum in this situation occurs on the boundary where $w ^ { 2 } = 0$ . And finally, if $\mathbf { \bar { \boldsymbol { w } } ^ { 2 } = 0 }$ , then the optimal $m _ { z }$ and $\pmb { s } _ { z }$ is determined solely by the KL term, and hence they are set according to the prior. Moreover, the decoder has no signal from the encoder and is therefore optimized by simply setting $\mu _ { x } \left( 0 ; \tilde { \psi } \right)$ to the mean $\bar { \mathbf { x } }$ for all $i$ .5 Additionally, none of this analysis requires and arbitrarily complex encoder; the exact same results hold as long as the encoder can output a 0 for means and 1 for the variances.
497
+
498
+ Note also that if we proceed through the above analysis using $\textbf { \textit { w } } \in \mathbb { R } ^ { \kappa }$ as parameterizing a separate $w _ { j }$ scaling factor for each latent dimension $j \in \{ 1 , \ldots , \kappa \}$ , then a smaller $\gamma$ value would generally force partial collapse. In other words, we could enforce nonzero gradients of $h ^ { a p p r } ( w )$ along the indices of each latent dimension separately. This loosely criteria would then lead to $q _ { \phi ^ { * } } ( \bar { z } _ { j } | \pmb { x } ) ~ = ~ p ( z _ { j } )$ along some but not all latent dimensions as stated in the main text below Proposition 5.1. 
499
+
500
+ # A.4 REPRESENTATIVE STATIONARY POINT EXHIBITING POSTERIOR COLLAPSE IN DEEPVAE MODELS
501
+
502
+ Here we provide an example of a stationary point that exhibits posterior collapse with an arbitrary deep encoder/decoder architecture. This example is representative of many other possible cases. Assume both encoder and decoder mean functions $\pmb { \mu } _ { x }$ and $\pmb { \mu } _ { z }$ , as well as the diagonal encoder covariance function $\Sigma _ { z } = \mathrm { d i a g } [ \sigma _ { z } ^ { 2 } ]$ , are computed by standard deep neural networks, with layers composed of linear weights followed by element-wise nonlinear activations (the decoder covariance satisfies $\Sigma _ { x } = \gamma I$ as before). We denote the weight matrix from the first layer of the decoder mean µxdenote W ρµz and W ρσ2z a , while w1µx,·j s weights from the last layers of the encoder networks producing refers to the corresponding $j$ -th column. Assuming $\rho$ layers, we $\pmb { \mu } _ { z }$ and $\log \sigma _ { z } ^ { 2 }$ respectively, with $j$ -th rows defined as $\pmb { w } _ { \mu _ { z } , j } ^ { \rho }$ · and wρσ2, . We then characterize the following key stationary point:
503
+
504
+ Proposition A.2 If $\pmb { w } _ { \mu _ { x } , \cdot j } ^ { 1 } = \left( \pmb { w } _ { \mu _ { z } , j . } ^ { \rho } \right) ^ { \top } = \left( \pmb { w } _ { \sigma _ { z } ^ { 2 } , j . } ^ { \rho } \right) ^ { \top } = \mathbf { 0 }$ for any $j \in \{ 1 , 2 , \dots , \kappa \}$ , then the gradients of (4) with respect to ${ \pmb w } _ { \mu _ { x } , \cdot j } ^ { 1 } , { \pmb w } _ { \mu _ { z } , j } ^ { \rho } .$ z, and $\pmb { w } _ { \sigma _ { z } ^ { 2 } , j } ^ { \rho }$ · are all equal to zero.
505
+
506
+ If the stated weights are zero along dimension $j$ , then obviously it must be that $q _ { \phi } ( z _ { j } | \pmb { x } ) = p ( z _ { j } )$ , i.e., a collapsed dimension for better or worse. The proof is straightforward; we provide the details below for completeness.
507
+
508
+ Proof: First we remind that the variational upper bound is defined in (2). We define $\mathcal { L } ( \boldsymbol { x } ; \boldsymbol { \theta } , \boldsymbol { \phi } )$ as the loss at a data point $_ { \textbf { \em x } }$ , i.e.
509
+
510
+ $$
511
+ \begin{array} { r } { \mathcal { L } ( { \pmb x } ; \theta , \phi ) = - \mathbb { E } _ { q _ { \phi } ( { \pmb z } | { \pmb x } ) } \left[ \log p _ { \theta } ( { \pmb x } | { \pmb z } ) \right] + \mathbb { K } \mathbb { L } \left[ q _ { \phi } ( { \pmb z } | { \pmb x } ) | | p ( { \pmb z } ) \right] . } \end{array}
512
+ $$
513
+
514
+ The total loss is the integration of $\mathcal { L } ( \boldsymbol { x } ; \boldsymbol { \theta } , \boldsymbol { \phi } )$ over $_ { \textbf { \em x } }$ . Further more, we denote $\mathcal { L } _ { k l } ( \pmb { x } ; \theta )$ and $\mathcal { L } _ { g e n } ( { \pmb x } ; \theta , \phi )$ as the KL loss and the generation loss at $_ { \textbf { \em x } }$ respectively, i.e.
515
+
516
+ $$
517
+ \begin{array} { r c l } { \mathcal { L } _ { k l } ( \pmb { x } ; \phi ) } & { = } & { \mathbb { K L } \left[ q _ { \phi } ( \pmb { z } | \pmb { x } ) | | p ( \pmb { z } ) \right] = \displaystyle \sum _ { i = 1 } ^ { \kappa } \mathbb { K L } \left[ q _ { \phi } ( z _ { j } | \pmb { x } ) | | p ( z _ { j } ) \right] , } \\ & { = } & { \displaystyle \frac { 1 } { 2 } \sum _ { j = 1 } ^ { \kappa } \left( \mu _ { z , j } ^ { 2 } + \sigma _ { z , j } ^ { 2 } - \log \sigma _ { z , j } ^ { 2 } - 1 \right) } \\ { \mathcal { L } _ { g e n } ( \pmb { x } ; \phi , \theta ) } & { = } & { \displaystyle - \mathbb { E } _ { q _ { \phi } ( \pmb { z } | \pmb { x } ) } \left[ \log p _ { \theta } ( \pmb { x } | \pmb { z } ) \right] . } \end{array}
518
+ $$
519
+
520
+ The second equality in (37) holds because the covariance of $q _ { \phi } ( \pmb { z } | \pmb { x } )$ and $p ( z )$ are both diagonal. The last encoder layer and the first decoder layer are denoted as $h _ { e } ^ { \rho }$ and $\boldsymbol { h } _ { d } ^ { 1 }$ . If $\pmb { w } _ { \mu _ { z } , j . } ^ { \rho } = 0 , \pmb { w } _ { \sigma _ { z } ^ { 2 } , j . } ^ { \rho } = 0$ , then we have
521
+
522
+ $$
523
+ \mu _ { z , j } = w _ { \mu _ { z } , j } ^ { \rho } . h _ { e } ^ { \rho } = 0 , \quad \sigma _ { z , j } ^ { 2 } = \exp { ( w _ { \sigma _ { z } ^ { 2 } , j } . ) } = 1 , \quad q ( z _ { j } | \mathbf { x } ) = \mathcal { N } ( 0 , 1 ) .
524
+ $$
525
+
526
+ The gradient of $\mu _ { z , j }$ and $\sigma _ { z , j }$ from $\mathcal { L } _ { k l } ( \pmb { x } ; \phi )$ becomes
527
+
528
+ $$
529
+ \frac { \partial \mathcal { L } _ { k l } ( \pmb { x } ; \phi ) } { \partial \mu _ { z , j } } = \mu _ { z , j } = 0 , \quad \frac { \partial \mathcal { L } _ { k l } ( \pmb { x } ; \phi ) } { \partial \sigma _ { z , j } } = 1 - \sigma _ { z , j } ^ { - 1 } = 0 .
530
+ $$
531
+
532
+ $\pmb { w } _ { \mu _ { z } , j } ^ { \rho }$ $\pmb { w } _ { \sigma _ { z } ^ { 2 } , j } ^ { \rho }$ $\mathcal { L } _ { k l }$
533
+
534
+ $$
535
+ \frac { \partial \mathcal { L } _ { k l } ( \pmb { x } ; \phi ) } { \partial \pmb { w } _ { \mu _ { z } , j . } ^ { \rho } } = \frac { \partial \mathcal { L } _ { k l } ( \pmb { x } ; \phi ) } { \partial \mu _ { z , j } } \pmb { h } _ { e } ^ { \rho \top } = 0 ,
536
+ $$
537
+
538
+ $$
539
+ \frac { \partial \mathcal { L } _ { k l } ( \pmb { x } ; \phi ) } { \partial \pmb { w } _ { \sigma _ { z } ^ { 2 } , j } ^ { \rho } . } = \frac { \partial \mathcal { L } _ { k l } ( \pmb { x } ; \phi ) } { 2 \sigma _ { z , j } \cdot \partial \sigma _ { z , j } } { h _ { e } ^ { \rho } } ^ { \top } = 0 .
540
+ $$
541
+
542
+ Now we consider the gradient from $\mathcal { L } _ { g e n } ( { \pmb x } ; \theta , \phi )$ . We have
543
+
544
+ $$
545
+ \frac { - \partial \log p _ { \theta } ( \pmb { x } | \pmb { z } ) } { \partial z _ { j } } = \frac { - \partial \log p _ { \theta } ( \pmb { x } | \pmb { z } ) } { \partial \pmb { h } _ { d } ^ { 1 } } \frac { \partial \pmb { h } _ { d } ^ { 1 } } { \partial z _ { j } } .
546
+ $$
547
+
548
+ Since
549
+
550
+ $$
551
+ h _ { d } ^ { 1 } = \mathrm { a c t } \left( \sum _ { j = 1 } ^ { \kappa } w _ { { \mu } _ { x } , \cdot j } ^ { 1 } z _ { j } \right) ,
552
+ $$
553
+
554
+ where $\arctan ( \cdot )$ is the activation function, we can obtain
555
+
556
+ $$
557
+ \frac { \partial { \pmb h } _ { d } ^ { 1 } } { \partial z _ { j } } = \mathrm { a c t } ^ { \prime } \left( \sum _ { j = 1 } ^ { \kappa } { \pmb w } _ { \mu _ { x } , \cdot j } ^ { 1 } z _ { j } \right) { \pmb w } _ { \mu _ { x } , \cdot j } ^ { 1 } = 0 .
558
+ $$
559
+
560
+ Plugging this back into (43) gives
561
+
562
+ $$
563
+ \frac { - \partial \log p _ { \theta } ( { \pmb x } | z ) } { \partial z _ { j } } = 0 .
564
+ $$
565
+
566
+ According to the chain rule, we have
567
+
568
+ $$
569
+ \frac { \partial \mathcal { L } _ { g e n } ( \pmb { x } ; \theta , \phi ) } { \partial \pmb { w } _ { \mu _ { z } , j . } ^ { \rho } } = \mathbb { E } _ { z \sim q _ { \phi } ( z | \pmb { x } ) } \left[ \frac { - \partial \log p _ { \theta } ( \pmb { x } | z ) } { \partial z _ { j } } \frac { \partial z _ { j } } { \partial \pmb { w } _ { \mu _ { z } , j . } ^ { \rho } } \right] = 0 ,
570
+ $$
571
+
572
+ $$
573
+ \frac { \partial \mathcal { L } _ { g e n } ( \pmb { x } ; \theta , \phi ) } { \partial \pmb { w } _ { \sigma _ { z } ^ { 2 } , j . } ^ { \rho } } = \mathbb { E } _ { z \sim q _ { \phi } ( z | \pmb { x } ) } \left[ \frac { - \partial \log p _ { \theta } ( \pmb { x } | z ) } { \partial z _ { j } } \frac { \partial z _ { j } } { \partial \pmb { w } _ { \sigma _ { z } ^ { 2 } , j . } ^ { \rho } } \right] = 0 .
574
+ $$
575
+
576
+ After combining these two equations with (41) and (42) and then integrating over $_ { \textbf { \em x } }$ , we have
577
+
578
+ $$
579
+ \begin{array} { r l } & { \frac { \partial \mathcal { L } ( \theta , \phi ) } { \partial w _ { \mu _ { z } , j \cdot } ^ { \rho } } = 0 , } \\ & { } \\ & { \frac { \partial \mathcal { L } ( \theta , \phi ) } { \partial w _ { \sigma _ { z } ^ { 2 } , j \cdot } ^ { \rho } } = 0 . } \end{array}
580
+ $$
581
+
582
+ Then we consider the gradient with respect to ${ \pmb w } _ { \mu _ { x } , \cdot j } ^ { 1 }$ w µx,·j . Since ${ \pmb w } _ { \mu _ { x } , \cdot j }$ is part of $\theta$ , it only receives gradient from $\mathcal { L } _ { g e n } ( { \pmb x } ; \theta , \phi )$ . So we do not need to consider the KL loss. If $w _ { \mu _ { x } , \cdot j } ^ { 1 } = 0$ , $h _ { d } ^ { 1 } =$ $\begin{array} { r } { \sum _ { j = 1 } ^ { \kappa } { \pmb w } _ { \mu _ { x } , \cdot j } ^ { 1 } z _ { j } } \end{array}$ is not related to $z _ { j }$ . So $p _ { \theta } ( { \pmb x } | { \pmb z } ) = p _ { \theta } ( { \pmb x } | { \pmb z } _ { \lnot j } )$ , where $z _ { \lnot j }$ xrepresents $_ z$ without the $j$ -th dimension. The gradient of $\pmb { w } _ { \mu _ { x } , \cdot j } ^ { 1 }$ is
583
+
584
+ $$
585
+ \begin{array} { r l } & { \displaystyle \frac { \partial \mathcal { L } _ { g e n } ( x ; \theta , \phi ) } { \partial w _ { \mu _ { x } , \cdot j } ^ { 1 } } = \mathbb { E } _ { z \sim q ( z \mid x ) } \left[ \frac { - \partial \log p _ { \theta } ( x \mid z ) } { \partial w _ { \mu _ { x } , \cdot j } ^ { 1 } } \right] = \mathbb { E } _ { z \sim q ( z \mid x ) } \left[ \frac { - \partial \log p _ { \theta } ( x \mid z ) } { \partial h _ { d } ^ { 1 } } z _ { j } \right] } \\ & { \displaystyle \quad \quad = \mathbb { E } _ { z \sim j \sim q ( z \sim j \mid x ) } \left[ \mathbb { E } _ { z _ { j } \sim \mathcal { N } ( 0 , 1 ) } \left[ \frac { - \partial \log p _ { \theta } ( x \mid z _ { - j } ) } { \partial h _ { d } ^ { 1 } } z _ { j } \right] \right] } \\ & { \displaystyle \quad \quad = \mathbb { E } _ { z \sim i \sim q ( z \sim i \mid x ) } \left[ \frac { - \partial \log p _ { \theta } ( x \mid z _ { - j } ) } { \partial h _ { d } ^ { 1 } } \mathbb { E } _ { z _ { j } \sim \mathcal { N } ( 0 , 1 ) } [ z _ { j } ] \right] = 0 . } \end{array}
586
+ $$
587
+
588
+ The integration over $_ { \textbf { \em x } }$ should also be 0. So we obtain
589
+
590
+ $$
591
+ \frac { \partial \mathcal { L } ( \theta ; \phi ) } { \partial \pmb { w } _ { \mu _ { x } , \cdot j } ^ { 1 } } = 0 .
592
+ $$
md/train/rJLS7qKel/rJLS7qKel.md ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING TO ACT BY PREDICTING THE FUTURE
2
+
3
+ Alexey Dosovitskiy Intel Labs
4
+
5
+ Vladlen Koltun Intel Labs
6
+
7
+ # ABSTRACT
8
+
9
+ We present an approach to sensorimotor control in immersive environments. Our approach utilizes a high-dimensional sensory stream and a lower-dimensional measurement stream. The cotemporal structure of these streams provides a rich supervisory signal, which enables training a sensorimotor control model by interacting with the environment. The model is trained using supervised learning techniques, but without extraneous supervision. It learns to act based on raw sensory input from a complex three-dimensional environment. The presented formulation enables learning without a fixed goal at training time, and pursuing dynamically changing goals at test time. We conduct extensive experiments in threedimensional simulations based on the classical first-person game Doom. The results demonstrate that the presented approach outperforms sophisticated prior formulations, particularly on challenging tasks. The results also show that trained models successfully generalize across environments and goals. A model trained using the presented approach won the Full Deathmatch track of the Visual Doom AI Competition, which was held in previously unseen environments.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Machine learning problems are commonly divided into three classes: supervised, unsupervised, and reinforcement learning. In this view, supervised learning is concerned with learning input-output mappings, unsupervised learning aims to find hidden structure in data, and reinforcement learning deals with goal-directed behavior (Murphy, 2012). Reinforcement learning is compelling because it considers the natural setting of an organism acting in its environment. It is generally taken to comprise a class of problems (learning to act), the mathematical formalization of these problems (maximizing the expected discounted return), and a family of algorithmic approaches (optimizing an objective derived from the Bellman equation) (Kaelbling et al., 1996; Sutton & Barto, 2017).
14
+
15
+ While reinforcement learning (RL) has achieved significant progress (Mnih et al., 2015), key challenges remain. One is sensorimotor control from raw sensory input in complex and dynamic threedimensional environments, learned directly from experience. Another is the acquisition of general skills that can be flexibly deployed to accomplish a multitude of dynamically specified goals (Lake et al., 2016).
16
+
17
+ In this work, we propose an approach to sensorimotor control that aims to assist progress towards overcoming these challenges. Our approach departs from the reward-based formalization commonly used in RL. Instead of a monolithic state and a scalar reward, we consider a stream of sensory input $\left\{ \mathbf { s } _ { t } \right\}$ and a stream of measurements $\left\{ \mathbf { m } _ { t } \right\}$ . The sensory stream is typically high-dimensional and may include the raw visual, auditory, and tactile input. The measurement stream has lower dimensionality and constitutes a set of data that pertain to the agent’s current state. In a physical system, measurements can include attitude, supply levels, and structural integrity. In a three-dimensional computer game, they can include health, ammunition levels, and the number of adversaries overcome.
18
+
19
+ Our guiding observation is that the interlocked temporal structure of the sensory and measurement streams provides a rich supervisory signal. Given present sensory input, measurements, and goal, the agent can be trained to predict the effect of different actions on future measurements. Assuming that the goal can be expressed in terms of future measurements, predicting these provides all the information necessary to support action. This reduces sensorimotor control to supervised learning, while supporting learning from raw experience and without extraneous data. Supervision is provided by experience itself: by acting and observing the effects of different actions in the context of changing sensory inputs and goals.
20
+
21
+ This approach has two significant benefits. First, in contrast to an occasional scalar reward assumed in traditional RL, the measurement stream provides rich and temporally dense supervision that can stabilize and accelerate training. While a sparse scalar reward may be the only feedback available in a board game (Tesauro, 1994; Silver et al., 2016), a multidimensional stream of sensations is a more appropriate model for an organism that is learning to function in an immersive environment (Adolph & Berger, 2006).
22
+
23
+ The second advantage of the presented formulation is that it supports training without a fixed goal and pursuing dynamically specified goals at test time. Assuming that the goal can be expressed in terms of future measurements, the model can be trained to take the goal into account in its prediction of the future. At test time, the agent can predict future measurements given its current sensory input, measurements, and goal, and then simply select the action that best suits its present goal.
24
+
25
+ We evaluate the presented approach in immersive three-dimensional simulations that require visually navigating a complex three-dimensional environment, recognizing objects, and interacting with dynamic adversaries. We use the classical first-person game Doom, which introduced immersive three-dimensional games to popular culture (Kushner, 2003). The presented approach is given only raw visual input and the statistics shown to the player in the game, such as health and ammunition levels. No human gameplay is used, the model trains on raw experience.
26
+
27
+ Experimental results demonstrate that the presented approach outperforms state-of-the-art deep RL models, particularly on complex tasks. Experiments further demonstrate that models learned by the presented approach generalize across environments and goals, and that the use of vectorial measurements instead of a scalar reward is beneficial. A model trained with the presented approach won the Full Deathmatch track of the Visual Doom AI Competition, which took place in previously unseen environments. The presented approach outperformed the second best submission, which employed a substantially more complex model and additional supervision during training, by more than $50 \%$ .
28
+
29
+ # 2 BACKGROUND
30
+
31
+ The supervised learning (SL) perspective on learning to act by interacting with the environment dates back decades. Jordan & Rumelhart (1992) analyze this approach, review early work, and argue that the choice of SL versus RL should be guided by the characteristics of the environment. Their analysis suggests that RL may be more efficient when the environment provides only a sparse scalar reward signal, whereas SL can be advantageous when temporally dense multidimensional feedback is available.
32
+
33
+ Sutton (1988) analyzed temporal-difference (TD) learning and argued that it is preferable to SL for prediction problems in which the correctness of the prediction is revealed many steps after the prediction is made. Sutton’s influential analysis assumes a sparse scalar reward. TD and policy gradient methods have since come to dominate the study of sensorimotor learning (Kober et al., 2013; Mnih et al., 2015; Sutton & Barto, 2017). While the use of SL is natural in imitation learning (LeCun et al., 2005; Ross et al., 2013) or in conjunction with model-based RL (Levine & Koltun, 2013), the formulation of sensorimotor learning from raw experience as supervised learning is rare (Levine et al., 2016). Our work suggests that when the learner is exposed to dense multidimensional sensory feedback, direct future prediction can support effective sensorimotor coordination in complex dynamic environments.
34
+
35
+ Our approach has similarities to Monte Carlo methods. The convergence of such methods was analyzed early on and they were seen as theoretically advantageous, particularly when function approximators are used (Bertsekas, 1995; Sutton, 1995; Singh & Sutton, 1996). The choice of TD learning over Monte Carlo methods was argued on practical grounds, based on empirical performance on canonical examples (Sutton, 1995). While the understanding of the convergence of both types of methods has since improved (Szepesvari & Littman, 1999; Tsitsiklis, 2002; Even-Dar & ´ Mansour, 2003), the argument for TD versus Monte Carlo is to this day empirical (Sutton & Barto, 2017). Sharp negative examples exist (Bertsekas, 2010). Our work deals with the more general setting of vectorial feedback and parameterized goals, and shows that a simple Monte-Carlo-type method performs extremely well in a compelling instantiation of this setting.
36
+
37
+ Vector-valued feedback has been considered in the context of multi-objective decision-making (Gabor et al., 1998; Roijers et al., 2013). Transfer across related tasks has been analyzed by ´ Konidaris et al. (2012). Parameterized goals have been studied in the context of continuous motor skills such as throwing darts at a target (da Silva et al., 2012; Kober et al., 2012; Deisenroth et al., 2014). A general framework for sharing value function approximators across both states and goals has been described by Schaul et al. (2015). Our work is most closely related to the framework of Schaul et al. (2015), but presents a specific formulation in which goals are defined in terms of intrinsic measurements and control is based on direct future prediction. We provide an architecture that handles realistic sensory and measurement streams and achieves state-of-the-art performance in complex and dynamic three-dimensional environments.
38
+
39
+ Learning to act in simulated environments has been the focus of significant attention following the successful application of deep RL to Atari games by Mnih et al. (2015). A number of recent efforts applied related ideas to three-dimensional environments. Lillicrap et al. (2016) considered continuous and high-dimensional action spaces and learned control policies in the TORCS simulator. Mnih et al. (2016) described asynchronous variants of deep RL methods and demonstrated navigation in a three-dimensional labyrinth. Oh et al. (2016) augmented deep Q-networks with external memory and evaluated their performance on a set of tasks in Minecraft. In a recent technical report, Kulkarni et al. (2016b) proposed end-to-end training of successor representations and demonstrated navigation in a Doom-based environment. In another recent report, Blundell et al. (2016) considered a nonparametric approach to control and conducted experiments in a three-dimensional labyrinth. Experiments reported in Section 4 demonstrate that our approach significantly outperforms state-ofthe-art deep RL methods.
40
+
41
+ Prediction of future states in dynamical systems was considered by Littman et al. (2001) and Singh et al. (2003). Predictive representations in the form of generalized value functions were advocated by Sutton et al. (2011). More recently, Oh et al. (2015) learned to predict future frames in Atari games. Prediction of full sensory input in realistic three-dimensional environments remains an open challenge, although significant progress is being made (Mathieu et al., 2016; Finn et al., 2016; Kalchbrenner et al., 2016). Our work considers prediction of future values of meaningful measurements from rich sensory input and shows that such prediction supports effective sensorimotor control.
42
+
43
+ # 3 MODEL
44
+
45
+ Consider an agent that interacts with the environment over discrete time steps. At each time step $t$ , the agent receives an observation $\mathbf { o } _ { t }$ and executes an action $a _ { t }$ based on this observation. We assume that the observations have the following structure: $\mathbf { o } _ { t } = \langle \mathbf { s } _ { t } , \mathbf { m } _ { t } \rangle$ , where $\mathbf { s } _ { t }$ is raw sensory input and $\mathbf { m } _ { t }$ is a set of measurements. In our experiments, $\mathbf { s } _ { t }$ is an image: the agent’s view of its threedimensional environment. More generally, $\mathbf { s } _ { t }$ can include input from multiple sensory modalities. The measurements $\mathbf { m } _ { t }$ can indicate the attitude, supply levels, and structural integrity in a physical system, or health, ammunition, and score in a computer game.
46
+
47
+ The distinction between sensory input $\mathbf { s } _ { t }$ and measurements $\mathbf { m } _ { t }$ is somewhat artificial: both $\mathbf { s } _ { t }$ and $\mathbf { m } _ { t }$ constitute sensory input in different forms. In our model, the measurement vector $\mathbf { m } _ { t }$ is distinguished from other sensations in two ways. First, the measurement vector is the part of the observation that the agent will aim to predict. At present, predicting full sensory streams is beyond our capabilities (although see the work of Kalchbrenner et al. (2016) and van den Oord et al. (2016) for impressive recent progress). We therefore designate a subset of sensations as measurements that will be predicted. Second, we assume that the agent’s goals can be defined in terms of future measurements. Specifically, let $\tau _ { 1 } , \ldots , \tau _ { n }$ be a set of temporal offsets and let $\mathbf { f } = \langle \mathbf { m } _ { t + \tau _ { 1 } } - \mathbf { m } _ { t } , \dots , \mathbf { m } _ { t + \tau _ { n } } - \mathbf { m } _ { t } \rangle$ be the corresponding differences of future and present measurements. We assume that any goal that the agent will pursue can be defined as maximization of a function $u ( \mathbf { f } ; \mathbf { g } )$ . Any parametric function can be used. Our experiments use goals that are expressed as linear combinations of future measurements:
48
+
49
+ $$
50
+ u ( \mathbf { f } ; \mathbf { g } ) = \mathbf { g } ^ { \top } \mathbf { f } ,
51
+ $$
52
+
53
+ where the vector $\mathbf { g }$ parameterizes the goal and has the same dimensionality as f. This model generalizes the standard reinforcement learning formulation: the scalar reward signal can be viewed as a measurement, and exponential decay is one possible configuration of the goal vector.
54
+
55
+ To predict future measurements, we use a parameterized function approximator, denoted by $F$ :
56
+
57
+ $$
58
+ \begin{array} { r } { \mathbf { p } _ { t } ^ { a } = F ( \mathbf { o } _ { t } , a , \mathbf { g } ; \pmb { \theta } ) . } \end{array}
59
+ $$
60
+
61
+ Here $a \in { \mathcal { A } }$ is an action, $\pmb \theta$ are the learned parameters of $F$ , and $\mathbf { p } _ { t } ^ { a }$ is the resulting prediction. The dimensionality of $\mathbf { p } _ { t } ^ { a }$ matches the dimensionality of $\mathbf { f }$ and g. Note that the prediction is a function of the current observation, the considered action, and the goal. At test time, given learned parameters $\pmb \theta$ , the agent can choose the action that yields the best predicted outcome:
62
+
63
+ $$
64
+ a _ { t } = \mathop { \arg \operatorname* { m a x } } _ { a \in \mathcal { A } } \mathbf { g } ^ { \top } F ( \mathbf { o } _ { t } , a , \mathbf { g } ; \pmb { \theta } ) .
65
+ $$
66
+
67
+ The goal vector used at test time need not be identical to any goal seen during training.
68
+
69
+ # 3.1 TRAINING
70
+
71
+ The predictor $F$ is trained on experiences collected by the agent. Starting with a random policy, the agent begins to interact with its environment. This interaction takes place over episodes that last for a fixed number of time steps or until a terminal event occurs.
72
+
73
+ Consider a set of experiences collected by the agent, yielding a set $\mathcal { D }$ of training examples: $\mathcal { D } = \{ \langle \mathbf { o } _ { i } , a _ { i } , \mathbf { g } _ { i } , \mathbf { f } _ { i } \rangle \} _ { i = 1 } ^ { \tilde { N } }$ . Here $\left. \mathbf { o } _ { i } , a _ { i } , \mathbf { g } _ { i } \right.$ is the input and $\mathbf { f } _ { i }$ is the output of example $i$ . The predictor is trained using a regression loss:
74
+
75
+ $$
76
+ \mathcal { L } ( \pmb \theta ) = \sum _ { i = 1 } ^ { N } \left\| F ( \mathbf { o } _ { i } , a _ { i } , \mathbf { g } _ { i } ; \pmb \theta ) - \mathbf { f } _ { i } \right\| ^ { 2 } .
77
+ $$
78
+
79
+ A classification loss can be used for predicting categorical measurements, but this was not necessary in our experiments.
80
+
81
+ As the agent collects new experiences, the training set $\mathcal { D }$ and the predictor used by the agent change. We maintain an experience memory of the $M$ most recent experiences out of which a mini-batch of $N$ examples is randomly sampled for every iteration of the solver. The parameters of the predictor used by the agent are updated after every $k$ new experiences. This setup departs from pure onpolicy training and we have not observed any adverse effect of using a small experience memory. Additional details are provided in Appendix A.
82
+
83
+ We have evaluated two training regimes:
84
+
85
+ 1. Single goal: the goal vector is fixed throughout the training process.
86
+ 2. Randomized goals: the goal vector for each episode is generated at rando
87
+
88
+ In both regimes, the agent follows an $\varepsilon$ -greedy policy: it acts greedily according to the current goal with probability $1 - \varepsilon$ , and selects a random action with probability $\varepsilon$ . The value of $\varepsilon$ is initially set to 1 and is decreased during training according to a fixed schedule.
89
+
90
+ # 3.2 ARCHITECTURE
91
+
92
+ The predictor $F$ is a deep network parameterized by $\pmb { \theta }$ . The network architecture we use is shown in Figure 1. The network has three input modules: a perception module $S ( \mathbf { s } )$ , a measurement module $M ( \mathbf { m } )$ and a goal module $G ( \mathbf { g } )$ . In our experiments, s is an image and the perception module $S$ is implemented as a convolutional network. The measurement and goal modules are fully-connected networks. The outputs of the three input modules are concatenated, forming the joint input representation used for subsequent processing:
93
+
94
+ $$
95
+ \mathbf { j } = J ( \mathbf { s } , \mathbf { m } , \mathbf { g } ) = \langle S ( \mathbf { s } ) , M ( \mathbf { m } ) , G ( \mathbf { g } ) \rangle .
96
+ $$
97
+
98
+ Future measurements are predicted based on this input representation. The network emits predictions of future measurements for all actions at once. This could be done by a fully-connected module that absorbs the input representation and outputs predictions. However, we found that introducing additional structure into the prediction module enhances its ability to learn the fine differences between the outcomes of different actions. To this end, we build on the ideas of Wang et al. (2016) and split the prediction module into two streams: an expectation stream $E ( \mathbf { j } )$ and an action stream $A ( \mathbf { j } )$ . The expectation stream predicts the average of the future measurements over all potential actions. The action stream concentrates on the fine differences between actions: $A ( \mathbf { j } ) = \left. A ^ { \hat { 1 } } ( \mathbf { j } ) , \dots , A ^ { w } ( \mathbf { j } ) \right.$ , where $w = | { \mathcal { A } } |$ is the number of actions. We add a normalization layer at the end of the action stream that ensures that the average of the predictions of the action stream is zero for each future measurement:
99
+
100
+ ![](images/177460b15e2c347d93462a883c42b9128e6e396a29e8d1ce53467521dd2a7e33.jpg)
101
+ Figure 1: Network structure. The image s, measurements $\mathbf { m }$ , and goal g are first processed separately by three input modules. The outputs of these modules are concatenated into a joint representation j. This joint representation is processed by two parallel streams that predict the expected measurements $E ( \mathbf { j } )$ and the normalized action-conditional differences $\{ { \overline { { A ^ { i } } } } ( \mathbf { j } ) \}$ , which are then combined to produce the final prediction for each action.
102
+
103
+ $$
104
+ \overline { { { A ^ { i } } } } ( { \bf { j } } ) = A ^ { i } ( { \bf { j } } ) - \frac { 1 } { w } \sum _ { k = 1 } ^ { w } A ^ { k } ( { \bf { j } } )
105
+ $$
106
+
107
+ for all $i$ . The normalization layer subtracts the average over all actions from each prediction, forcing the expectation stream $E$ to compensate by predicting these average values. The output of the expectation stream has dimensionality $\mathrm { { d i m } } ( \mathbf { f } )$ , where f is the vector of future measurements. The output of the action stream has dimensionality $w \cdot \mathrm { d i m } ( \mathbf { f } )$ .
108
+
109
+ The output of the network is a prediction of future measurements for each action, composed by summing the output of the expectation stream and the normalized action-conditional output of the action stream:
110
+
111
+ $$
112
+ { \bf p } = \langle { \bf p } ^ { a _ { 1 } } , \ldots , { \bf p } ^ { a _ { w } } \rangle = \left. \overline { { A ^ { 1 } } } ( { \bf j } ) + E ( { \bf j } ) , \ldots , \overline { { A ^ { w } } } ( { \bf j } ) + E ( { \bf j } ) \right. .
113
+ $$
114
+
115
+ The output of the network has the same dimensionality as the output of the action stream.
116
+
117
+ # 4 EXPERIMENTS
118
+
119
+ We evaluate the presented approach in immersive three-dimensional simulations based on the classical game Doom. In these simulations, the agent has a first-person view of the environment and must act based on the same visual information that is shown to human players in the game. To interface with the game engine, we use the ViZDoom platform developed by Kempka et al. (2016). One of the advantages of this platform is that it allows running the simulation at thousands of frames per second on a single CPU core, which enables training models on tens of millions of simulation steps in a single day.
120
+
121
+ We compare the presented approach to state-of-the-art deep RL methods in four scenarios of increasing difficulty, study generalization across environments and goals, and evaluate the importance of different aspects of the model.
122
+
123
+ # 4.1 SETUP
124
+
125
+ Scenarios. We use four scenarios of increasing difficulty:
126
+
127
+ ![](images/fdcac841162b23e731cf052e34750cf42e2b3857918735b4357433ce208cf3ae.jpg)
128
+ Figure 2: Example frames from the four scenarios.
129
+
130
+ D1 Gathering health kits in a square room. (“Basic”)
131
+
132
+ D2 Gathering health kits and avoiding poison vials in a maze. (“Navigation”)
133
+
134
+ D3 Defending against adversaries while gathering health and ammunition in a maze. (“Battle”)
135
+
136
+ D4 Defending against adversaries while gathering health and ammunition in a more complicated maze. (“Battle $2 ^ { \circ \bullet }$ )
137
+
138
+ These scenarios are illustrated in Figure 2 and in the supplementary video (http://bit.ly/ 2f9tacZ).
139
+
140
+ The first two scenarios are provided with the ViZDoom platform. In D1, the agent is in a square room and its health is declining at a constant rate. To survive, it must move around and collect health kits, which are distributed abundantly in the room. This task is easy: as long as the agent learns to avoid walls and keep traversing the room, performance is good. In D2, the agent is in a maze and its health is again declining at a constant rate. Here it must again collect health kits that increase its health, but it must also avoid blue poison vials that decrease health. This task is harder: the agent must learn to traverse irregularly shaped passageways, and to distinguish health kits from poison vials. In both tasks, the agent has access to three binary sub-actions: move forward, turn left, and turn right. Any combination of these three can be used at any given time, resulting in 8 possible actions. The only measurement provided to the agent in these scenarios is health.
141
+
142
+ The last two scenarios, D3 and D4, are more challenging and were designed by us using elements of the ViZDoom platform. Here the agent is armed and is under attack by alien monsters. The monsters spawn abundantly, move around in the environment, and shoot fireballs at the agent. Health kits and ammunition are sporadically distributed throughout the environment and can be collected by the agent. The environment is a simple maze in D3 and a more complex one in D4. In both scenarios, the agent has access to eight sub-actions: move forward, move backward, turn left, turn right, strafe left, strafe right, run, and shoot. Any combination of these sub-actions can be used, resulting in
143
+
144
+ 256 possible actions. The agent is provided with three measurements: health, ammunition, and frag count (number of monsters killed).
145
+
146
+ Model. The future predictor network used in our experiments was configured to be as close as possible to the DQN model of Mnih et al. (2015), to ensure a fair comparison. Additional details on the architecture are provided in Appendix A.
147
+
148
+ Training and testing. The agent is trained and tested over episodes. Each episode terminates after 525 steps (equivalent to 1 minute of real time) or when the agent’s health drops to zero. Statistics reported in figures and tables summarize the final values of respective measurements at the end of episodes.
149
+
150
+ We set the temporal offsets $\tau _ { 1 } , \ldots , \tau _ { n }$ of predicted future measurements to 1, 2, 4, 8, 16, and 32 steps in all experiments. Only the latest three time steps contribute to the objective function, with coefficients $( 0 . 5 , 0 . 5 , 1 )$ . More details are provided in Appendix A.
151
+
152
+ # 4.2 RESULTS
153
+
154
+ Comparison to prior work. We have compared the presented approach to three deep RL methods: DQN (Mnih et al., 2015), A3C (Mnih et al., 2016), and DSR (Kulkarni et al., 2016b). DQN is a standard baseline for visuomotor control due to its impressive performance on Atari games. A3C is more recent and is commonly regarded as the state of the art in this area. DSR is described in a recent technical report and we included it because the authors also used the ViZDoom platform in experiments, albeit with a simple task. Further details on the setup of the prior approaches are provided in Appendix B.
155
+
156
+ The performance of the different approaches during training is shown in Figure 3. In reporting the results of these experiments, we refer to our approach as DFP (direct future prediction). For the first two scenarios, all approaches were trained to maximize health. For these scenarios, Figure 3 reports average health at the end of an episode over the course of training. For the last two scenarios, all approaches were trained to maximize a linear combination of the three normalized measurements (ammo, health, and frags) with coefficients $( 0 . 5 , 0 . 5 , 1 )$ . For these scenarios, Figure 3 reports average frags at the end of an episode. Each presented curve averages information from three independent training runs, and each data point is computed from $3 \times 5 0 { , } 0 0 0$ steps of testing.
157
+
158
+ DQN, A3C, and DFP were trained for 50 million steps. The training procedure for DSR is much slower and can only process roughly 1 million simulation steps per day. For this reason, we were only able to evaluate DSR on the Basic scenario and were not able to perform extensive hyperparameter tuning. We report results for this technique after 10 days of training. (This time was sufficient to significantly exceed the number of training steps reported in the experiments of Kulkarni et al. (2016b), but not sufficient to approach the number of steps afforded by the other approaches.)
159
+
160
+ Table 1 reports the performance of the models after training. Each fully trained model was tested over 1 million simulation steps. The table reports average health at the end of an episode for scenarios D1 and D2, and average frags at the end of an episode for D3 and D4. We also report the average training speed for each approach, in millions of simulation steps per day of training. The performance of the different models is additionally illustrated in the supplementary video (http://bit.ly/2f9tacZ).
161
+
162
+ <table><tr><td></td><td>D1 (health)</td><td>D2 (health)</td><td>D3 (frags)</td><td>D4 (frags)</td><td> steps/day</td></tr><tr><td>DQN</td><td>89.1 ± 6.4</td><td>25.4 ± 7.8</td><td>1.2 ± 0.8</td><td>0.4 ± 0.2</td><td>7M</td></tr><tr><td>A3C</td><td>97.5 ± 0.1</td><td>59.3 ± 2.0</td><td>5.6 ± 0.2</td><td>6.7 ± 2.9</td><td>80M</td></tr><tr><td>DSR</td><td>4.6 ± 0.1</td><td>1</td><td>1</td><td>1</td><td>1M</td></tr><tr><td>DFP</td><td>97.7 ± 0.4</td><td>84.1 ± 0.6</td><td>33.5 ± 0.4</td><td>16.5 ± 1.1</td><td>70M</td></tr></table>
163
+
164
+ Table 1: Comparison to prior work. We report average health at the end of an episode for scenarios D1 and D2, and average frags at the end of an episode for scenarios D3 and D4.
165
+
166
+ ![](images/b5cb8f6ac4fa9126cbd68d3ee10690cd1b97ee8e6c91cd2ac966939ba8290255.jpg)
167
+ Figure 3: Performance of different approaches during training. DQN, A3C, and DFP achieve similar performance in the Basic scenario. DFP outperforms the prior approaches in the other three scenarios, with a multiplicative gap in performance in the most complex ones (D3 and D4).
168
+
169
+ In the Basic scenario, DQN, A3C, and DFP all perform well. As reported in Table 1, the performance of A3C and DFP is virtually identical at $9 7 . 5 \%$ , while DQN reaches $8 9 \%$ . In the more complex Navigation scenario, a significant gap opens up between DQN and A3C; this is consistent with the experiments of Mnih et al. (2016). DFP achieves the best performance in this scenario, with a 25 percentage point advantage during testing. Note that in these first two scenarios, DFP was only given a single measurement per time step (health).
170
+
171
+ In the more complex Battle and Battle 2 scenarios (D3 and D4), DFP dominates the other approaches. It outperforms A3C at test time by a factor of 6 in D3 and by a factor of 2.5 in D4. Note that the advantage of DFP is particularly significant in the scenarios that provide richer measurements: three measurements per time step in D3 and D4. The effect of multiple measurements is further evaluated in controlled experiments reported below.
172
+
173
+ Generalization across environments. We now evaluate how the behaviors learned by the presented approach generalize across different environments. To this end, we have created 100 randomly textured versions of the mazes from scenarios D3 and D4. We used 90 of these for training and 10 for testing, with disjoint sets of textures in the training and testing environments. We call these scenarios D3-tx and D4-tx.
174
+
175
+ Table 2 shows the performance of the approach for different combinations of training and testing regimes. For example, the entry in the D4-tx row of the D3 column shows the performance (in average number of frags at the end of an episode) of a model trained in D3 and tested in D4-tx. Not surprisingly, a model trained in the simple D3 environment does not learn sufficient invariance to surface appearance to generalize well to other environments. Training in the more complex multitexture environment in D4 yields better generalization: the trained model performs well in D3 and exhibits non-trivial performance in D3-tx and D4-tx. Finally, exposing the model to significant variation in surface appearance in D3-tx or D4-tx during training yields very good generalization.
176
+
177
+ Table 2: Generalization across environments.
178
+
179
+ <table><tr><td>D3</td><td colspan="6">Train</td></tr><tr><td>D3</td><td></td><td></td><td>D4</td><td>D3-tx</td><td>D4-tx</td><td>D4-tx-L</td></tr><tr><td rowspan="4">3</td><td></td><td>33.6</td><td>17.8</td><td>29.8</td><td>20.9</td><td>22.0</td></tr><tr><td>D4</td><td>1.6</td><td>17.1</td><td>5.4</td><td>10.8</td><td>12.4</td></tr><tr><td>D3-tx</td><td>3.9</td><td>8.1</td><td>22.6</td><td>15.6</td><td>19.4</td></tr><tr><td>D4-tx</td><td>1.7</td><td>5.1</td><td>6.2</td><td>10.2</td><td>12.7</td></tr></table>
180
+
181
+ The last column of Table 2 additionally reports the performance of a higher-capacity model trained in D4-tx. This combination is referred to as D4-tx-L. As shown in the table, this model performs even better. The architecture is detailed in Appendix A.
182
+
183
+ Visual Doom AI Competition. To further evaluate the presented approach, we participated in the Visual Doom AI Competition, held during September 2016. The competition evaluated sensorimotor control models that act based on raw visual input. The competition had the form of a tournament: the submitted agents play multiple games against each other, their performance measured by aggregate frags. The competition included two tracks. The Limited Deathmatch track was held in a known environment that was given to the participants in advance at training time. The Full Deathmatch track evaluated generalization to previously unseen environments and took place in multiple new environments that were not available to the participating teams at training time. We only enrolled in the Full Deathmatch track. Our model was trained using a variant of the D4-tx-L regime.
184
+
185
+ Our model won, outperforming the second best submission by more than $50 \%$ . That submission, described by Lample & Chaplot (2016), constitutes a strong baseline. It is a deep recurrent Q-network that incorporates an LSTM and was trained using reward shaping and extra supervision from the game engine. Specifically, the authors took advantage of the ability provided by the ViZDoom platform to use the internal configuration of the game, including ground-truth knowledge of the presence of enemies in the field of view, during training. The authors’ report shows that this additional supervision improved performance significantly. Our model, which is simpler, achieved even higher performance without such additional supervision.
186
+
187
+ Goal-agnostic training. We now evaluate the ability of the presented approach to learn without a fixed goal at training time, and adapt to varying goals at test time. These experiments are performed in the Battle scenario. We use three training regimes: (a) fixed goal vector during training, (b) random goal vector with each value sampled uniformly from $[ 0 , 1 ]$ for every episode, and (c) random goal vector with each value sampled uniformly from $[ - 1 , \bar { 1 } ]$ for every episode. More details are provided in Appendix A. Intuitively, in the second regime the agent is instructed to maximize the different measurements, but has no knowledge of their relative importance. The third regime makes no assumptions as to whether the measured quantities are desirable or not.
188
+
189
+ The results are shown in Table 3. Each group of columns corresponds to a training regime and each row to a different test-time goal. Goals are given by the weights of the three measurements (ammo, health, and frags) in the objective function. The first test-time goal in Table 3 is the goal vector used in the battle scenarios in the prior experiments, the second seeks to maximize the frag count, the third is a pacifist (maximize ammo and health, minimize frags), the fourth seeks to aimlessly drain ammunition, and the fifth aims to maximize health. For each row, each group of columns reports the average value of each of the three measurements at the end of an episode. Note that health level at the end of an episode can be negative if the agent suffered major damage in the pre-terminal step.
190
+
191
+ We draw two main conclusions. First, on the main task (first row), models trained without knowing the goal in advance (b,c) perform nearly as well as a dedicated model trained specifically for the eventual goal (a). Without knowing the eventual goal during training, the agent performs the task almost as well as when it was specifically trained for it. Second, all models generalize to new goals but not equally well. Models trained with a variety of goals (b,c) generalize much better than a model trained with a fixed goal.
192
+
193
+ <table><tr><td></td><td colspan="3">(a) fixed goal (0.5,0.5,1)</td><td colspan="3">(b) random goals [0,1]</td><td colspan="3">(c) random goals [-1,1]</td></tr><tr><td>test goal</td><td>ammo</td><td>health</td><td>frags</td><td>ammo</td><td>health</td><td>frags</td><td>ammo</td><td>health</td><td>frags</td></tr><tr><td>(0.5,0.5,1)</td><td>83.4</td><td>97.0</td><td>33.6</td><td>92.3</td><td>96.9</td><td>31.5</td><td>49.3</td><td>94.3</td><td>28.9</td></tr><tr><td>(0,0,1)</td><td>0.3</td><td>-3.7</td><td>11.5</td><td>4.3</td><td>30.0</td><td>20.6</td><td>21.8</td><td>70.9</td><td>24.6</td></tr><tr><td>(1,1,-1)</td><td>28.6</td><td>-2.0</td><td>0.0</td><td>22.1</td><td>4.4</td><td>0.2</td><td>89.4</td><td>83.6</td><td>0.0</td></tr><tr><td>(-1,0,0)</td><td>1.0</td><td>-8.3</td><td>1.7</td><td>1.9</td><td>-7.5</td><td>1.2</td><td>0.9</td><td>-8.6</td><td>1.7</td></tr><tr><td>(0,1,0)</td><td>0.7</td><td>2.7</td><td>2.6</td><td>9.0</td><td>77.8</td><td>6.6</td><td>3.0</td><td>69.6</td><td>7.9</td></tr></table>
194
+
195
+ Table 3: Generalization across goals. Each group of three columns corresponds to a training regime, each row corresponds to a test-time goal. The results in the first row indicate that the approach performs well on the main task even without knowing the goal at training time. The results in the other rows indicate that goal-agnostic training supports generalization across goals at test time.
196
+
197
+ Ablation study. We now perform an ablation study using the D3-tx scenario. Specifically, we evaluate the importance of vectorial feedback versus a scalar reward, and the effect of predicting measurements at multiple temporal offsets. The results are summarized in Table 4. The table reports the performance (in average frags at the end of an episode) of our full model (predicting three measurements at six temporal offsets) and of ablated variants that only predict frags (a scalar reward) and/or only predict at the farthest temporal offset. As the results demonstrate, predicting multiple measurements significantly improves the performance of the learned model, even when it is evaluated by only one of those measurements. Predicting measurements at multiple future times is also beneficial. This supports the intuition that a dense flow of multivariate measurements is a better training signal than a scalar reward.
198
+
199
+ Table 4: Ablation study. Predicting all measurements at all temporal offsets yields the best results.
200
+
201
+ <table><tr><td></td><td>frags</td></tr><tr><td>all measurements</td><td>all offsets</td><td>22.6</td></tr><tr><td>all measurements</td><td>one offset</td><td>17.2</td></tr><tr><td>frags only</td><td>all offsets</td><td>10.3</td></tr><tr><td>frags only</td><td>one offset</td><td>5.0</td></tr></table>
202
+
203
+ # 5 DISCUSSION
204
+
205
+ We presented an approach to sensorimotor control in immersive environments. Our approach is simple and demonstrates that supervised learning techniques can be adapted to learning to act in complex and dynamic three-dimensional environments given raw sensory input and intrinsic measurements. The model trains on raw experience, by interacting with the environment without extraneous supervision. Natural supervision is provided by the cotemporal structure of the sensory and measurement streams. Our experiments have demonstrated that this simple approach outperforms sophisticated deep reinforcement learning formulations on challenging tasks in immersive environments. Experiments have further demonstrated that the use of multivariate measurements provides a significant advantage over conventional scalar rewards and that the trained model can effectively pursue new goals not specified during training.
206
+
207
+ The presented work can be extended in multiple ways that are important for broadening the range of behaviors that can be learned. First, the presented model is purely reactive: it acts based on the current frame only, with no explicit facilities for memory and no test-time retention of internal representations. Recent work has explored memory-based models (Oh et al., 2016) and integrating such ideas with the presented approach may yield substantial advances. Second, significant progress in behavioral sophistication will likely require temporal abstraction and hierarchical organization of learned skills (Barto & Mahadevan, 2003; Kulkarni et al., 2016a). Third, the presented model was developed for discrete action spaces; applying the presented ideas to continuous actions would be interesting (Lillicrap et al., 2016). Finally, predicting features learned directly from rich sensory input can blur the distinction between sensory and measurement streams (Mathieu et al., 2016; Finn et al., 2016; Kalchbrenner et al., 2016).
208
+
209
+ REFERENCES
210
+ Karen E. Adolph and Sarah E. Berger. Motor development. In Handbook of Child Psychology, volume 2, pp. 161–213. Wiley, 6th edition, 2006.
211
+ Andrew G. Barto and Sridhar Mahadevan. Recent advances in hierarchical reinforcement learning. Discrete Event Dynamic Systems, 13(1-2), 2003.
212
+ Dimitri P. Bertsekas. A counterexample to temporal differences learning. Neural Computation, 7(2), 1995.
213
+ Dimitri P. Bertsekas. Pathologies of temporal difference methods in approximate dynamic programming. In IEEE Conference on Decision and Control, 2010.
214
+ 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:1606.04460, 2016.
215
+ Bruno Castro da Silva, George Konidaris, and Andrew G. Barto. Learning parameterized skills. In ICML, 2012.
216
+ Marc Peter Deisenroth, Peter Englert, Jan Peters, and Dieter Fox. Multi-task policy search for robotics. In ICRA, 2014.
217
+ Eyal Even-Dar and Yishay Mansour. Learning rates for Q-learning. JMLR, 5, 2003.
218
+ Chelsea Finn, Ian J. Goodfellow, and Sergey Levine. Unsupervised learning for physical interaction through video prediction. In NIPS, 2016.
219
+ Zoltan G ´ abor, Zsolt Kalm ´ ar, and Csaba Szepesv ´ ari. Multi-criteria reinforcement learning. In ´ ICML, 1998.
220
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing humanlevel performance on ImageNet classification. In ICCV, 2015.
221
+ Michael I. Jordan and David E. Rumelhart. Forward models: Supervised learning with a distal teacher. Cognitive Science, 16(3), 1992.
222
+ Leslie Pack Kaelbling, Michael L. Littman, and Andrew W. Moore. Reinforcement learning: A survey. JAIR, 4, 1996.
223
+ Nal Kalchbrenner, Aaron van den Oord, Karen Simonyan, Ivo Danihelka, Oriol Vinyals, Alex Graves, and Koray Kavukcuoglu. Video pixel networks. arXiv:1610.00527, 2016.
224
+ 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, 2016.
225
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
226
+ Jens Kober, Andreas Wilhelm, Erhan Oztop, and Jan Peters. Reinforcement learning to adjust parametrized motor primitives to new situations. Autonomous Robots, 33(4), 2012.
227
+ Jens Kober, J. Andrew Bagnell, and Jan Peters. Reinforcement learning in robotics: A survey. IJRR, 32(11), 2013.
228
+ George Konidaris, Ilya Scheidwasser, and Andrew G. Barto. Transfer in reinforcement learning via shared features. JMLR, 13, 2012.
229
+ Tejas D. Kulkarni, Karthik Narasimhan, Ardavan Saeedi, and Joshua B. Tenenbaum. Hierarchical deep reinforcement learning: Integrating temporal abstraction and intrinsic motivation. In NIPS, 2016a.
230
+ Tejas D. Kulkarni, Ardavan Saeedi, Simanta Gautam, and Samuel J. Gershman. Deep successor reinforcement learning. arXiv:1606.02396, 2016b.
231
+ David Kushner. Masters of Doom: How Two Guys Created an Empire and Transformed Pop Culture. Random House, 2003.
232
+ Brenden M. Lake, Tomer D. Ullman, Joshua B. Tenenbaum, and Samuel J. Gershman. Building machines that learn and think like people. arXiv:1604.00289, 2016.
233
+ Guillaume Lample and Devendra Singh Chaplot. Playing FPS games with deep reinforcement learning. arXiv:1609.05521, 2016.
234
+ Yann LeCun, Urs Muller, Jan Ben, Eric Cosatto, and Beat Flepp. Off-road obstacle avoidance through end-toend learning. In NIPS, 2005.
235
+ Sergey Levine and Vladlen Koltun. Guided policy search. In ICML, 2013.
236
+ Sergey Levine, Peter Pastor, Alex Krizhevsky, and Deirdre Quillen. Learning hand-eye coordination for robotic grasping with deep learning and large-scale data collection. In ISER, 2016.
237
+ Timothy P. Lillicrap, Jonathan J. Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. In ICLR, 2016.
238
+ Michael L. Littman, Richard S. Sutton, and Satinder P. Singh. Predictive representations of state. In NIPS, 2001.
239
+ Michael Mathieu, Camille Couprie, and Yann LeCun. Deep multi-scale video prediction beyond mean square ¨ error. In ICLR, 2016.
240
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin Riedmiller, Andreas K. Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, et al. Human-level control through deep reinforcement learning. Nature, 518(7540), 2015.
241
+ Volodymyr Mnih, Adria Puigdom \` enech Badia, Mehdi Mirza, Alex Graves, Timothy P. Lillicrap, Tim Harley, \` David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In ICML, 2016.
242
+ Kevin P. Murphy. Machine Learning: A Probabilistic Perspective. MIT Press, 2012.
243
+ Junhyuk Oh, Xiaoxiao Guo, Honglak Lee, Richard L. Lewis, and Satinder P. Singh. Action-conditional video prediction using deep networks in Atari games. In NIPS, 2015.
244
+ Junhyuk Oh, Valliappa Chockalingam, Satinder P. Singh, and Honglak Lee. Control of memory, active perception, and action in Minecraft. In ICML, 2016.
245
+ Diederik M. Roijers, Peter Vamplew, Shimon Whiteson, and Richard Dazeley. A survey of multi-objective sequential decision-making. JAIR, 48, 2013.
246
+ Stephane Ross, Narek Melik-Barkhudarov, Kumar Shaurya Shankar, Andreas Wendel, Debadeepta Dey, J. An- ´ drew Bagnell, and Martial Hebert. Learning monocular reactive UAV control in cluttered natural environments. In ICRA, 2013.
247
+ Tom Schaul, Daniel Horgan, Karol Gregor, and David Silver. Universal value function approximators. In ICML, 2015.
248
+ David Silver, Aja Huang, Chris J. Maddison, Arthur Guez, Laurent Sifre, George van den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, Sander Dieleman, Dominik Grewe, et al. Mastering the game of Go with deep neural networks and tree search. Nature, 529(7587), 2016.
249
+ Satinder P. Singh and Richard S. Sutton. Reinforcement learning with replacing eligibility traces. Machine Learning, 22(1-3), 1996.
250
+ Satinder P. Singh, Michael L. Littman, Nicholas K. Jong, David Pardoe, and Peter Stone. Learning predictive state representations. In ICML, 2003.
251
+ Richard S. Sutton. Learning to predict by the methods of temporal differences. Machine Learning, 3, 1988.
252
+ Richard S. Sutton. Generalization in reinforcement learning: Successful examples using sparse coarse coding. In NIPS, 1995.
253
+ Richard S. Sutton and Andrew G. Barto. Reinforcement Learning: An Introduction. MIT Press, 2nd edition, 2017.
254
+ 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 AAMAS, 2011.
255
+ Csaba Szepesvari and Michael L. Littman. A unified analysis of value-function-based reinforcement learning ´ algorithms. Neural Computation, 11(8), 1999.
256
+ Gerald Tesauro. TD-gammon, a self-teaching backgammon program, achieves master-level play. Neural Computation, 6(2), 1994.
257
+ John N. Tsitsiklis. On the convergence of optimistic policy iteration. JMLR, 2002.
258
+ Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, Nal Kalch- ¨ brenner, Andrew W. Senior, and Koray Kavukcuoglu. WaveNet: A generative model for raw audio. arXiv:1609.03499, 2016.
259
+ Ziyu Wang, Tom Schaul, Matteo Hessel, Hado van Hasselt, Marc Lanctot, and Nando de Freitas. Dueling network architectures for deep reinforcement learning. In ICML, 2016.
260
+
261
+ # A IMPLEMENTATION DETAILS
262
+
263
+ # A.1 NETWORK ARCHITECTURES
264
+
265
+ The detailed architectures of two network variants – basic and large – are shown in Tables A1 and A2. The basic network follows the architecture of Mnih et al. (2015) as closely as possible. The large network is similar, but all layers starting from the third are wider by a factor of two. In all networks we use the leaky ReLU nonlinearity $\mathrm { L R e L U } ( x ) = \operatorname* { m a x } ( x , 0 . 2 x )$ after each nonterminal layer. We initialize the weights as proposed by He et al. (2015).
266
+
267
+ Table A1: The basic architecture.
268
+
269
+ <table><tr><td>module</td><td>input dimension</td><td>channels</td><td>kernel</td><td>stride</td></tr><tr><td rowspan="4">Perception</td><td>84 × 84×1</td><td>32</td><td>8</td><td>4</td></tr><tr><td>21 × 21 × 32</td><td>64</td><td>4</td><td>2</td></tr><tr><td>10 × 10 × 64</td><td>64</td><td>3</td><td>1</td></tr><tr><td>10· 10· 64</td><td>512</td><td>二</td><td>1</td></tr><tr><td rowspan="3">Measurement</td><td>3</td><td>128</td><td></td><td></td></tr><tr><td>128</td><td>128</td><td></td><td></td></tr><tr><td>128</td><td>128</td><td></td><td></td></tr><tr><td rowspan="3">Goal</td><td>3·6</td><td>128</td><td></td><td></td></tr><tr><td>128</td><td>128</td><td></td><td></td></tr><tr><td>128</td><td>128</td><td></td><td></td></tr><tr><td rowspan="2">Expectation</td><td>512 +128+128</td><td>512</td><td></td><td></td></tr><tr><td>512</td><td>3·6</td><td></td><td></td></tr><tr><td rowspan="2">Action</td><td>512 +128+128</td><td>512</td><td></td><td></td></tr><tr><td>512</td><td>3·6·256</td><td>一</td><td></td></tr></table>
270
+
271
+ Table A2: The large architecture.
272
+
273
+ <table><tr><td>module</td><td>input dimension</td><td>channels</td><td>kernel</td><td>stride</td></tr><tr><td rowspan="4">Perception</td><td>128 × 128 ×1</td><td>32</td><td>8</td><td>4</td></tr><tr><td>32 × 32 × 32</td><td>64</td><td>4</td><td>2</td></tr><tr><td>16 × 16× 64</td><td>128</td><td>3</td><td>1</td></tr><tr><td>16 ·16 ·128</td><td>1024</td><td>二</td><td>1</td></tr><tr><td rowspan="3">Measurement</td><td>3</td><td>128</td><td></td><td></td></tr><tr><td>128</td><td>128</td><td></td><td></td></tr><tr><td>128</td><td>128</td><td></td><td></td></tr><tr><td rowspan="3">Goal</td><td>3·6</td><td>128</td><td></td><td></td></tr><tr><td>128</td><td>128</td><td></td><td></td></tr><tr><td>128</td><td>128</td><td></td><td></td></tr><tr><td>Expectation</td><td>1024 +128 +128 1024</td><td>1024 3·6</td><td></td><td></td></tr><tr><td>Action</td><td>1024+128+128 1024</td><td>1024 3· 6 · 256</td><td></td><td></td></tr></table>
274
+
275
+ We empirically validate the architectural choices in the D3-tx regime. We compare the full basic architecture to three variants:
276
+
277
+ • No normalization: normalization at the end of the action stream is not performed. • No split: no expectation/action split, simply predict future measurements with a fullyconnected network.
278
+
279
+ • No input measurements: the input measurement stream is removed, and current measurements are not provided to the network.
280
+
281
+ The results are reported in Table A3. All modifications of the basic architecture hurt performance, showing that the two-stream formulation is beneficial and that providing the current measurements to the network increases performance but is not crucial.
282
+ Table A3: Evaluation of different network architectures.
283
+
284
+ <table><tr><td></td><td>full</td><td>no normalization</td><td>no split</td><td> no input measurements</td></tr><tr><td>Score</td><td>22.6</td><td>21.6</td><td>16.5</td><td>19.4</td></tr></table>
285
+
286
+ # A.2 OTHER DETAILS
287
+
288
+ The raw sensory input to the agent is the observed image, in grayscale, without any additional preprocessing. The resolution is $8 4 { \times } 8 4$ pixels for the basic model and $1 2 8 { \times } 1 2 8$ pixels for the large one. We normalized the measurements by their standard deviations under random exploration. More precisely, we divided ammo count, health level, and frag count by 7.5, 30.0, and 1.0, respectively.
289
+
290
+ We performed frame skipping during both training and testing. The agent observes the environment and selects an action every $\bar { 4 } ^ { \mathrm { t h } }$ frame. The selected action is repeated during the skipped frames. This accelerates training without sacrificing accuracy. In the paper, “step” always refers to steps after frame skipping (equivalent to every $4 ^ { \mathrm { t h } }$ step before frame skipping). When played by a human, Doom runs at 35 frames per second, so one step of the agent is equivalent to 114 milliseconds of real time. Therefore, frame skipping has the added benefit of bringing the reaction time of the agent closer to that of a human.
291
+
292
+ We set the temporal offsets $\tau _ { 1 } , \ldots , \tau _ { n }$ of predicted future measurements to 1, 2, 4, 8, 16, and 32 steps in all experiments. The longest temporal offset corresponds to 3.66 seconds of real time. In all experiments, only the latest three predictions (after 8, 16, and 32 steps) contributed to the objective function, with fixed coefficients $( 0 . 5 , 0 . 5 , 1 . 0 )$ . Therefore, in scenarios with multiple measurements available to the agent (D3 and D4), the goal vector was specified by three numbers: the relative weights of the three measurements (ammo, health, frags) in the objective function. In goal-directed training, these were fixed to $( 0 . 5 , 0 . 5 , 1 . 0 )$ , and in goal-agnostic training they were sampled uniformly at random from [0, 1] or $[ - 1 , 1 ]$ .
293
+
294
+ We used an experience memory of $M = 2 0 { , } 0 0 0$ steps, and sampled a mini-batch of $N = 6 4$ samples after every $k = 6 4$ new experiences added. We added the experiences to the memory using 8 copies of the agent running in parallel. The networks in all experiments were trained using the Adam algorithm (Kingma & Ba, 2015) with $\beta _ { 1 } = 0 . 9 5$ , $\beta _ { 2 } = 0 . 9 9 9$ , and $\varepsilon = 1 0 ^ { - 4 }$ . The initial learning rate is set to $1 0 ^ { - 4 }$ and is gradually decreased during training. The basic networks were trained for 800,000 mini-batch iterations (or 51.2 million steps), the large one for 2,000,000 iterations.
295
+
296
+ # B BASELINES
297
+
298
+ We compared our approach to three prior methods: DQN (Mnih et al., 2015), DSR (Kulkarni et al., 2016b), and A3C (Mnih et al., 2016). We used the authors’ implementations of DQN (https://github.com/kuz/DeepMind-Atari-Deep-Q-Learner) and DSR (https://github.com/Ardavans/DSR), and an independent implementation of A3C (https://github.com/muupan/async-rl). For scenarios D1 and D2 we used the change in health as reward. For D3 and D4 we used a linear combination of changes of the three normalized measurements with the same coefficients as for the presented approach: (0.5, 0.5, 1). For DQN and DSR we tested three learning rates: the default one (0.00025) and two alternatives (0.00005 and 0.00002). Other hyperparameters were left at their default values. For A3C, which trains faster, we performed a search over a set of learning rates $( \{ 2 , 4 , 8 , 1 6 , 3 2 \} \cdot 1 0 ^ { - 4 } )$ for the first two tasks; for the last two tasks we trained 20 models with random learning rates sampled log-uniformly between $1 0 ^ { - 4 }$ and $1 0 ^ { - 2 }$ and random $\beta$ (entropy regularization) sampled log-uniformly between $1 0 ^ { - 4 }$ and $1 0 ^ { - 1 }$ . For all baselines we report the best results we were able to obtain.
md/train/rJTutzbA-/rJTutzbA-.md ADDED
@@ -0,0 +1,682 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ON THE INSUFFICIENCY OF EXISTING MOMENTUM SCHEMES FOR STOCHASTIC OPTIMIZATION
2
+
3
+ Rahul Kidambi∗1, Praneeth Netrapalli2, Prateek Jain2 and Sham M. Kakade1
4
+
5
+ 1 University of Washington Seattle 2 Microsoft Research India rkidambi@uw.edu, {praneeth, prajain}@microsoft.com, sham@cs.washington.edu
6
+
7
+ # ABSTRACT
8
+
9
+ Momentum based stochastic gradient methods such as heavy ball (HB) and Nesterov’s accelerated gradient descent (NAG) method are widely used in practice for training deep networks and other supervised learning models, as they often provide significant improvements over stochastic gradient descent (SGD). Rigorously speaking, “fast gradient” methods have provable improvements over gradient descent only for the deterministic case, where the gradients are exact. In the stochastic case, the popular explanations for their wide applicability is that when these fast gradient methods are applied in the stochastic case, they partially mimic their exact gradient counterparts, resulting in some practical gain. This work provides a counterpoint to this belief by proving that there exist simple problem instances where these methods cannot outperform SGD despite the best setting of its parameters. These negative problem instances are, in an informal sense, generic; they do not look like carefully constructed pathological instances. These results suggest (along with empirical evidence) that HB or NAG’s practical performance gains are a by-product of mini-batching.
10
+
11
+ Furthermore, this work provides a viable (and provable) alternative, which, on the same set of problem instances, significantly improves over HB, NAG, and SGD’s performance. This algorithm, referred to as Accelerated Stochastic Gradient Descent (ASGD), is a simple to implement stochastic algorithm, based on a relatively less popular variant of Nesterov’s Acceleration. Extensive empirical results in this paper show that ASGD has performance gains over HB, NAG, and SGD. The code implementing the ASGD Algorithm can be found here1.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ First order optimization methods, which access a function (to be optimized) through its gradient or an unbiased approximation of its gradient, are the workhorses for modern large scale optimization problems, which include training the current state-of-the-art deep neural networks. Gradient descent (Cauchy, 1847) is the simplest first order method that is used heavily in practice. However, it is known that for the class of smooth convex functions as well as some simple non-smooth problems (Nesterov, 2012a)), gradient descent is suboptimal (Nesterov, 2004) and there exists a class of algorithms called fast gradient/momentum based methods which achieve optimal convergence guarantees. The heavy ball method (Polyak, 1964) and Nesterov’s accelerated gradient descent (Nesterov, 1983) are two of the most popular methods in this category.
16
+
17
+ On the other hand, training deep neural networks on large scale datasets have been possible through the use of Stochastic Gradient Descent (SGD) (Robbins & Monro, 1951), which samples a random subset of training data to compute gradient estimates that are then used to optimize the objective function. The advantages of SGD for large scale optimization and the related issues of tradeoffs between computational and statistical efficiency was highlighted in Bottou & Bousquet (2007).
18
+
19
+ The above mentioned theoretical advantages of fast gradient methods (Polyak, 1964; Nesterov, 1983) (albeit for smooth convex problems) coupled with cheap to compute stochastic gradient estimates led to the influential work of Sutskever et al. (2013), which demonstrated the empirical advantages possessed by SGD when augmented with the momentum machinery. This work has led to widespread adoption of momentum methods for training deep neural nets; so much so that, in the context of neural network training, gradient descent often refers to momentum methods.
20
+
21
+ But, there is a subtle difference between classical momentum methods and their implementation in practice – classical momentum methods work in the exact first order oracle model (Nesterov, 2004), i.e., they employ exact gradients (computed on the full training dataset), while in practice (Sutskever et al., 2013), they are implemented with stochastic gradients (estimated from a randomly sampled mini-batch of training data). This leads to a natural question:
22
+
23
+ “Are momentum methods optimal even in the stochastic first order oracle (SFO) model, where we access stochastic gradients computed on a small constant sized minibatches (or a batchsize of 1?)”
24
+
25
+ Even disregarding the question of optimality of momentum methods in the SFO model, it is not even known if momentum methods (say, Polyak (1964); Nesterov (1983)) provide any provable improvement over SGD in this model. While these are open questions, a recent effort of Jain et al. (2017) showed that improving upon SGD (in the stochastic first order oracle) is rather subtle as there exists problem instances in SFO model where it is not possible to improve upon SGD, even information theoretically. Jain et al. (2017) studied a variant of Nesterov’s accelerated gradient updates (Nesterov, 2012b) for stochastic linear regression and show that their method improves upon SGD wherever it is information theoretically admissible. Through out this paper, we refer to the algorithm of Jain et al. (2017) as Accelerated Stochastic Gradient Method (ASGD) while we refer to a stochastic version of the most widespread form of Nesterov’s method (Nesterov, 1983) as NAG; HB denotes a stochastic version of the heavy ball method (Polyak, 1964). Critically, while Jain et al. (2017) shows that ASGD improves on SGD in any information-theoretically admissible regime, it is still not known whether HB and NAG can achieve a similar performance gain.
26
+
27
+ A key contribution of this work is to show that HB does not provide similar performance gains over SGD even when it is informationally-theoretically admissible. That is, we provide a problem instance where it is indeed possible to improve upon SGD (and ASGD achieves this improvement), but HB cannot achieve any improvement over SGD. We validate this claim empirically as well. In fact, we provide empirical evidence to the claim that NAG also do not achieve any improvement over SGD for several problems where ASGD can still achieve better rates of convergence.
28
+
29
+ This raises a question about why HB and NAG provide better performance than SGD in practice (Sutskever et al., 2013), especially for training deep networks. Our conclusion (that is well supported by our theoretical result) is that HB and NAG’s improved performance is attributed to mini-batching and hence, these methods will often struggle to improve over SGD with small constant batch sizes. This is in stark contrast to methods like ASGD, which is designed to improve over SGD across both small or large mini-batch sizes. In fact, based on our experiments, we observe that on the task of training deep residual networks (He et al., 2016a) on the cifar-10 dataset, we note that ASGD offers noticeable improvements by achieving $5 - 7 \%$ better test error over HB and NAG even with commonly used batch sizes like 128 during the initial stages of the optimization.
30
+
31
+ # 1.1 CONTRIBUTIONS
32
+
33
+ The contributions of this paper are as follows.
34
+
35
+ 1. In Section 3, we prove that HB is not optimal in the SFO model. In particular, there exist linear regression problems for which the performance of HB (with any step size and momentum) is either the same or worse than that of SGD while ASGD improves upon both of them.
36
+ 2. Experiments on several linear regression problems suggest that the suboptimality of HB in the SFO model is not restricted to special cases – it is rather widespread. Empirically, the same holds true for NAG as well (Section 5).
37
+ 3. The above observations suggest that the only reason for the superiority of momentum methods in practice is mini-batching, which reduces the variance in stochastic gradients and moves the SFO closer to the exact first order oracle. This conclusion is supported by em
38
+
39
+ # Algorithm 1 HB: Heavy ball with a SFO
40
+
41
+ # Algorithm 2 NAG: Nesterov’s AGD with a SFO
42
+
43
+ Require: Initial $w _ { 0 }$ , stepsize $\delta$ , momentum $\alpha$
44
+
45
+ Require: Initial $w _ { 0 }$ , stepsize $\delta$ , momentum $\alpha$
46
+
47
+ 1: $v _ { 0 } w _ { 0 }$ ; $t \gets 0$ /\*Set $v _ { 0 }$ to $\boldsymbol { w _ { 0 } } ^ { * } /$
48
+ 2: while $w _ { t }$ not converged do
49
+ 3: $v _ { t + 1 } \gets w _ { t } - \delta \cdot \tilde { \widehat { \nabla } } f _ { t } ( w _ { t } ) / { * } \mathrm { S G D ~ s t e p } ^ { { * } / }$
50
+ 4: $w _ { t + 1 } = ( 1 + \alpha ) v _ { t + 1 } - \alpha v _ { t } / \ast \mathrm { S u m }$ of SGD
51
+ step and previous iterate\*/
52
+ 5: $t \gets t + 1$
53
+
54
+ /\*Return the last iterate\*/ /\*Return the last iterate\*/
55
+
56
+ pirical evidence through training deep residual networks on cifar-10, with a batch size of 8 (see Section 5.3).
57
+
58
+ 4. We present an intuitive and easier to tune version of ASGD (see Section 4) and show that ASGD can provide significantly faster convergence to a reasonable accuracy than SGD, HB, NAG, while still providing favorable or comparable asymptotic accuracy as these methods, particularly on several deep learning problems.
59
+
60
+ Hence, the take-home message of this paper is: HB and NAG are not optimal in the SFO model. The only reason for the superiority of momentum methods in practice is mini-batching. ASGD provides a distinct advantage in training deep networks over SGD, HB and NAG.
61
+
62
+ # 2 NOTATION
63
+
64
+ We denote matrices by bold-face capital letters and vectors by lower-case letters. $f ( w ) =$ $1 / n \sum _ { i } f _ { i } ( w )$ denotes the function to optimize w.r.t. model parameters $w$ . $\nabla f ( w )$ denotes exact gradient of $f$ at $w$ while $\widehat { \nabla } f _ { t } ( \boldsymbol { w } )$ denotes a stochastic gradient of $f$ . That is, $\widehat { \nabla } f _ { t } ( w _ { t } ) = \nabla f _ { i _ { t } } ( w )$ where $i _ { t }$ is sampled uniformly at random from $[ 1 , \ldots , n ]$ . For linear regression, $f _ { i } ( w ) = 0 . 5 \cdot ( b _ { i } -$ $\langle w , a _ { i } \rangle ) ^ { 2 }$ where $b _ { i } \in \Re$ is the target and $a _ { i } \in \Re ^ { d }$ is the covariate, and $\widehat { \nabla } f _ { t } ( w _ { t } ) = - \big ( b _ { t } - \langle w _ { t } , a _ { t } \rangle \big ) a _ { t }$ . In this case, $\mathbf { H } = \mathbb { E } \left[ a a ^ { \top } \right]$ denotes the Hessian of $f$ and $\begin{array} { r } { \kappa = \frac { \lambda _ { 1 } ( \mathbf { H } ) } { \lambda _ { d } ( \mathbf { H } ) } } \end{array}$ denotes it’s condition number.
65
+
66
+ Algorithm 1 provides a pseudo-code of HB method (Polyak, 1964). $w _ { t } - w _ { t - 1 }$ is the momentum term and $\alpha$ denotes the momentum parameter. Next iterate $w _ { t + 1 }$ is obtained by a linear combination of the SGD update and the momentum term. Algorithm 2 provides pseudo-code of a stochastic version of the most commonly used form of Nesterov’s accelerated gradient descent (Nesterov, 1983).
67
+
68
+ # 3 SUBOPTIMALITY OF HEAVY BALL METHOD
69
+
70
+ In this section, we show that there exists linear regression problems where the performance of HB (Algorithm 1) is no better than that of SGD, while ASGD significantly improves upon SGD’s performance. Let us now describe the problem instance.
71
+
72
+ Fix $w ^ { \ast } \in \mathbb { R } ^ { 2 }$ and let $( a , b ) \sim \mathcal { D }$ be a sample from the distribution such that:
73
+
74
+ $$
75
+ \begin{array} { r } { a = \left\{ \begin{array} { l l } { \sigma _ { 1 } \cdot z \cdot e _ { 1 } \mathrm { w . p . ~ } 0 . 5 } \\ { \sigma _ { 2 } \cdot z \cdot e _ { 2 } \mathrm { w . p . ~ } 0 . 5 , } \end{array} \right. \qquad \mathrm { a n d } \qquad b = \left. w ^ { * } , a \right. , } \end{array}
76
+ $$
77
+
78
+ where $e _ { 1 } , e _ { 2 } \in \mathbb { R } ^ { 2 }$ are canonical basis vectors, $\sigma _ { 1 } > \sigma _ { 2 } > 0$ . Let $z$ be a random variable such that E $\left[ z ^ { 2 } \right] = 2$ and $\mathbb { E } \left[ z ^ { 4 } \right] = 2 c \geq 4$ . Hence, we have: $\Xi \left[ ( a ^ { ( i ) } ) ^ { 2 } \right] = \sigma _ { i } ^ { 2 } , \mathbb { E } \left[ ( a ^ { ( i ) } ) ^ { 4 } \right] = c \sigma _ { i } ^ { 4 }$ , for $i = 1 , \dot { 2 }$ . Now, our goal is to minimize:
79
+
80
+ $$
81
+ f ( \boldsymbol { w } ) \stackrel { \mathrm { d e f } } { = } 0 . 5 \cdot \mathbb { E } \left[ \left( \left. \boldsymbol { w } ^ { * } , \boldsymbol { a } \right. - \boldsymbol { b } \right) ^ { 2 } \right] \mathrm { , ~ H e s s i a n \ } \mathbf { H } \stackrel { \mathrm { d e f } } { = } \mathbb { E } \left[ \boldsymbol { a } \boldsymbol { a } ^ { \top } \right] = \left[ \sigma _ { 1 } ^ { 2 } \quad 0 _ { 2 } ^ { 2 } \right] .
82
+ $$
83
+
84
+ Let $\kappa$ and $\tilde { \kappa }$ denote the computational and statistical condition numbers – see Jain et al. (2017) for definitions. For the problem above, we have $\begin{array} { r } { \kappa = \frac { c \sigma _ { 1 } ^ { 2 } } { \sigma _ { 2 } ^ { 2 } } } \end{array}$ and $\tilde { \kappa } = c$ . Then we obtain following convergence rates for SGD and ASGD when applied to the above given problem instance:
85
+
86
+ Input: Initial $w _ { 0 }$ , short step $\delta$ , long step parameter $\kappa \geq 1$ , statistical advantage parameter $\xi \le \sqrt { \kappa }$
87
+ 1: $\bar { w } _ { 0 } w _ { 0 }$ ; $t \gets 0$ /\*Set running average to $\boldsymbol { w _ { 0 } } ^ { * } /$
88
+ 2: α ← 1 − 0.72·ξ /\*Set momentum value\*/
89
+ 3: while $w _ { t }$ not converged do
90
+ 4: $\begin{array} { r } { \bar { w } _ { t + 1 } \alpha \cdot \bar { w } _ { t } + \overline { { ( 1 - \alpha ) \cdot \Big ( w _ { t } - \frac { \kappa \cdot \delta } { 0 . 7 } \cdot \widehat \nabla f _ { t } ( w _ { t } ) \Big ) } } } \end{array}$ /\*Update the running average as a weighted average of previous running average and a long step gradient $^ { * } /$
91
+ 5: $\begin{array} { r } { \overline { { w _ { t + 1 } } } \frac { 0 . 7 } { 0 . 7 + ( 1 - \alpha ) } \cdot ( w _ { t } - \delta \cdot \widehat { \nabla } f _ { t } ( w _ { t } ) ) + \frac { 1 - \alpha } { 0 . 7 + ( 1 - \alpha ) } \cdot \bar { w } _ { t + 1 } } \end{array}$ /\*Update the iterate as weighted average of current running average and short step gradient\*/
92
+ 6: $t \gets t + 1$
93
+
94
+ Output: $w _ { t }$ /\*Return the last iterate\*/
95
+
96
+ Corollary 1 (of Theorem 1 of Jain et al. (2016)). Let $w _ { t } ^ { S G D }$ be the $t ^ { t h }$ iterate of SGD on the above problem with starting point $w _ { 0 }$ and stepsize cσ 2 t . The error of $w _ { t } ^ { S G D }$ can be bounded as,
97
+
98
+ $$
99
+ \mathbb { E } \left[ f \left( w _ { t } ^ { S G D } \right) \right] - f \left( w _ { * } \right) \leq \exp \left( \frac { - t } { \kappa } \right) \left( f \left( w _ { 0 } \right) - f \left( w _ { * } \right) \right) .
100
+ $$
101
+
102
+ On the other hand, ASGD achieves the following superior rate.
103
+
104
+ Corollary 2 (of Theorem 1 of Jain et al. (2017)). Let $w _ { t } ^ { A S G D }$ be the $t ^ { t h }$ iterate of ASGD on the above problem with starting point $w _ { 0 }$ and appropriate parameters. The error of $\dot { w } _ { t } ^ { A S G D }$ can be bounded as,
105
+
106
+ $$
107
+ \mathbb { E } \left[ f \left( w _ { t } ^ { A S G D } \right) \right] - f \left( w _ { * } \right) \le \mathrm { p o l y } ( \kappa ) \exp \left( \frac { - t } { \sqrt { \kappa \tilde { \kappa } } } \right) \left( f \left( w _ { 0 } \right) - f \left( w _ { * } \right) \right) .
108
+ $$
109
+
110
+ Note that for a given problem/input distribution $\tilde { \kappa } = c$ is a constant while $\begin{array} { r } { \kappa = \frac { c \sigma _ { 1 } ^ { 2 } } { \sigma _ { 2 } ^ { 2 } } } \end{array}$ can be arbitrarily large. Note that $\kappa > \tilde { \kappa } = c$ . Hence, ASGD improves upon rate of SGD by a factor of $\sqrt { \kappa }$ . The following proposition, which is the main result of this section, establishes that HB (Algorithm 1) cannot provide a similar improvement over SGD as what ASGD offers. In fact, we show no matter the choice of parameters of HB, its performance does not improve over SGD by more than a constant.
111
+
112
+ Proposition 3. Let $w _ { t } ^ { H B }$ be the $t ^ { t h }$ iterate of HB (Algorithm $I$ ) on the above problem with starting point $w _ { 0 }$ . For any choice of stepsize $\delta$ and momentum $\alpha \in [ 0 , 1 ]$ , $\exists T$ large enough such that $\forall t \geq T$ , we have,
113
+
114
+ $$
115
+ \mathbb { E } \left[ f \left( w _ { t } ^ { H B } \right) \right] - f \left( w _ { * } \right) \ge C ( \kappa , \delta , \alpha ) \cdot \exp \left( \frac { - 5 0 0 t } { \kappa } \right) \left( f \left( w _ { 0 } \right) - f \left( w _ { * } \right) \right) ,
116
+ $$
117
+
118
+ where $C ( \kappa , \delta , \alpha )$ depends on $\kappa , \delta$ and $\alpha$ (but not on $t$ ).
119
+
120
+ Thus, to obtain $\widehat { w }$ s.t. $\| \widehat { \boldsymbol { w } } - \boldsymbol { w } ^ { * } \| \le \epsilon$ , HB requires $\Omega ( \kappa \log { \frac { 1 } { \epsilon } } )$ samples and iterations. On the other hand, ASGD can obtain $\epsilon$ -approximation to $w ^ { * }$ in $\mathcal { O } ( \sqrt { \kappa } \log \kappa \log \frac { 1 } { \epsilon } )$ iterations. We note that the gains offered by ASGD are meaningful when $\kappa > \mathcal { O } ( c )$ (Jain et al., 2017); otherwise, all the algorithms including SGD achieve nearly the same rates (upto constant factors). While we do not prove it theoretically, we observe empirically that for the same problem instance, NAG also obtains nearly same rate as HB and SGD. We conjecture that a lower bound for NAG can be established using a similar proof technique as that of HB (i.e. Proposition 3). We also believe that the constant in the lower bound described in proposition 3 can be improved to some small number $( \leq 5 )$ .
121
+
122
+ # 4 ALGORITHM
123
+
124
+ We will now present and explain an intuitive version of ASGD (pseudo code in Algorithm 3). The algorithm takes three inputs: short step $\delta$ , long step parameter $\kappa$ and statistical advantage parameter $\xi$ . The short step $\delta$ is precisely the same as the step size in SGD, HB or NAG. For convex problems, this scales inversely with the smoothness of the function. The long step parameter $\kappa$ is intended to give an estimate of the ratio of the largest and smallest curvatures of the function; for convex functions, this is just the condition number. The statistical advantage parameter $\xi$ captures trade√ off between statistical and computational condition numbers – in the deterministic case, $\xi = \sqrt { \kappa }$ and ASGD is equivalent to NAG, while in the high stochasticity regime, $\xi$ is much smaller. The algorithm maintains two iterates: descent iterate $w _ { t }$ and a running average $\bar { w } _ { t }$ . The running average is a weighted average of the previous average and a long gradient step from the descent iterate, while the descent iterate is updated as a convex combination of short gradient step from the descent iterate and the running average. The idea is that since the algorithm takes a long step as well as short step and an appropriate average of both of them, it can make progress on different directions at a similar pace. Appendix B shows the equivalence between Algorithm 3 and ASGD as proposed in Jain et al. (2017). Note that the constant 0.7 appearing in Algorithm 3 has no special significance. Jain et al. (2017) require it to be smaller than $\sqrt { 1 / 6 }$ but any constant smaller than 1 seems to work in practice.
125
+
126
+ # 5 EXPERIMENTS
127
+
128
+ We now present our experimental results exploring performance of SGD, HB, NAG and ASGD. Our experiments are geared towards answering the following questions:
129
+
130
+ • Even for linear regression, is the suboptimality of HB restricted to specific distributions in Section 3 or does it hold for more general distributions as well? Is the same true of NAG?
131
+ What is the reason for the superiority of HB and NAG in practice? Is it because momentum methods have better performance that SGD for stochastic gradients or due to minibatching? Does this superiority hold even for small minibatches?
132
+ • How does the performance of ASGD compare to that of SGD, HB and NAG, when training deep networks?
133
+
134
+ Section 5.1 and parts of Section 5.2 address the first two questions. Section 5.2 and 5.3 address Question 2 partially and the last question. We use Matlab to conduct experiments presented in Section 5.1 and use PyTorch (pytorch, 2017) for our deep networks related experiments. Pytorch code implementing the ASGD algorithm can be found at https://github.com/rahulkidambi/AccSGD.
135
+
136
+ # 5.1 LINEAR REGRESSION
137
+
138
+ In this section, we will present results on performance of the four optimization methods (SGD, HB, NAG, and ASGD) for linear regression problems. We consider two different class of linear regression problems, both of them in two dimensions. Given $\kappa$ which stands for condition number, we consider the following two distributions:
139
+
140
+ $a = e _ { 1 }$ w.p. 0.5 and $\textstyle a = { \frac { 2 } { \kappa } } \cdot e _ { 2 }$ with 0.5; $e _ { i }$ is the $i ^ { t h }$
141
+
142
+ Gaussian : $a \in \mathbb { R } ^ { 2 }$ is distributed as a Gaussian random vector with covariance matrix $\left[ { \begin{array} { c c } { 1 } & { 0 } \\ { 0 } & { { \frac { 1 } { \kappa } } } \end{array} } \right] .$
143
+
144
+ We fix a randomly generated $w ^ { \ast } \in \mathbb { R } ^ { 2 }$ and for both the distributions above, we let $b = \langle w ^ { * } , a \rangle$ . We vary $\kappa$ from $\{ \mathbf { \bar { 2 } ^ { 4 } } , 2 ^ { 5 } , . . . , 2 ^ { 1 2 } \}$ and for each $\kappa$ in this set, we run 100 independent runs of all four methods, each for a total of $t = 5 \kappa$ iterations. We define that the algorithm converges if there is no error in the second half (i.e. after $2 . 5 \kappa$ updates) that exceeds the starting error - this is reasonable since we expect geometric convergence of the initial error.
145
+
146
+ Unlike ASGD and SGD, we do not know optimal learning rate and momentum parameters for NAG and HB in the stochastic gradient model. So, we perform a grid search over the values of the learning rate and momentum parameters. In particular, we lay a $1 0 \times 1 0$ grid in $[ 0 , 1 ] \times [ 0 , 1 ]$ for learning rate and momentum and run NAG and HB. Then, for each grid point, we consider the subset of 100 trials that converged and computed the final error using these. Finally, the parameters that yield the minimal error are chosen for NAG and HB, and these numbers are reported. We measure convergence performance of a method using:
147
+
148
+ $$
149
+ { \mathrm { r a t e } } = { \frac { \log ( f ( w _ { 0 } ) ) - \log ( f ( w _ { t } ) ) } { t } } ,
150
+ $$
151
+
152
+ ![](images/3d3b10853538102302f9fd8281848da346ad9275d7a5233ce0344ccdced8ae59.jpg)
153
+ Figure 1: Plot of 1/rate (refer equation (1)) vs condition number $( \kappa )$ for various methods for the linear regression problem. Discrete distribution in the left, Gaussian to the right.
154
+
155
+ Table 1: Slopes (i.e. $\gamma$ ) obtained by fitting a line to the curves in Figure 1. A value of $\gamma$ indicates that the error decays at a rate of exp $\left( { \frac { - t } { \kappa ^ { \gamma } } } \right)$ . A smaller value of $\gamma$ indicates a faster rate of error decay.
156
+
157
+ <table><tr><td>Algorithm</td><td>Slope-discrete</td><td>Slope 1 Gaussian</td></tr><tr><td>SGD</td><td>0.9302</td><td>0.8745</td></tr><tr><td rowspan="3">HB NAG</td><td>0.8522</td><td>0.8769</td></tr><tr><td>0.98</td><td>0.9494</td></tr><tr><td>0.5480</td><td>0.5127</td></tr></table>
158
+
159
+ We compute the rate (1) for all the algorithms with varying condition number $\kappa$ . Given a rate vs $\kappa$ plot for a method, we compute it’s slope (denoted as $\gamma$ ) using linear regression. Table 1 presents the estimated slopes (i.e. $\gamma$ ) for various methods for both the discrete and the Gaussian case. The slope values clearly show that the rate of SGD, HB and NAG have a nearly linear dependence on √ $\kappa$ while that of ASGD seems to scale linearly with $\sqrt { \kappa }$ .
160
+
161
+ # 5.2 DEEP AUTOENCODERS FOR MNIST
162
+
163
+ In this section, we present experimental results on training deep autoencoders for the mnist dataset, and we closely follow the setup of Hinton & Salakhutdinov (2006). This problem is a standard benchmark for evaluating the performance of different optimization algorithms e.g., Martens (2010); Sutskever et al. (2013); Martens $\&$ Grosse (2015); Reddi et al. (2017). The network architecture follows previous work (Hinton & Salakhutdinov, 2006) and is represented as $7 8 4 - 1 0 0 0 - 5 0 0 -$ $2 5 0 - 3 0 - 2 5 0 - 5 0 0 - 1 0 0 0 - 7 8 4$ with the first and last 784 nodes representing the input and output respectively. All hidden/output nodes employ sigmoid activations except for the layer with 30 nodes which employs linear activations and we use MSE loss. Initialization follows the scheme of Martens (2010), also employed in Sutskever et al. (2013); Martens & Grosse (2015). We perform training with two minibatch sizes $- 1$ and 8. The runs with minibatch size of 1 were run for 30 epochs while the runs with minibatch size of 8 were run for 50 epochs. For each of SGD, HB, NAG and ASGD, a grid search over learning rate, momentum and long step parameter (whichever is applicable) was done and best parameters were chosen based on achieving the smallest training error in the same protocol followed by Sutskever et al. (2013). The grid was extended whenever the best parameter fell at the edge of a grid. For the parameters chosen by grid search, we perform 10 runs with different seeds and averaged the results. The results are presented in Figures 2 and 3. Note that the final loss values reported are suboptimal compared to those in published literature e.g., Sutskever et al. (2013); while Sutskever et al. (2013) report results after 750000 updates with a large batch size of 200 (which implies a total of $7 5 0 0 0 0 \times 2 0 0 = 1 5 0 \mathbf { M }$ gradient evaluations), whereas, our results are after 1.8M updates of SGD with a batch size 1 (which is just 1.8M gradient evaluations).
164
+
165
+ Effect of minibatch sizes: While HB and NAG decay the loss faster compared to SGD for a minibatch size of 8 (Figure 2), this superior decay rate does not hold for a minibatch size of 1 (Figure 3). This supports our intuitions from the stochastic linear regression setting, where we demonstrate that HB and NAG are suboptimal in the stochastic first order oracle model.
166
+
167
+ ![](images/e7e9ca2132cb1ddd893c549fd607c122fbf8832557608c7292e2d72b3058de61.jpg)
168
+ Figure 2: Training loss (left) and test loss (right) while training deep autoencoder for mnist with minibatch size 8. Clearly, ASGD matches performance of NAG and outperforms SGD on the test data. HB also outperforms SGD.
169
+
170
+ ![](images/1de51d3d68f2b8fcd7d7f8f74749949493d74864a33ffe1b0da66f947386a0f1.jpg)
171
+ Figure 3: Training loss (left) and test loss (right) while training deep autoencoder for mnist with minibatch size 1. Interestingly, SGD, HB and NAG, all decrease the loss at a similar rate, while ASGD decays at a faster rate.
172
+
173
+ Comparison of ASGD with momentum methods: While ASGD performs slightly better than NAG for batch size 8 in the training error (Figure 2), ASGD decays the error at a faster rate compared to all the three other methods for a batch size of 1 (Figure 3).
174
+
175
+ # 5.3 DEEP RESIDUAL NETWORKS FOR CIFAR-10
176
+
177
+ We will now present experimental results on training deep residual networks (He et al., 2016b) with pre-activation blocks He et al. (2016a) for classifying images in cifar-10 (Krizhevsky & Hinton, 2009); the network we use has 44 layers (dubbed preresnet-44). The code for this section was downloaded from preresnet (2017). One of the most distinct characteristics of this experiment compared to our previous experiments is learning rate decay. We use a validation set based decay scheme, wherein, after every 3 epochs, we decay the learning rate by a certain factor (which we grid search on) if the validation zero one error does not decrease by at least a certain amount (precise numbers are provided in the appendix since they vary across batch sizes). Due to space constraints, we present only a subset of training error plots. Please see Appendix C.3 for some more plots on training errors.
178
+
179
+ Effect of minibatch sizes: Our first experiment tries to understand how the performance of HB and NAG compare with that of SGD and how it varies with minibatch sizes. Figure 4 presents the test zero one error for minibatch sizes of 8 and 128. While training with batch size 8 was done for 40 epochs, with batch size 128, it was done for 120 epochs. We perform a grid search over all parameters for each of these algorithms. See Appendix C.3 for details on the grid search parameters. We observe that final error achieved by SGD, HB and NAG are all very close for both batch sizes. While NAG exhibits a superior rate of convergence compared to SGD and HB for batch size 128, this superior rate of convergence disappears for a batch size of 8.
180
+
181
+ Comparison of ASGD with momentum methods: The next experiment tries to understand how ASGD compares with HB and NAG. The errors achieved by various methods when we do
182
+
183
+ ![](images/db5f311c1e2dbe4b962051b725dbf673899c05a23640369f13b18c9e0f70e473.jpg)
184
+ Figure 4: Test zero one loss for batch size 128 (left), batch size 8 (center) and training function value for batch size 8 (right) for SGD, HB and NAG.
185
+
186
+ ![](images/9082f0ff9ebf68aa4e0752f19fd7b95ba1e73a84b488c3c29ff243cc33fb06fa.jpg)
187
+ Figure 5: Test zero one loss for batch size 128 (left), batch size 8 (center) and training function value for batch size 8 (right) for ASGD compared to HB. In the above plots, both ASGD and ASGD-HbParams refer to ASGD run with the learning rate and decay schedule of HB. ASGD-Fully-Optimized refers to ASGD where learning rate and decay schedule were also selected by grid search.
188
+
189
+ grid search over all parameters are presented in Table 2. Note that the final test errors for batch size 128 are better than those for batch size 8 since the former was run for 120 epochs while the latter was run only for 40 epochs (due to time constraints).
190
+
191
+ <table><tr><td>Algorithm</td><td>Final test error-batch size 128</td><td>Final test error-batch size 8</td></tr><tr><td>SGD</td><td>8.32± 0.21</td><td>9.57±0.18</td></tr><tr><td>HB</td><td>7.98 ± 0.19</td><td>9.28± 0.25</td></tr><tr><td>NAG</td><td>7.63 ± 0.18</td><td>9.07 ±0.18</td></tr><tr><td>ASGD</td><td>7.23 ± 0.22</td><td>8.52 ± 0.16</td></tr></table>
192
+
193
+ Table 2: Final test errors achieved by various methods for batch sizes of 128 and 8. The hyperparameters have been chosen by grid search.
194
+
195
+ While the final error achieved by ASGD is similar/favorable compared to all other methods, we are also interested in understanding whether ASGD has a superior convergence speed. For this experiment, we need to address the issue of differing learning rates used by various algorithms and different iterations where they decay learning rates. So, for each of HB and NAG, we choose the learning rate and decay factors by grid search, use these values for ASGD and do grid search only over long step parameter $\kappa$ and momentum $\alpha$ for ASGD. The results are presented in Figures 5 and 6. For batch size 128, ASGD decays error at a faster rate compared to both HB and NAG. For batch size 8, while we see a superior convergence of ASGD compared to NAG, we do not see this superiority over HB. The reason for this turns out to be that the learning rate for HB, which we also use for ASGD, turns out to be quite suboptimal for ASGD. So, for batch size 8, we also compare fully optimized (i.e., grid search over learning rate as well) ASGD with HB. The superiority of ASGD over HB is clear from this comparison. These results suggest that ASGD decays error at a faster rate compared to HB and NAG across different batch sizes.
196
+
197
+ # 6 RELATED WORK
198
+
199
+ First order oracle methods: The primary method in this family is Gradient Descent (GD) (Cauchy, 1847). As mentioned previously, GD is suboptimal for smooth convex optimization (Nesterov,
200
+
201
+ ![](images/1520b13e594816b4bd1f8bfe08d8102111f7964499e85c5692f7d19723eb2535.jpg)
202
+ Figure 6: Test zero one loss for batch size 128 (left), batch size 8 (center) and training function value for batch size 8 (right) for ASGD compared to NAG. In the above plots, ASGD was run with the learning rate and decay schedule of NAG. Other parameters were selected by grid search.
203
+
204
+ 2004), and this is addressed using momentum methods such as the Heavy Ball method (Polyak,
205
+ 1964) (for quadratics), and Nesterov’s Accelerated gradient descent (Nesterov, 1983).
206
+
207
+ Stochastic first order methods and noise stability: The simplest method employing the SFO is SGD (Robbins & Monro, 1951); the effectiveness of SGD has been immense, and its applicability goes well beyond optimizing convex objectives. Accelerating SGD is a tricky proposition given the instability of fast gradient methods in dealing with noise, as evidenced by several negative results which consider statistical (Proakis, 1974; Polyak, 1987; Roy & Shynk, 1990), numerical (Paige, 1971; Greenbaum, 1989) and adversarial errors (d’Aspremont, 2008; Devolder et al., 2014). A result of Jain et al. (2017) developed the first provably accelerated SGD method for linear regression which achieved minimax rates, inspired by a method of Nesterov (2012b). Schemes of Ghadimi & Lan (2012; 2013); Dieuleveut et al. (2016), which indicate acceleration is possible with noisy gradients do not hold in the SFO model satisfied by algorithms that are run in practice (see Jain et al. (2017) for more details).
208
+
209
+ While HB (Polyak, 1964) and NAG (Nesterov, 1983) are known to be effective in case of exact first order oracle, for the SFO, the theoretical performance of HB and NAG is not well understood.
210
+
211
+ Understanding Stochastic Heavy Ball: Understanding HB’s performance with inexact gradients has been considered in efforts spanning several decades, in many communities like controls, optimization and signal processing. Polyak (1987) considered HB with noisy gradients and concluded that the improvements offered by HB with inexact gradients vanish unless strong assumptions on the inexactness was considered; an instance of this is when the variance of inexactness decreased as the iterates approach the minimizer. Proakis (1974); Roy & Shynk (1990); Sharma et al. (1998) suggest that the improved non-asymptotic rates offered by stochastic HB arose at the cost of worse asymptotic behavior. We resolve these unquantified improvements on rates as being just constant factors over SGD, in stark contrast to the gains offered by ASGD. Loizou & Richtarik ´ (2017) state their method as Stochastic HB but require stochastic gradients that nearly behave as exact gradients; indeed, their rates match that of the standard HB method (Polyak, 1964). Such rates are not information theoretically possible (see Jain et al. (2017)), especially with a batch size of 1 or even with constant sized minibatches.
212
+
213
+ Accelerated and Fast Methods for finite-sums: There have been developments pertaining to faster methods for finite-sums (also known as offline stochastic optimization): amongst these are methods such as SDCA (Shalev-Shwartz & Zhang, 2012), SAG (Roux et al., 2012), SVRG (Johnson & Zhang, 2013), SAGA (Defazio et al., 2014), which offer linear convergence rates for strongly convex finite-sums, improving over SGD’s sub-linear rates (Rakhlin et al., 2012). These methods have been improved using accelerated variants (Shalev-Shwartz & Zhang, 2014; Frostig et al., 2015a; Lin et al., 2015; Defazio, 2016; Allen-Zhu, 2016). Note that these methods require storing the entire training set in memory and taking multiple passes over the same for guaranteed progress. Furthermore, these methods require computing a batch gradient or require memory requirements (typically $\Omega ( \lfloor$ training data points|)). For deep learning problems, data augmentation is often deemed necessary for achieving good performance; this implies computing quantities such as batch gradient (or storage necessities) over this augmented dataset is often infeasible. Such requirements are mitigated by the use of simple streaming methods such as SGD, ASGD, HB, NAG. For other technical distinctions between the offline and online stochastic methods refer to Frostig et al. (2015b).
214
+
215
+ Practical methods for training deep networks: Momentum based methods employed with stochastic gradients (Sutskever et al., 2013) have become standard and very popular in practice. These schemes tend to outperform standard SGD on several important practical problems. As previously mentioned, we attribute this improvement to effect of mini-batching rather than improvement offered by HB or NAG in the SFO model. Schemes such as Adagrad (Duchi et al., 2011), RMSProp (Tieleman & Hinton, 2012), Adam (Kingma & Ba, 2014) represent an important and useful class of algorithms. The advantages offered by these methods are orthogonal to the advantages offered by fast gradient methods; it is an important direction to explore augmenting these methods with ASGD as opposed to standard HB or NAG based acceleration schemes.
216
+
217
+ Chaudhari et al. (2017) proposed Entropy-SGD, which is an altered objective that adds a local strong convexity term to the actual empirical risk objective, with an aim to improve generalization. However, we do not understand convergence rates for convex problems or the generalization ability of this technique in a rigorous manner. Chaudhari et al. (2017) propose to use SGD in their procedure but mention that they employ the HB/NAG method in their implementation for achieving better performance. Naturally, we can use ASGD in this context. Path normalized SGD (Neyshabur et al., 2015) is a variant of SGD that alters the metric on which the weights are optimized. As noted in their paper, path normalized SGD could be improved using HB/NAG (or even the ASGD method).
218
+
219
+ # 7 CONCLUSIONS AND FUTURE DIRECTIONS
220
+
221
+ In this paper, we show that the performance gain of HB over SGD in stochastic setting is attributed to mini-batching rather than the algorithm’s ability to accelerate with stochastic gradients. Concretely, we provide a formal proof that for several easy problem instances, HB does not outperform SGD despite large condition number of the problem; we observe this trend for NAG in our experiments. In contrast, ASGD (Jain et al., 2017) provides significant improvement over SGD for these problem instances. We observe similar trends when training a resnet on cifar-10 and an autoencoder on mnist. This work motivates several directions such as understanding the behavior of ASGD on domains such as NLP, and developing automatic momentum tuning schemes (Zhang et al., 2017).
222
+
223
+ # ACKNOWLEDGMENTS
224
+
225
+ Sham Kakade acknowledges funding from NSF Awards CCF-1703574 and CCF-1740551.
226
+
227
+ # REFERENCES
228
+
229
+ Zeyuan Allen-Zhu. Katyusha: The first direct acceleration of stochastic gradient methods. CoRR, abs/1603.05953, 2016.
230
+
231
+ Leon Bottou and Olivier Bousquet. The tradeoffs of large scale learning. In ´ NIPS 20, 2007.
232
+
233
+ Louis Augustin Cauchy. Methode g ´ en´ erale pour la r ´ esolution des syst ´ emes d’ ´ equations simultanees. ´ C. R. Acad. Sci. Paris, 1847.
234
+
235
+ 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. CoRR, abs/1611.01838, 2017.
236
+
237
+ Alexandre d’Aspremont. Smooth optimization with approximate gradient. SIAM Journal on Optimization, 19(3):1171–1183, 2008.
238
+
239
+ Aaron Defazio. A simple practical accelerated method for finite sums. Advances in Neural Information Processing Systems 29 (NIPS 2016), 2016.
240
+
241
+ Aaron Defazio, Francis R. Bach, and Simon Lacoste-Julien. SAGA: A fast incremental gradient method with support for non-strongly convex composite objectives. In NIPS 27, 2014.
242
+
243
+ Olivier Devolder, Franccois Glineur, and Yurii E. Nesterov. First-order methods of smooth convex optimization with inexact oracle. Mathematical Programming, 146:37–75, 2014.
244
+
245
+ Aymeric Dieuleveut, Nicolas Flammarion, and Francis R. Bach. Harder, better, faster, stronger convergence rates for least-squares regression. CoRR, abs/1602.05419, 2016.
246
+
247
+ John C. Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research, 12:2121–2159, 2011.
248
+
249
+ Roy Frostig, Rong Ge, Sham Kakade, and Aaron Sidford. Un-regularizing: approximate proximal point and faster stochastic algorithms for empirical risk minimization. In ICML, 2015a.
250
+
251
+ Roy Frostig, Rong Ge, Sham M. Kakade, and Aaron Sidford. Competing with the empirical risk minimizer in a single pass. In COLT, 2015b.
252
+
253
+ Saeed Ghadimi and Guanghui Lan. Optimal stochastic approximation algorithms for strongly convex stochastic composite optimization i: A generic algorithmic framework. SIAM Journal on Optimization, 2012.
254
+
255
+ Saeed Ghadimi and Guanghui Lan. Optimal stochastic approximation algorithms for strongly convex stochastic composite optimization, ii: shrinking procedures and optimal algorithms. SIAM Journal on Optimization, 2013.
256
+
257
+ Anne Greenbaum. Behavior of slightly perturbed lanczos and conjugate-gradient recurrences. Linear Algebra and its Applications, 1989.
258
+
259
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In ECCV (4), Lecture Notes in Computer Science, pp. 630–645. Springer, 2016a.
260
+
261
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, pp. 770–778, 2016b.
262
+
263
+ Geoffrey E Hinton and Ruslan R Salakhutdinov. Reducing the dimensionality of data with neural networks. science, 313(5786):504–507, 2006.
264
+
265
+ Prateek Jain, Sham M Kakade, Rahul Kidambi, Praneeth Netrapalli, and Aaron Sidford. Parallelizing stochastic approximation through mini-batching and tail-averaging. arXiv preprint arXiv:1610.03774, 2016.
266
+
267
+ Prateek Jain, Sham M Kakade, Rahul Kidambi, Praneeth Netrapalli, and Aaron Sidford. Accelerating stochastic gradient descent. arXiv preprint arXiv:1704.08227, 2017.
268
+
269
+ Rie Johnson and Tong Zhang. Accelerating stochastic gradient descent using predictive variance reduction. In NIPS 26, 2013.
270
+
271
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014.
272
+
273
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
274
+
275
+ Hongzhou Lin, Julien Mairal, and Za¨ıd Harchaoui. A universal catalyst for first-order optimization. In NIPS, 2015.
276
+
277
+ Nicolas Loizou and Peter Richtarik. Linearly convergent stochastic heavy ball method for minimiz- ´ ing generalization error. 2017.
278
+
279
+ James Martens. Deep learning via hessian-free optimization. In International conference on machine learning, 2010.
280
+
281
+ James Martens and Roger Grosse. Optimizing neural networks with kronecker-factored approximate curvature. In International conference on machine learning, 2015.
282
+
283
+ Yurii Nesterov. A method of solving a convex programming problem with convergence rate o (1/k2). In Soviet Mathematics Doklady, volume 27, pp. 372–376, 1983.
284
+
285
+ Yurii Nesterov. Gradient methods for minimizing composite functions. Mathematical Programming Series B, 2012a.
286
+
287
+ Yurii E. Nesterov. Introductory lectures on convex optimization: A basic course, volume 87 of Applied Optimization. Kluwer Academic Publishers, 2004.
288
+
289
+ Yurii E. Nesterov. Efficiency of coordinate descent methods on huge-scale optimization problems. SIAM Journal on Optimization, 22(2):341–362, 2012b.
290
+
291
+ Behnam Neyshabur, Ruslan Salakhutdinov, and Nathan Srebro. Path-sgd: Path-normalized optimization in deep neural networks. CoRR, abs/1506.02617, 2015.
292
+
293
+ Christopher C. Paige. The computation of eigenvalues and eigenvectors of very large sparse matrices. PhD Thesis, University of London, 1971.
294
+
295
+ Boris T Polyak. Some methods of speeding up the convergence of iteration methods. USSR Computational Mathematics and Mathematical Physics, 4(5):1–17, 1964.
296
+
297
+ Boris T. Polyak. Introduction to Optimization. Optimization Software, 1987.
298
+
299
+ preresnet. Preresnet-44 for cifar-10. https://github.com/D-X-Y/ResNeXt-DenseNet, 2017. Accessed: 2017-10-25.
300
+
301
+ John G. Proakis. Channel identification for high speed digital communications. IEEE Transactions on Automatic Control, 1974.
302
+
303
+ pytorch. Pytorch. https://github.com/pytorch, 2017. Accessed: 2017-10-25.
304
+
305
+ Alexander Rakhlin, Ohad Shamir, and Karthik Sridharan. Making gradient descent optimal for strongly convex stochastic optimization. In ICML, 2012.
306
+
307
+ Sashank Reddi, Manzil Zaheer, Suvrit Sra, Barnabas Poczos, Francis Bach, Ruslan Salakhutdinov, and Alexander Smola. A generic approach for escaping saddle points. arXiv preprint arXiv:1709.01434, 2017.
308
+
309
+ Herbert Robbins and Sutton Monro. A stochastic approximation method. The Annals of Mathematical Statistics, vol. 22, 1951.
310
+
311
+ Nicolas Le Roux, Mark Schmidt, and Francis R. Bach. A stochastic gradient method with an exponential convergence rate for strongly-convex optimization with finite training sets. In NIPS 25, 2012.
312
+
313
+ Sumit Roy and John J. Shynk. Analysis of the momentum lms algorithm. IEEE Transactions on Acoustics, Speech and Signal Processing, 1990.
314
+
315
+ Shai Shalev-Shwartz and Tong Zhang. Stochastic dual coordinate ascent methods for regularized loss minimization. CoRR, abs/1209.1873, 2012.
316
+
317
+ Shai Shalev-Shwartz and Tong Zhang. Accelerated proximal stochastic dual coordinate ascent for regularized loss minimization. In ICML, 2014.
318
+
319
+ Rajesh Sharma, William A. Sethares, and James A. Bucklew. Analysis of momentum adaptive filtering algorithms. IEEE Transactions on Signal Processing, 1998.
320
+
321
+ Ilya Sutskever, James Martens, George Dahl, and Geoffrey Hinton. On the importance of initialization and momentum in deep learning. In International conference on machine learning, pp. 1139–1147, 2013.
322
+
323
+ Tijmen Tieleman and Geoffrey Hinton. Lecture 6.5-rmsprop: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural networks for machine learning, 2012.
324
+
325
+ Jian Zhang, Ioannis Mitliagkas, and Christopher R. Yellowfin and the art of momentum tuning. CoRR, abs/1706.03471, 2017.
326
+
327
+ # A SUBOPTIMALITY OF HB: PROOF OF PROPOSITION 3
328
+
329
+ Before proceeding to the proof, we introduce some additional notation. Let $\pmb { \theta } _ { t + 1 } ^ { ( j ) }$ denote the concatenated and centered estimates in the $j ^ { \mathrm { t h } }$ direction for $j = 1 , 2$ .
330
+
331
+ $$
332
+ \begin{array} { r } { \pmb { \theta } _ { t + 1 } ^ { ( j ) } \stackrel { \mathrm { d e f } } { = } \left[ \mathbf { w } _ { t + 1 } ^ { ( j ) } - ( \mathbf { w } ^ { * } ) ^ { ( j ) } \right] , \quad j = 1 , 2 . } \end{array}
333
+ $$
334
+
335
+ Since the distribution over $x$ is such that the coordinates are decoupled, we see that $\pmb { \theta } _ { t + 1 } ^ { ( j ) }$ can be written in terms of $\pmb { \theta } _ { t } ^ { ( j ) }$ as:
336
+
337
+ $$
338
+ \pmb { \theta } _ { t + 1 } ^ { ( j ) } = \widehat { \mathbf { A } } _ { t + 1 } ^ { ( j ) } \pmb { \theta } _ { t } ^ { ( j ) } , \mathrm { w i t h } \widehat { \mathbf { A } } _ { t + 1 } ^ { ( j ) } = \left[ \frac { 1 + \alpha - \delta ( a _ { t + 1 } ^ { ( j ) } ) ^ { 2 } } { 1 } - \alpha \right] .
339
+ $$
340
+
341
+ Let $\Phi _ { t + 1 } ^ { ( j ) } \ { \stackrel { \mathrm { d e f } } { = } } \ \mathbb { E } \left[ \pmb { \theta } _ { t + 1 } ^ { ( j ) } \otimes \pmb { \theta } _ { t + 1 } ^ { ( j ) } \right]$ denote the covariance matrix of $\pmb { \theta } _ { t + 1 } ^ { ( j ) }$ . We have $\Phi _ { t + 1 } ^ { ( j ) } = B ^ { ( j ) } \Phi _ { t } ^ { ( j ) }$ with, $B ^ { ( j ) }$ defined as
342
+
343
+ $$
344
+ \begin{array} { r l } { \mathfrak { L } ( \mathfrak { j } ) \overset { \mathrm { d e f } } { = } \left[ \begin{array} { c c c c } { \mathbb { E } \left[ ( 1 + \alpha - \delta ( a ^ { ( j ) } ) ^ { 2 } ) ^ { 2 } \right] } & { \mathbb { E } \left[ - \alpha ( 1 + \alpha - \delta ( a ^ { ( j ) } ) ^ { 2 } ) \right] } & { \mathbb { E } \left[ - \alpha ( 1 + \alpha - \delta ( a ^ { ( j ) } ) ^ { 2 } \right] } & { \alpha ^ { 2 } } \\ { \mathbb { E } \left[ ( 1 + \alpha - \delta ( a ^ { ( j ) } ) ^ { 2 } ) \right] } & { 0 } & { - \alpha } & { 0 } \\ { \mathbb { E } \left[ ( 1 + \alpha - \delta ( a ^ { ( j ) } ) ^ { 2 } ) \right] } & { - \alpha } & { 0 } & { 0 } \\ { 1 } & { 0 } & { 0 } & { 0 } \end{array} \right] , } & { } \\ { = \left[ \begin{array} { c c c c } { ( 1 + \alpha - \delta \sigma _ { j } ^ { 2 } ) ^ { 2 } + ( c - 1 ) ( \delta \sigma _ { j } ^ { 2 } ) ^ { 2 } } & { - \alpha ( 1 + \alpha - \delta \sigma _ { j } ^ { 2 } ) } & { - \alpha ( 1 + \alpha - \delta \sigma _ { j } ^ { 2 } ) } & { \alpha ^ { 2 } } \\ { ( 1 + \alpha - \delta \sigma _ { j } ^ { 2 } ) } & { 0 } & { - \alpha } & { 0 } \\ { ( 1 + \alpha - \delta \sigma _ { j } ^ { 2 } ) } & { - \alpha } & { 0 } & { 0 } \\ { 1 } & { 0 } & { 0 } & { 0 } \end{array} \right] . } \end{array}
345
+ $$
346
+
347
+ We prove Proposition 3 by showing that for any choice of stepsize and momentum, either of the two holds:
348
+
349
+ • $B ^ { ( 1 ) }$ has an eigenvalue larger than 1, or, • the largest eigenvalue of $B ^ { ( 2 ) }$ is greater than $1 - { \frac { 5 0 0 } { \kappa } }$ .
350
+
351
+ This is formalized in the following two lemmas.
352
+
353
+ Lemma 4. If the stepsize $\delta$ is such that $\delta \sigma _ { 1 } ^ { 2 } \geq \frac { 2 \left( 1 - \alpha ^ { 2 } \right) } { c + ( c - 2 ) \alpha }$ , then $\boldsymbol { B } ^ { ( 1 ) }$ has an eigenvalue $\geq 1$
354
+
355
+ Lemma 5. If the stepsize $\delta$ is such that $\begin{array} { r } { \delta \sigma _ { 1 } ^ { 2 } < \frac { 2 \left( 1 - \alpha ^ { 2 } \right) } { c + ( c - 2 ) \alpha } } \end{array}$ , then $B ^ { ( 2 ) }$ has an eigenvalue of magnitude $\textstyle { \ge } 1 - { \frac { 5 0 0 } { \kappa } }$
356
+
357
+ Given this notation, we can now consider the $j ^ { t h }$ dimension without the superscripts; when needed, they will be made clear in the exposition. Denoting $x \stackrel { \mathrm { d e f } } { = } \delta \sigma ^ { 2 }$ and $t \stackrel { \mathrm { d e f } } { = } 1 + \alpha - x$ , we have:
358
+
359
+ $$
360
+ \begin{array} { r } { B = \left[ \begin{array} { c c c c } { t ^ { 2 } + ( c - 1 ) x ^ { 2 } } & { - \alpha t } & { - \alpha t } & { \alpha ^ { 2 } } \\ { t } & { 0 } & { - \alpha } & { 0 } \\ { t } & { - \alpha } & { 0 } & { 0 } \\ { 1 } & { 0 } & { 0 } & { 0 } \end{array} \right] } \end{array}
361
+ $$
362
+
363
+ # A.1 PROOF
364
+
365
+ The analysis goes via computation of the characteristic polynomial of $\boldsymbol { B }$ and evaluating it at different values to obtain bounds on its roots.
366
+
367
+ Lemma 6. The characteristic polynomial of $\boldsymbol { B }$ is:
368
+
369
+ $$
370
+ D ( z ) = z ^ { 4 } - ( t ^ { 2 } + ( c - 1 ) x ^ { 2 } ) z ^ { 3 } + ( 2 \alpha t ^ { 2 } - 2 \alpha ^ { 2 } ) z ^ { 2 } + ( - t ^ { 2 } + ( c - 1 ) x ^ { 2 } ) \alpha ^ { 2 } z + \alpha ^ { 4 } .
371
+ $$
372
+
373
+ Proof. We first begin by writing out the expression for the determinant:
374
+
375
+ $$
376
+ D e t ( B - z { \mathcal { Z } } ) = \left| \begin{array} { c c c c } { t ^ { 2 } + ( c - 1 ) x ^ { 2 } - z } & { - \alpha t } & { - \alpha t } & { \alpha ^ { 2 } } \\ { t } & { - z } & { - \alpha } & { 0 } \\ { t } & { - \alpha } & { - z } & { 0 } \\ { 1 } & { 0 } & { 0 } & { - z } \end{array} \right| .
377
+ $$
378
+
379
+ expanding along the first column, we have:
380
+
381
+ $$
382
+ \begin{array} { r l } & { \gamma _ { e t } ( B - z \mathcal { Z } ) = ( t ^ { 2 } + ( c - 1 ) x ^ { 2 } - z ) ( \alpha ^ { 2 } z - z ^ { 3 } ) - t ( - \alpha t z ^ { 2 } + \alpha ^ { 2 } t z ) + t ( - \alpha t ( \alpha z ) + z \cdot \alpha t z ) - ( z \cdot \alpha ^ { 2 } z - \alpha t \mathcal { Z } ) } \\ & { \qquad = ( t ^ { 2 } + ( c - 1 ) x ^ { 2 } - z ) ( \alpha ^ { 2 } z - z ^ { 3 } ) - 2 t ( \alpha ^ { 2 } t z - \alpha t z ^ { 2 } ) - ( \alpha ^ { 2 } z ^ { 2 } - \alpha ^ { 4 } ) . } \end{array}
383
+ $$
384
+
385
+ Expanding the terms yields the expression in the lemma.
386
+
387
+ The next corollary follows by some simple arithmetic manipulations.
388
+
389
+ Corollary 7. Substituting $z = 1 - \tau$ in the characteristic equation of Lemma $6$ , we have:
390
+
391
+ $$
392
+ \begin{array} { r l } & { D ( 1 - \tau ) = \tau ^ { 4 } + \tau ^ { 3 } ( - 4 + t ^ { 2 } + ( c - 1 ) x ^ { 2 } ) + \tau ^ { 2 } ( 6 - 3 t ^ { 2 } - 3 ( c - 1 ) x ^ { 2 } - 2 \alpha ^ { 2 } + 2 \alpha t ^ { 2 } ) } \\ & { \qquad + \tau ( - 4 + 3 t ^ { 2 } + 3 ( c - 1 ) x ^ { 2 } + 4 \alpha ^ { 2 } - 4 \alpha t ^ { 2 } - ( c - 1 ) x ^ { 2 } \alpha ^ { 2 } + t ^ { 2 } \alpha ^ { 2 } ) } \\ & { \qquad + ( 1 - t ^ { 2 } - ( c - 1 ) x ^ { 2 } - 2 \alpha ^ { 2 } + 2 \alpha t ^ { 2 } + ( c - 1 ) x ^ { 2 } \alpha ^ { 2 } - t ^ { 2 } \alpha ^ { 2 } + \alpha ^ { 4 } ) } \\ & { \qquad = \tau ^ { 4 } + \tau ^ { 3 } [ - ( 3 + \alpha ) ( 1 - \alpha ) - 2 x ( 1 + \alpha ) + c x ^ { 2 } ] } \\ & { \qquad + \tau ^ { 2 } [ ( 3 - 4 \alpha - \alpha ^ { 2 } + 2 \alpha ^ { 3 } ) - 2 x ( 1 + \alpha ) ( 2 \alpha - 3 ) + x ^ { 2 } ( 2 \alpha - 3 c ) ] } \\ & { \qquad + \tau [ - ( 1 - \alpha ) ^ { 2 } ( 1 - \alpha ^ { 2 } ) - 2 x ( 3 - \alpha ) ( 1 - \alpha ^ { 2 } ) + x ^ { 2 } ( 3 c - 4 \alpha + ( 2 - c ) \alpha ^ { 2 } ) ] } \\ & { \qquad + x ( 1 - \alpha ) [ 2 ( 1 - \alpha ^ { 2 } ) - x ( c + ( c - 2 ) \alpha ) ] . } \end{array}
393
+ $$
394
+
395
+ Proof of Lemma 4. The first observation necessary to prove the lemma is that the characteristic polynomial $D ( z )$ approaches $\infty$ as $z \infty$ , i.e., $\begin{array} { r } { \operatorname* { l i m } _ { z \infty } D ( z ) = + \infty } \end{array}$ .
396
+
397
+ Next, we evaluate the characteristic polynomial at 1, i.e. compute $D ( 1 )$ . This follows in a straightforward manner from corollary (7) by substituting $\tau = 0$ in equation (2), and this yields,
398
+
399
+ $$
400
+ D ( 1 ) = ( 1 - \alpha ) x \cdot \bigg ( 2 ( 1 - \alpha ^ { 2 } ) - x ( 1 - \alpha ) - ( c - 1 ) x ( 1 + \alpha ) \bigg ) .
401
+ $$
402
+
403
+ As $\alpha < 1$ , $x = \delta \sigma ^ { 2 } > 0$ , we have the following by setting $D ( 1 ) \leq 0$ and solving for $x$ :
404
+
405
+ $$
406
+ x \geq \frac { 2 ( 1 - \alpha ^ { 2 } ) } { c + ( c - 2 ) \alpha } .
407
+ $$
408
+
409
+ Since $D ( 1 ) \leq 0$ and $D ( z ) \geq 0$ as $z \infty$ , there exists a root of $D ( \cdot )$ which is $\geq 1$ .
410
+
411
+ Remark 8. The above characterization is striking in the sense that for any $c > 1$ , increasing the momentum parameter $\alpha$ naturally requires the reduction in the step size $\delta$ to permit the convergence of the algorithm, which is not observed when fast gradient methods are employed in deterministic optimization. For instance, in the case of deterministic optimization, setting $c = 1$ yields $\delta \sigma _ { 1 } ^ { 2 } <$ $2 ( 1 + \alpha )$ . On the other hand, when employing the stochastic heavy ball method with $x ^ { ( j ) } = 2 \sigma _ { j } ^ { 2 }$ , we have the condition that $c = 2$ , and this implies, $\begin{array} { r } { \delta \sigma _ { 1 } ^ { 2 } < \frac { 2 ( 1 - \alpha ^ { 2 } ) } { 2 } = 1 - \alpha ^ { 2 } } \end{array}$ .
412
+
413
+ We now prove Lemma 5. We first consider the large momentum setting.
414
+
415
+ Lemma 9. When the momentum parameter $\alpha$ is set such that $1 - 4 5 0 / \kappa \leq \alpha \leq 1 , ~ $ $\boldsymbol { B }$ has an eigenvalue of magnitude ≥ 1 − 450κ .
416
+
417
+ Proof. This follows easily from the fact that $\begin{array} { r } { \operatorname* { d e t } ( \boldsymbol { B } ) = \alpha ^ { 4 } = \prod _ { j = 1 } ^ { 4 } \lambda _ { j } ( \boldsymbol { B } ) \le ( \lambda _ { \operatorname* { m a x } } ( \boldsymbol { B } ) ) ^ { 4 } } \end{array}$ , thus implying $1 - 4 5 0 / \kappa \leq \alpha \leq | \lambda _ { \mathrm { m a x } } ( \beta ) |$ .
418
+
419
+ Remark 10. Note that the above lemma holds for any value of the learning rate $\delta$ , and holds for every eigen direction of $\mathbf { H }$ . Thus, for “large” values of momentum, the behavior of stochastic heavy ball does degenerate to the behavior of stochastic gradient descent.
420
+
421
+ We now consider the setting where momentum is bounded away from 1.
422
+
423
+ Corollary 11. Consider $B ^ { ( 2 ) }$ , by substituting $= l / \kappa , x = \delta \lambda _ { \mathrm { m i n } } = c ( \delta \sigma _ { 1 } ^ { 2 } ) / \kappa$ in equation (2) and accumulating terms in varying powers of $1 / \kappa$ , we obtain:
424
+
425
+ $$
426
+ \begin{array} { l } { { G ( l ) \stackrel { d e f } { = } \frac { c ^ { 3 } ( \delta \sigma _ { 1 } ^ { 2 } ) ^ { 2 } l ^ { 3 } } { \kappa ^ { 5 } } + l ^ { 4 } - 2 c ( \delta \sigma _ { 1 } ^ { 2 } ) l ^ { 3 } ( 1 + \alpha ) + ( 2 \alpha - 3 c ) c ^ { 2 } ( \delta \sigma _ { 1 } ^ { 2 } ) ^ { 2 } l ^ { 2 } } } \\ { { \ + \ \frac { - ( 3 + \alpha ) ( 1 - \alpha ) l ^ { 3 } - 2 ( 1 + \alpha ) ( 2 \alpha - 3 ) c ( \delta \sigma _ { 1 } ^ { 2 } ) l ^ { 2 } + ( 3 c - 4 \alpha + ( 2 - c ) \alpha ^ { 2 } ) c ^ { 2 } ( \delta \sigma _ { 1 } ^ { 2 } ) ^ { 2 } l ^ { 3 } } { \kappa ^ { 3 } } } } \\ { { \ + \ \frac { ( 3 - 4 \alpha - \alpha ^ { 2 } + 2 \alpha ^ { 3 } ) l ^ { 2 } - 2 c ( \delta \sigma _ { 1 } ^ { 2 } ) l ( 3 - \alpha ) ( 1 - \alpha ^ { 2 } ) - c ^ { 2 } ( \delta \sigma _ { 1 } ^ { 2 } ) ^ { 2 } ( 1 - \alpha ) ( c + ( c - 2 ) \alpha ) } { \kappa ^ { 2 } } } } \\ { { \ + \ \frac { - ( 1 - \alpha ) ^ { 2 } ( 1 - \alpha ^ { 2 } ) l + 2 c ( \delta \sigma _ { 1 } ^ { 2 } ) ( 1 - \alpha ) ( 1 - \alpha ^ { 2 } ) } { \kappa } } } \end{array}
427
+ $$
428
+
429
+ Lemma 12. Let $2 < c < 3 0 0 0$ , $\textstyle 0 \leq \alpha \leq 1 - { \frac { 4 5 0 } { \kappa } }$ , $\begin{array} { r } { l = 1 + \frac { 2 c ( \delta \sigma _ { 1 } ^ { 2 } ) } { 1 - \alpha } } \end{array}$ 2c(δσ21) . Then, G(l) ≤ 0.
430
+
431
+ Proof. Since $\begin{array} { r } { ( \delta \sigma _ { 1 } ^ { 2 } ) \le \frac { 2 ( 1 - \alpha ^ { 2 } ) } { c + ( c - 2 ) \alpha } } \end{array}$ , this implies $\begin{array} { r } { \frac { ( \delta \sigma _ { 1 } ^ { 2 } ) } { 1 - \alpha } \leq \frac { 2 ( 1 + \alpha ) } { c + ( c - 2 ) \alpha } \leq \frac { 4 } { c } } \end{array}$ , thus implying, $1 \leq l \leq 9$
432
+
433
+ Substituting the value of $l$ in equation (3), the coefficient of $\mathcal { O } ( 1 / \kappa )$ is $- ( 1 - \alpha ) ^ { 3 } ( 1 + \alpha )$ .
434
+
435
+ We will bound this term along with $( 3 - 4 \alpha - \alpha ^ { 2 } + 2 \alpha ^ { 3 } ) l ^ { 2 } / \kappa ^ { 2 } = ( 1 - \alpha ) ^ { 2 } ( 3 + 2 \alpha ) l ^ { 2 } / \kappa ^ { 2 }$ to obtain:
436
+
437
+ $$
438
+ \begin{array} { r l } & { \frac { - ( 1 - \alpha ) ^ { 3 } ( 1 + \alpha ) } { \kappa } + \frac { ( 1 - \alpha ) ^ { 2 } ( 3 + 2 \alpha ) l ^ { 2 } } { \kappa ^ { 2 } } \leq \frac { - ( 1 - \alpha ) ^ { 3 } ( 1 + \alpha ) } { \kappa } + \frac { 4 0 5 ( 1 - \alpha ) ^ { 2 } } { \kappa ^ { 2 } } } \\ & { \qquad \leq \frac { ( 1 - \alpha ) ^ { 2 } } { \kappa } \bigg ( \frac { 4 0 5 } { \kappa } - ( 1 - \alpha ^ { 2 } ) \bigg ) } \\ & { \qquad \leq \frac { ( 1 - \alpha ) ^ { 2 } } { \kappa } \bigg ( \frac { 4 0 5 } { \kappa } - ( 1 - \alpha ) \bigg ) \leq - \frac { 4 5 \cdot 4 5 0 ^ { 2 } } { \kappa ^ { 4 } } , } \end{array}
439
+ $$
440
+
441
+ where, we use the fact that $\alpha < 1 , l \le 9$ . The natural implication of this bound is that the terms that are lower order, such as $\mathcal { O } ( 1 / \kappa ^ { 4 } )$ and $\mathcal { O } ( 1 / \kappa ^ { 5 } )$ will be negative owing to the large constant above. Let us verify that this is indeed the case by considering the terms having powers of $\mathcal { O } ( 1 / \kappa ^ { 4 } )$ and $\mathcal { O } ( 1 / \kappa ^ { 5 } )$ from equation (3):
442
+
443
+ $$
444
+ \begin{array} { r l } & { \frac { c ^ { 3 } ( \delta \sigma _ { 1 } ^ { 2 } ) ^ { 2 } l ^ { 3 } } { \kappa ^ { 5 } } + \frac { l ^ { 4 } - 2 c ( \delta \sigma _ { 1 } ^ { 2 } ) l ^ { 3 } ( 1 + \alpha ) + ( 2 \alpha - 3 c ) c ^ { 2 } ( \delta \sigma _ { 1 } ^ { 2 } ) ^ { 2 } l ^ { 2 } } { \kappa ^ { 4 } } - \frac { 4 5 \cdot 4 5 0 ^ { 2 } } { \kappa ^ { 4 } } } \\ & { \leq \frac { c ^ { 3 } ( \delta \sigma _ { 1 } ^ { 2 } ) ^ { 2 } l ^ { 3 } } { \kappa ^ { 5 } } + \frac { l ^ { 4 } } { \kappa ^ { 4 } } - \frac { 4 5 \cdot 4 5 0 ^ { 2 } } { \kappa ^ { 4 } } } \\ & { \leq \frac { c l ^ { 3 } } { \kappa ^ { 5 } } + \frac { ( 9 ^ { 4 } - ( 4 5 \cdot 4 5 0 ^ { 2 } ) ) } { \kappa ^ { 4 } } \leq \frac { 9 ^ { 3 } c + 9 ^ { 4 } - ( 4 5 \cdot 4 5 0 ^ { 2 } ) } { \kappa ^ { 4 } } } \end{array}
445
+ $$
446
+
447
+ The expression above evaluates to $\leq 0$ given an upperbound on the value of $c$ . The expression above follows from the fact that $l \leq 9 , \kappa \geq 1$ .
448
+
449
+ Next, consider the terms involving $\mathcal { O } ( 1 / \kappa ^ { 3 } )$ and $\mathcal { O } ( 1 / \kappa ^ { 2 } )$ , in particular,
450
+
451
+ $$
452
+ \begin{array} { r l } & { \frac { ( 3 c - 4 \alpha + ( 2 - c ) \alpha ^ { 2 } ) c ^ { 2 } ( \delta \sigma _ { 1 } ^ { 2 } ) ^ { 2 } l } { \kappa ^ { 3 } } - \frac { c ^ { 2 } ( \delta \sigma _ { 1 } ^ { 2 } ) ^ { 2 } ( 1 - \alpha ) ( c + ( c - 2 ) \alpha ) } { \kappa ^ { 2 } } } \\ & { \leq \frac { c ^ { 2 } ( \delta \sigma _ { 1 } ^ { 2 } ) ^ { 2 } } { \kappa ^ { 2 } } ( \frac { l ( 3 c + 2 ) } { \kappa } - ( 1 - \alpha ) ( c + ( c - 2 ) \alpha ) ) } \\ & { \leq \frac { c ^ { 2 } ( \delta \sigma _ { 1 } ^ { 2 } ) ^ { 2 } } { \kappa ^ { 2 } } ( \frac { 5 \epsilon } { \kappa } - ( 1 - \alpha ) ( c + ( c - 2 ) \alpha ) ) } \\ & { \leq \frac { c ^ { 2 } ( \delta \sigma _ { 1 } ^ { 2 } ) ^ { 2 } } { \kappa ^ { 2 } } ( \frac { 5 \epsilon l } { \kappa } - ( 1 - \alpha ) c ) } \\ & { \leq \frac { c ^ { 3 } ( \delta \sigma _ { 1 } ^ { 2 } ) ^ { 2 } } { \kappa ^ { 2 } } ( \frac { 5 l } { \kappa } - \frac { 4 5 0 } { \kappa } ) } \\ & { \leq \frac { c ^ { 3 } ( \delta \sigma _ { 1 } ^ { 2 } ) ^ { 2 } } { \kappa ^ { 2 } } ( \frac { 1 - \delta ^ { 2 } } { \kappa } ) } \\ & { \leq \frac { c ^ { 3 } ( \delta \sigma _ { 1 } ^ { 2 } ) ^ { 2 } } { \kappa ^ { 2 } } \cdot \frac { - 4 4 5 0 } { \kappa } \leq 0 . } \end{array}
453
+ $$
454
+
455
+ Next,
456
+
457
+ $$
458
+ \begin{array} { r l } & { \frac { - 2 ( 1 + \alpha ) ( 2 \alpha - 3 ) e ( \delta \sigma _ { 1 } ^ { 2 } ) l ^ { 2 } } { \kappa ^ { 3 } } - \frac { 2 c ( \delta \sigma _ { 1 } ^ { 2 } ) l ( 3 - \alpha ) ( 1 - \alpha ^ { 2 } ) } { \kappa ^ { 2 } } } \\ & { \leq \frac { 2 ( 1 + \alpha ) c ( \delta \sigma _ { 1 } ^ { 2 } ) l } { \kappa ^ { 2 } } \Big ( \frac { - ( 2 \alpha - 3 ) l } { \kappa } - ( 3 - \alpha ) ( 1 - \alpha ) \Big ) } \\ & { \leq \frac { 2 ( 1 + \alpha ) c ( \delta \sigma _ { 1 } ^ { 2 } ) l } { \kappa ^ { 2 } } \Big ( \frac { 3 l } { \kappa } - 2 ( 1 - \alpha ) \Big ) } \\ & { \leq \frac { 2 ( 1 + \alpha ) c ( \delta \sigma _ { 1 } ^ { 2 } ) l } { \kappa ^ { 2 } } \Big ( \frac { 3 l } { \kappa } - \frac { 2 \cdot 4 5 0 } { \kappa } \Big ) } \\ & { \leq \frac { 2 ( 1 + \alpha ) c ( \delta \sigma _ { 1 } ^ { 2 } ) l } { \kappa ^ { 2 } } \Big ( \frac { 3 \cdot 2 7 } { \kappa } - \frac { 2 \cdot 4 5 0 } { \kappa } \Big ) \leq 0 . } \end{array}
459
+ $$
460
+
461
+ In both these cases, we used the fact that remaining terms are negative. $\textstyle \alpha \leq 1 - { \frac { 4 5 0 } { \kappa } }$ implying $\begin{array} { r } { - ( 1 - \alpha ) \le \frac { - 4 5 0 } { \kappa } } \end{array}$ . Finally, other
462
+
463
+ Before rounding up the proof of the proposition, we need the following lemma to ensure that our lower bounds on the largest eigenvalue of $\boldsymbol { B }$ indeed affect the algorithm’s rates and are true irrespective of where the algorithm is begun. Note that this allows our result to be much stronger than typical optimization lowerbounds that rely on specific initializations to ensure a component along the largest eigendirection of the update operator, for which bounds are proven.
464
+
465
+ Lemma 13. For any starting iterate $\mathbf { w } _ { 0 } \neq \mathbf { w } ^ { * }$ , the HB method produces a non-zero component along the largest eigen direction of $\boldsymbol { B }$ .
466
+
467
+ Proof. We note that in a similar manner as other proofs, it suffices to argue for each dimension of the problem separately. But before we start looking at each dimension separately, let us consider the $\bar { j } ^ { \mathrm { t h } }$ dimension, and detail the approach we use to prove the claim: the idea is to examine the subspace spanned by covariance $\mathbb { E } \left[ \pmb { \theta } _ { . } ^ { ( j ) } \otimes \pmb { \theta } _ { . } ^ { ( j ) } \right]$ of the iterates $\pmb { \theta } _ { 0 } ^ { ( j ) } , \pmb { \theta } _ { 1 } ^ { ( j ) } , \pmb { \theta } _ { 2 } ^ { ( j ) } , . . . ,$ for every starting iterate $\pmb { \theta } _ { 0 } ^ { ( j ) } \neq \left[ 0 , 0 \right] ^ { \top }$ and prove that the largest eigenvector of the expected operator $B ^ { ( j ) }$ is not orthogonal to this subspace. This implies that there exists a non-zero component of $\mathbb { E } \left[ \pmb { \theta } _ { \cdot } ^ { ( j ) } \otimes \pmb { \theta } _ { \cdot } ^ { ( j ) } \right]$ in the largest eigen direction of $B ^ { ( j ) }$ , and this decays at a rate that is at best $\lambda _ { \operatorname* { m a x } } ( B ^ { ( j ) } )$ .
468
+
469
+ Since $\boldsymbol { B } ^ { ( j ) } ~ \in ~ \mathbb { R } ^ { 4 \times 4 }$ , we begin by examining the expected covariance spanned by the iterates $\pmb { \theta } _ { 0 } ^ { ( j ) } , \pmb { \theta } _ { 1 } ^ { ( j ) } , \pmb { \theta } _ { 2 } ^ { ( j ) } , \pmb { \theta } _ { 3 } ^ { ( j ) }$ . Let $\mathbf { w } _ { 0 } ^ { ( j ) } - ( \mathbf { w } ^ { * } ) ^ { ( j ) } = \mathbf { \bar { w } } _ { - 1 } ^ { ( j ) } - ( \mathbf { w } ^ { * } ) ^ { ( j ) } = k ^ { ( j ) }$ . Now, this implies $\theta _ { 0 } ^ { ( j ) } =$ $\boldsymbol { k } ^ { ( j ) } \cdot \left[ 1 , 1 \right] ^ { \top }$ . Then,
470
+
471
+ $$
472
+ \pmb { \theta } _ { 1 } ^ { ( j ) } = k ^ { ( j ) } \widehat { \mathbf { A } } _ { 1 } ^ { ( j ) } \left[ 1 \right] , \mathrm { w i t h } \widehat { \mathbf { A } } _ { 1 } ^ { ( j ) } = \left[ 1 + \alpha - \delta \widehat { \mathbf { H } } _ { 1 } ^ { ( j ) } \quad - \alpha \right] , \mathrm { w h e r e } \widehat { \mathbf { H } } _ { 1 } ^ { ( j ) } = \big ( a _ { 1 } ^ { ( j ) } \big ) ^ { 2 } .
473
+ $$
474
+
475
+ This implies that $k$ just appears as a scale factor. This in turn implies that in order to analyze the subspace spanned by the covariance of iterates $\theta _ { 0 } ^ { ( j ) } , \theta _ { 1 } ^ { ( j ) } , . . . ,$ , we can assume $k ^ { ( j ) } = 1$ without any loss in generality. This implies, $\pmb { \theta } _ { 0 } ^ { ( j ) } = \left[ 1 , 1 \right] ^ { \top }$ . Note that with this in place, we see that we can now drop the superscript $j$ that represents the dimension, since the analysis decouples across the dimensions $j \in \{ 1 , 2 \}$ . Furthermore, let the entries of the vector $\pmb { \theta } _ { k }$ be represented as $\pmb { \theta } _ { k }$ def = $\left[ \theta _ { k 1 } \quad \theta _ { k 2 } \right] ^ { \top }$ Next, denote $1 + \alpha - \delta \widehat { \mathbf { H } } _ { k } = \widehat { t } _ { k }$ . This implies,
476
+
477
+ $$
478
+ \begin{array} { r } \widehat { \mathbf { A } } _ { k } = \left[ \begin{array} { c c } { \widehat { t } _ { k } } & { - \alpha \right] . } \end{array} \end{array}
479
+ $$
480
+
481
+ Furthermore,
482
+
483
+ $$
484
+ \begin{array} { r } { \pmb \theta _ { 1 } = \widehat { \mathbf A } _ { 1 } \pmb \theta _ { 0 } = \left[ \hat { t } _ { 1 } - \alpha \right] , \pmb \theta _ { 2 } = \widehat { \mathbf A } _ { 2 } \pmb \theta _ { 1 } = \left[ \hat { t } _ { 2 } ( \hat { t } _ { 1 } - \alpha ) - \alpha \right] , } \\ { \pmb \theta _ { 3 } = \widehat { \mathbf A } _ { 3 } \pmb \theta _ { 2 } = \left[ \hat { t } _ { 3 } ( \hat { t } _ { 2 } ( \hat { t } _ { 1 } - \alpha ) - \alpha ) - \alpha ( \hat { t } _ { 1 } - \alpha ) \right] . } \end{array}
485
+ $$
486
+
487
+ Let us consider the vectorized form of $\Phi _ { j } = \mathbb { E } \left[ \pmb { \theta } _ { j } \otimes \pmb { \theta } _ { j } \right]$ , and we denote this as vec $( \Phi _ { j } )$ . Note that $\mathrm { v e c } ( \Phi _ { j } )$ makes $\Phi _ { j }$ become a column vector of size $4 \times 1$ . Now, consider vec $( \Phi _ { j } )$ for $\bar { \boldsymbol { j } } = 0 , 1 , 2 , 3$ and concatenate these to form a matrix that we denote as $\mathcal { D }$ , i.e.
488
+
489
+ $$
490
+ \mathcal { D } = \left[ \mathrm { v e c } ( \Phi _ { 0 } ) \mathrm { v e c } ( \Phi _ { 1 } ) \mathrm { v e c } ( \Phi _ { 2 } ) \mathrm { v e c } ( \Phi _ { 3 } ) \right] .
491
+ $$
492
+
493
+ Now, since we note that $\Phi _ { j }$ is a symmetric $2 \times 2$ matrix, $\mathcal { D }$ should contain two identical rows implying that it has an eigenvalue that is zero and a corresponding eigenvector that is $\begin{array} { r } { \left[ { 0 \mathrm { ~ \ t ~ { ~ - } 1 / { \sqrt { 2 } } ~ } } { \hat { 1 } } / { \sqrt { ( 2 \tau ) } } \mathrm { ~ \ t ~ { ~ } } \right] ^ { \top } } \end{array}$ . It turns out that this is also an eigenvector of $\boldsymbol { B }$ with an eigenvalue $\alpha$ . Note that $\operatorname* { d e t } ( B ) = \alpha ^ { 4 }$ . This implies there are two cases that we need to consider: (i) when all eigenvalues of $\boldsymbol { B }$ have the same magnitude $( = \alpha )$ . In this case, we are already done, because there exists at least one non zero eigenvalue of $\mathcal { D }$ and this should have some component along one of the eigenvectors of $\boldsymbol { B }$ and we know that all eigenvectors have eigenvalues with a magnitude equal to $\lambda _ { \mathrm { m a x } } ( B )$ . Thus, there exists an iterate which has a non-zero component along the largest eigendirection of $\boldsymbol { B }$ . (ii) the second case is the situation when we have eigenvalues with different magnitudes. In this case, note that $\operatorname* { d e t } ( \mathcal B ) = \alpha ^ { 4 } < ( \lambda _ { \operatorname* { m a x } } ( \mathcal B ) ) ^ { 4 }$ implying $\bar { \lambda } _ { \mathrm { m a x } } ( B ) > \alpha$ . In this case, we need to prove that $\mathcal { D }$ spans a three-dimensional subspace; if it does, it contains a component along the largest eigendirection of $\boldsymbol { B }$ which will round up the proof. Since we need to understand whether $\mathcal { D }$ spans a three dimensional subspace, we can consider a different (yet related) matrix, which we call $\mathcal { R }$ and this is defined as:
494
+
495
+ $$
496
+ \mathcal { R } \stackrel { \mathrm { d e f } } { = } \mathbb { E } \left( \begin{array} { c c c } { \theta _ { 0 1 } ^ { 2 } } & { \theta _ { 1 1 } ^ { 2 } } & { \theta _ { 2 1 } ^ { 2 } } \\ { \theta _ { 0 1 } \theta _ { 0 2 } } & { \theta _ { 1 1 } \theta _ { 1 2 } } & { \theta _ { 2 1 } \theta _ { 2 2 } } \\ { \theta _ { 0 2 } ^ { 2 } } & { \theta _ { 1 2 } ^ { 2 } } & { \theta _ { 2 2 } ^ { 2 } } \end{array} \right)
497
+ $$
498
+
499
+ Given the expressions for $\{ \pmb { \theta } _ { j } \} _ { j = 0 } ^ { 3 }$ (by definition of $\pmb { \theta } _ { 0 }$ and using equation 4), we can substitute to see that $\mathcal { R }$ has the following expression:
500
+
501
+ $$
502
+ \mathcal { R } = \left[ { 1 \atop 1 } \begin{array} { c c } { { \mathbb { E } \left[ ( \hat { t } _ { 1 } - \alpha ) ^ { 2 } \right] } } & { { \mathbb { E } \left[ ( \hat { t } _ { 2 } ( \hat { t } _ { 1 } - \alpha ) - \alpha ) ^ { 2 } \right] } } \\ { { \mathbb { E } \left[ \hat { t } _ { 1 } - \alpha \right] } } & { { \mathbb { E } \left[ ( ( \hat { t } _ { 2 } ( \hat { t } _ { 1 } - \alpha ) - \alpha ) ) ( \hat { t } _ { 1 } - \alpha ) \right] } } \\ { { 1 } } & { { \mathbb { E } \left[ ( \hat { t } _ { 1 } - \alpha ) ^ { 2 } \right] } } \end{array} \right] .
503
+ $$
504
+
505
+ If we compute and prove that $\operatorname* { d e t } ( \mathcal { R } ) \neq 0$ , we are done since that implies that $\mathcal { R }$ has three non-zero eigenvalues.
506
+
507
+ This implies, we first define the following: let $q _ { \gamma } = ( t - \gamma ) ^ { 2 } + ( c - 1 ) x ^ { 2 }$ . Then, $\mathcal { R }$ can be expressed as:
508
+
509
+ $$
510
+ \begin{array} { r l } & { \mathrm { d e t } ( \mathcal { R } ) = \mathrm { d e t } { \left( \left[ \begin{array} { l l l } { 1 } & { q _ { \alpha } } & { 2 q _ { \alpha } - 2 \alpha t ( t - \alpha ) + \alpha ^ { 2 } } \\ { 1 } & { t - \alpha } & { t q _ { \alpha } - \alpha ( t - \alpha ) } \end{array} \right] \right) } } \\ & { \qquad = \mathrm { d e t } { \left( \left[ \begin{array} { l l l } { 1 } & { q _ { \alpha } } & { 2 \alpha } \\ { 1 } & { 1 } & { \phi _ { \alpha } } \\ { 1 } & { 1 } & { \phi _ { \alpha } } \\ { 1 } & { t - \alpha } & { q _ { \alpha } - \alpha ( t - \alpha ) - 2 \alpha t ( t - \alpha ) + \alpha ^ { 2 } } \\ { 1 } & { 1 } & { \theta _ { \alpha } } \end{array} \right] \right) } } \\ & { \qquad = \mathrm { d e t } { \left( \left[ \begin{array} { l l l } { 1 } & { q _ { \alpha } - 1 } & { q _ { \alpha } ( q _ { \alpha } - q _ { \alpha } ) - 2 \alpha t ( t - \alpha ) + \alpha ^ { 2 } } \\ { 1 } & { t - \alpha - 1 } & { 1 } & { 0 } \\ { 1 } & { 0 } & { t q _ { \alpha } - \alpha ( t - \alpha ) - 0 } & { ( t - \alpha ) q _ { \alpha } } \end{array} \right] \right) } } \\ & { \qquad = \mathrm { d e t } { \left( \left[ \begin{array} { l l l } { 0 } & { q _ { \alpha } - 1 } & { q _ { \alpha } ( q _ { \alpha } - q _ { \alpha } ) - ( t - \alpha ) + \alpha ^ { 2 } } \\ { 0 } & { 1 } & { \theta _ { \alpha } } \end{array} \right] \right) } } \\ & { \qquad = \mathrm { d e t } { \left( \left[ \begin{array} { l l l } { 0 } & { q _ { \alpha } - 1 } & { q _ { \alpha } ( q _ { \alpha } - q _ { \alpha } ) - 2 \alpha t ( t - \alpha ) + \alpha ^ { 2 } } \\ { 0 } & { t - \alpha - 1 } & { 1 } \end{array} \right] \right) } } \end{array}
511
+ $$
512
+
513
+ Note: (i) $q _ { \alpha } - 1 = ( t - \alpha ) ^ { 2 } - 1 + ( c - 1 ) x ^ { 2 } = ( 1 - x ) ^ { 2 } - 1 + ( c - 1 ) x ^ { 2 } = - 2 x + x ^ { 2 } + ( c - 1 ) x ^ { 2 } = 0$ $- 2 x + c x ^ { 2 }$ .
514
+
515
+ (ii) $t - \alpha - 1 = - x$
516
+ (iv) (iii) $\begin{array} { r l } & { \alpha ( q _ { \alpha } - ( t - \alpha ) ) = \alpha ( ( t - \alpha ) ^ { 2 } - ( t - \alpha ) + ( c - 1 ) x ^ { 2 } ) = \alpha ( ( 1 - x ) ( - x ) + ( c - 1 ) x ^ { 2 } ) = \alpha x ( - 1 + c x ) } \\ & { q _ { 0 } - q _ { \alpha } = t ^ { 2 } - ( t - \alpha ) ^ { 2 } = \alpha ( 2 t - \alpha ) = 2 t \alpha - \alpha ^ { 2 } . } \end{array}$
517
+ Then,
518
+
519
+ $$
520
+ \begin{array} { r } { ( 2 \alpha t - \alpha ^ { 2 } ) q _ { \alpha } - 2 \alpha t ( t - \alpha ) + \alpha ^ { 2 } = 2 t \alpha ( q _ { \alpha } - ( t - \alpha ) ) + \alpha ^ { 2 } ( 1 - q _ { \alpha } ) } \\ { = 2 t \alpha ( - x + c x ^ { 2 } ) - \alpha ^ { 2 } ( - 2 x + c x ^ { 2 } ) } \end{array}
521
+ $$
522
+
523
+ $$
524
+ \begin{array} { r l } & { = - 2 t \alpha x + 2 x \alpha ^ { 2 } + 2 t \alpha c x ^ { 2 } - c \alpha ^ { 2 } x ^ { 2 } } \\ & { = 2 \alpha x ( - t + \alpha ) + c \alpha x ^ { 2 } ( 2 t - \alpha ) } \\ & { = - 2 \alpha x ( 1 - x ) + 2 c \alpha x ^ { 2 } ( 1 - x ) + c \alpha ^ { 2 } x ^ { 2 } } \\ & { = 2 \alpha x ( 1 - x ) ( - 1 + c x ) + c \alpha ^ { 2 } x ^ { 2 } . } \end{array}
525
+ $$
526
+
527
+ Then,
528
+
529
+ $$
530
+ { \begin{array} { r l } & { \operatorname* { d e t } ( \mathcal { R } ) = \operatorname* { d e t } { \left( \begin{array} { l l l } { 0 } & { x ( c x - 2 ) } & { 2 \alpha x ( 1 - x ) ( - 1 + c x ) + c \alpha ^ { 2 } x ^ { 2 } } \\ { 0 } & { - x } & { \alpha x ( c x - 1 ) } \\ { 1 } & { 0 } & { 0 } \end{array} \right) } } \\ & { \qquad = x ^ { 2 } \alpha \operatorname* { d e t } \left( { \left[ \begin{array} { l l l } { 0 } & { ( c x - 2 ) } & { c \alpha x + 2 ( 1 - x ) ( c x - 1 ) } \\ { 0 } & { - 1 } & { c x - 1 } \\ { 1 } & { 0 } & { 0 } \end{array} \right] } \right) } \\ & { \qquad = x ^ { 3 } \alpha \operatorname* { d e t } \left( { \left[ \begin{array} { l l l } { 0 } & { c } & { c \alpha - 2 ( c x - 1 ) } \\ { 0 } & { - 1 } & { c x - 1 } \\ { 1 } & { 0 } & { 0 } \end{array} \right] } \right) } \end{array} }
531
+ $$
532
+
533
+ Then,
534
+
535
+ $$
536
+ \begin{array} { c } { { \operatorname * { d e t } ( \mathcal { R } ) = x ^ { 3 } \alpha \bigg ( c ( - 1 + c x ) - 2 ( - 1 + c x ) + c \alpha \bigg ) } } \\ { { = \alpha x ^ { 3 } \bigg ( ( c - 2 ) ( - 1 + c x ) + c \alpha \bigg ) } } \end{array}
537
+ $$
538
+
539
+ Note that this determinant can be zero when
540
+
541
+ $$
542
+ \alpha = \frac { ( c - 2 ) ( 1 - c x ) } { c } .
543
+ $$
544
+
545
+ We show this is not possible by splitting our argument into two parts, one about the convergent regime of the algorithm (where, $\begin{array} { r } { \delta \sigma _ { 1 } ^ { 2 } < \frac { 2 ( 1 - \alpha ^ { 2 } ) } { c + ( c - 2 ) \alpha } ) } \end{array}$ and the other about the divergent regime.
546
+
547
+ Let us first provide a proof for the convergent regime of the algorithm. For this regime, let the chosen $\delta$ be represented as $\delta ^ { + }$ . Now, for the smaller eigen direction, $x = \delta ^ { + } \lambda _ { \mathrm { m i n } } = c \bar { \delta ^ { + } } \sigma _ { 1 } ^ { 2 } / \kappa$ . Suppose $\alpha$ was chosen as per equation 5,
548
+
549
+ $$
550
+ \begin{array} { c } { { \displaystyle \frac { c \alpha } { c - 2 } = 1 - \frac { c ^ { 2 } \delta ^ { + } \sigma _ { 1 } ^ { 2 } } { \kappa } } } \\ { { \implies \delta ^ { + } \sigma _ { 1 } ^ { 2 } = \displaystyle \frac { \kappa } { c ^ { 2 } } - \frac { \kappa \alpha } { c ( c - 2 ) } . } } \end{array}
551
+ $$
552
+
553
+ We will now prove that δ+σ21 = κc ( 1c is much larger than one allowed by the convergence of the HB updates, i.e., $\begin{array} { r } { \delta \sigma _ { 1 } ^ { 2 } < \frac { 2 ( 1 - \alpha ^ { 2 } ) } { c + ( c - 2 ) \alpha } \le \frac { 2 ( 1 - \alpha ^ { 2 } ) } { c } } \end{array}$ . In particular, if we prove that $\textstyle { \frac { \kappa } { c } } { \bigl ( } { \frac { 1 } { c } } - { \frac { \alpha } { c - 2 } } { \bigr ) } >$ 2(1−α2) for any admissible value of α, we are done.
554
+
555
+ $$
556
+ \begin{array} { c } { { \displaystyle \frac \kappa c ( \frac 1 c - \frac \alpha { c - 2 } ) > \frac { 2 ( 1 - \alpha ^ { 2 } ) } { c } } } \\ { { \Leftrightarrow \displaystyle \frac \kappa c - \frac { \kappa \alpha } { c - 2 } > 2 - 2 \alpha ^ { 2 } } } \\ { { \Leftrightarrow \displaystyle \frac \kappa c - \frac { \kappa \alpha } { c - 2 } > \frac \kappa c - \frac { \kappa \alpha } { c } > 2 - 2 \alpha ^ { 2 } } } \\ { { \Leftrightarrow \kappa - \kappa \alpha > 2 c - 2 c \alpha ^ { 2 } } } \\ { { \Leftrightarrow 2 c \alpha ^ { 2 } - \kappa \alpha + ( \kappa - 2 c ) > 0 . } } \end{array}
557
+ $$
558
+
559
+ The two roots of this quadratic equation are $\alpha ^ { + } = \textstyle { \frac { \kappa } { 2 c } } - 1$ and $\alpha ^ { - } = 1$ . Note that $\kappa \geq \widetilde { \kappa } = c$ ; note that there is not much any method gains over SGD if $\kappa = \mathcal { O } ( c )$ . And, for any $\kappa \geq 4 c$ , note, $\alpha ^ { + } > \alpha ^ { - }$ , indicating that the above equation holds true if $\begin{array} { r } { \alpha > \alpha ^ { + } = \frac { \kappa } { 2 c } - 1 } \end{array}$ or if $\alpha < \alpha ^ { - } = 1$ . The latter condition is true and hence the proposition that $\delta ^ { + } \sigma _ { 1 } ^ { 2 } > \frac { 2 ( 1 - \alpha ^ { 2 } ) } { c + ( c - 2 ) \alpha }$ is true.
560
+
561
+ We need to prove that the determinant does not vanish in the divergent regime for rounding up the proof to the lemma.
562
+
563
+ Now, let us consider the divergent regime of the algorithm, i.e., when, $\begin{array} { r } { \delta \sigma _ { 1 } ^ { 2 } > \frac { 2 ( 1 - \alpha ^ { 2 } ) } { c + ( c - 2 ) \alpha } } \end{array}$ . Furthermore, for the larger eigendirection, the determinant is zero when $\begin{array} { r } { \delta \sigma _ { 1 } ^ { 2 } = \frac { 1 - \frac { c \alpha } { c - 2 } } { c } = \frac { 1 } { c } - \frac { \alpha } { c - 2 } } \end{array}$ (obtained by substituting $x = \delta \sigma _ { 1 } ^ { 2 }$ in equation 5). If we show that $\textstyle { \frac { 2 ( 1 - \alpha ^ { 2 } ) } { c + ( c - 2 ) \alpha } } > { \frac { 1 } { c } } - { \frac { \alpha } { c - 2 } }$ for all admissible values of $c$ , we are done. We will explore this in greater detail:
564
+
565
+ $$
566
+ \begin{array} { c } { { \frac { 2 ( 1 - \alpha ^ { 2 } ) } { c + ( c - 2 ) \alpha } > \displaystyle \frac { 1 } { c } - \frac { \alpha } { c - 2 } } } \\ { { \Leftrightarrow 2 ( 1 - \alpha ^ { 2 } ) \geq 1 + \displaystyle \frac { c - 2 } { c } \alpha - \displaystyle \frac { c } { c - 2 } \alpha - \alpha ^ { 2 } } } \\ { { \Leftrightarrow 1 - \alpha ^ { 2 } \geq \displaystyle \frac { - 4 ( c - 1 ) } { c ( c - 2 ) } \alpha } } \\ { { \Leftrightarrow c ^ { 2 } - 2 c - \alpha ^ { 2 } c ^ { 2 } + 2 c \alpha ^ { 2 } \geq - 4 c \alpha + 4 \alpha } } \\ { { \Leftrightarrow c ^ { 2 } ( 1 - \alpha ^ { 2 } ) - 2 c ( 1 - \alpha ^ { 2 } - 2 \alpha ) - 4 \alpha \geq 0 . } } \end{array}
567
+ $$
568
+
569
+ considering the quadratic in the left hand size and solving it for $c$ , we have:
570
+
571
+ $$
572
+ \begin{array} { l } { { c ^ { \pm } = \frac { 2 ( 1 - \alpha ^ { 2 } - 2 \alpha ) \pm \sqrt { 4 ( 1 - \alpha ^ { 2 } - 2 \alpha ) ^ { 2 } + 1 6 \alpha ( 1 - \alpha ^ { 2 } ) } } { 2 ( 1 - \alpha ^ { 2 } ) } } } \\ { { { } ~ = \frac { ( 1 - \alpha ^ { 2 } - 2 \alpha ) \pm \sqrt { ( 1 - \alpha ^ { 2 } - 2 \alpha ) ^ { 2 } + 4 \alpha ( 1 - \alpha ^ { 2 } ) } } { ( 1 - \alpha ^ { 2 } ) } } } \\ { { { } ~ = \frac { ( 1 - \alpha ^ { 2 } - 2 \alpha ) \pm \sqrt { 1 + \alpha ^ { 4 } + 4 \alpha ^ { 2 } - 2 \alpha ^ { 2 } - 4 \alpha + 4 \alpha ^ { 3 } + 4 \alpha ( 1 - \alpha ^ { 2 } ) } } { ( 1 - \alpha ^ { 2 } ) } } } \\ { { { } ~ = \frac { ( 1 - \alpha ^ { 2 } - 2 \alpha ) \pm ( 1 + \alpha ^ { 2 } ) } { ( 1 - \alpha ^ { 2 } ) } } } \end{array}
573
+ $$
574
+
575
+ This holds true iff
576
+
577
+ $$
578
+ c \leq c ^ { - } = \frac { - 2 \alpha ( 1 + \alpha ) } { 1 - \alpha ^ { 2 } } = \frac { - 2 \alpha } { 1 - \alpha } ,
579
+ $$
580
+
581
+ or iff,
582
+
583
+ $$
584
+ c \geq c ^ { + } = { \frac { 2 ( 1 - \alpha ) } { 1 - \alpha ^ { 2 } } } = { \frac { 2 } { 1 + \alpha } } .
585
+ $$
586
+
587
+ Which is true automatically since $c > 2$ . This completes the proof of the lemma.
588
+
589
+ We are now ready to prove Lemma 5.
590
+
591
+ Proof of Lemma 5. Combining Lemmas 9 and 12, we see that no matter what stepsize and momentum we choose, $\boldsymbol { B } ^ { ( j ) }$ has an eigenvalue of magnitude at least $1 - { \frac { 5 0 0 } { \kappa } }$ for some $j \in \{ 1 , 2 \}$ . This proves the lemma. □
592
+
593
+ # B EQUIVALENCE OF ALGORITHM 3 AND ASGD
594
+
595
+ We begin by writing out the updates of ASGD as written out in Jain et al. (2017), which starts with two iterates $\widehat { a } _ { 0 }$ and $\widehat { d } _ { 0 }$ , and from time $t = 0 , 1 , . . . T - 1$ implements the following updates:
596
+
597
+ $$
598
+ \begin{array} { r l r } & { } & { \widehat { b } _ { t } = \alpha _ { 1 } \widehat { a } _ { t } + ( 1 - \alpha _ { 1 } ) \widehat { d } _ { t } } \\ & { } & { \widehat { a } _ { t + 1 } = \widehat { b } _ { t } - \delta _ { 1 } \widehat { \nabla } f _ { t + 1 } ( \widehat { b } _ { t } ) } \\ & { } & { \widehat { c } _ { t } = \beta _ { 1 } \widehat { b } _ { t } + ( 1 - \beta _ { 1 } ) \widehat { d } _ { t } } \\ & { } & { \widehat { d } _ { t + 1 } = \widehat { c } _ { t } - \gamma _ { 1 } \widehat { \nabla } f _ { t + 1 } ( \widehat { b } _ { t } ) . } \end{array}
599
+ $$
600
+
601
+ Next, we specify the step sizes $\beta _ { 1 } = c _ { 3 } ^ { 2 } / \sqrt { \kappa \widetilde { \kappa } }$ , $\alpha _ { 1 } = c _ { 3 } / ( c _ { 3 } + \beta )$ , $\gamma _ { 1 } = \beta / ( c _ { 3 } \lambda _ { \operatorname* { m i n } } )$ and $\delta _ { 1 } = 1 / R ^ { 2 }$ , where $\kappa = R ^ { 2 } / \lambda _ { \operatorname* { m i n } }$ e. Note that the step sizes in the paper of Jain et al. (2017) with $c _ { 1 }$ in their paper set to 1 yields the step sizes above. Now, substituting equation 8 in equation 9 and substituting the value of $\gamma _ { 1 }$ , we have:
602
+
603
+ $$
604
+ \begin{array} { r l } & { \widehat { d } _ { t + 1 } = \beta _ { 1 } \left( \widehat { b } _ { t } - \frac { 1 } { c _ { 3 } \lambda _ { \operatorname* { m i n } } } \hat { \nabla } f _ { t + 1 } ( \widehat { b } _ { t } ) \right) + ( 1 - \beta _ { 1 } ) \widehat { d } _ { t } } \\ & { \qquad = \beta _ { 1 } \left( \widehat { b } _ { t } - \frac { \delta \kappa } { c _ { 3 } } \hat { \nabla } f _ { t + 1 } ( \widehat { b } _ { t } ) \right) + ( 1 - \beta _ { 1 } ) \widehat { d } _ { t } . } \end{array}
605
+ $$
606
+
607
+ We see that $\widehat { d } _ { t + 1 }$ is precisely the update of the running average $\bar { w } _ { t + 1 }$ in the ASGD method employed in this paper.
608
+
609
+ We now update $\widehat { b } _ { t }$ to become $\widehat { b } _ { t + 1 }$ and this can be done by writing out equation 6 at $t + 1$ , i.e:
610
+
611
+ $$
612
+ \begin{array} { r l } & { \widehat { b } _ { t + 1 } = \alpha _ { 1 } \widehat { a } _ { t + 1 } + ( 1 - \alpha _ { 1 } ) \widehat { d } _ { t + 1 } } \\ & { \qquad = \alpha _ { 1 } \left( \widehat { b } _ { t } - \delta _ { 1 } \widehat { \nabla } f _ { t + 1 } ( \widehat { b } _ { t } ) \right) + ( 1 - \alpha _ { 1 } ) \widehat { d } _ { t + 1 } . } \end{array}
613
+ $$
614
+
615
+ By substituting the value of $\alpha _ { 1 }$ we note that this is indeed the update of the iterate as a convex combination of the current running average and a short gradient step as written in this paper. In this paper, we set $c _ { 3 }$ to be equal to 0.7, and any constant less than 1 works. In terms of variables, we note that $\alpha$ in this paper’s algorithm description maps to $1 - \beta _ { 1 }$ .
616
+
617
+ # C MORE DETAILS ON EXPERIMENTS
618
+
619
+ In this section, we will present more details on our experimental setup.
620
+
621
+ # C.1 LINEAR REGRESSION
622
+
623
+ In this section, we will present some more results on our experiments on the linear regression problem. Just as in Appendix A, it is indeed possible to compute the expected error of all the algorithms among SGD, HB, NAG and ASGD, by tracking certain covariance matrices which evolve as linear systems. For SGD, for instance, denoting $\Phi _ { t } ^ { S G D } \stackrel { \mathrm { d e f } } { = } \mathbb { E } \left[ \left( \mathbf { w } _ { t } ^ { S G D } - w ^ { * } \right) \otimes \left( \mathbf { w } _ { t } ^ { S G D } - w ^ { * } \right) \right]$ , we see that ΦSGDt+1 $\Phi _ { t + 1 } ^ { S G D } \ : = \ : B \circ \Phi _ { t } ^ { S G D }$ , where $\boldsymbol { B }$ is a linear operator acting on $d \times d$ matrices such that ${ \mathcal { B } } \circ M { \stackrel { \mathrm { d e f } } { = } } M - \delta H M - \delta M H + \delta ^ { 2 } \mathbb { E } \left[ \left. x , M x \right. x x ^ { \top } \right]$ . Similarly, HB, NAG and ASGD also have corresponding operators (see Appendix A for more details on the operator corresponding to HB). The largest magnitude of the eigenvalues of these matrices indicate the rate of decay achieved by the particular algorithm – smaller it is compared to 1, faster the decay.
624
+
625
+ We now detail the range of parameters explored for these results: the condition number $\kappa$ was varied from $\{ 2 ^ { 4 } , 2 ^ { 5 } , . . , \bar { 2 } ^ { 2 8 } \}$ for all the optimization methods and for both the discrete and gaussian problem. For each of these experiments, we draw 1000 samples and compute the empirical estimate of the fourth moment tensor. For NAG and HB, we did a very fine grid search by sampling 50 values in the interval $( 0 , 1 ]$ for both the learning rate and the momentum parameter and chose the parameter setting that yielded the smallest $\lambda _ { \mathrm { m a x } } ( B )$ that is less than 1 (so that it falls in the range of convergence of the algorithm). As for SGD and ASGD, we employed a learning rate of $1 / 3$ for the Gaussian case and a step size of 0.9 for the discrete case. The statistical advantage parameter of ASGD was chosen to be $\sqrt { 3 \kappa / 2 }$ for the Gaussian case and $\sqrt { 2 \kappa / 3 }$ for the Discrete case, and the a long step parameters of $3 \kappa$ and $2 \kappa$ were chosen for the Gaussian and Discrete case respectively. The reason it appears as if we choose a parameter above the theoretically maximal allowed value of the advantage parameter is because the definition of $\kappa$ is different in this case. The $\kappa$ we speak about for this experiment is $\lambda _ { \operatorname* { m a x } } / \lambda _ { \operatorname* { m i n } }$ unlike the condition number for the stochastic optimization problem. In a manner similar to actually running the algorithms (the results of whose are presented in the main paper), we also note that we can compute the rate as in equation 1 and join all these rates using a curve and estimate its slope (in the log scale). This result is indicated in table 3.
626
+
627
+ Figure 7 presents these results, where for each method, we did grid search over all parameters and chose parameters that give smallest $\lambda _ { \operatorname* { m a x } }$ . We see the same pattern as in Figure 1 from actual runs – SGD,HB and NAG all have linear dependence on condition number $\kappa$ , while ASGD has a dependence of $\sqrt { \kappa }$ .
628
+
629
+ ![](images/2ce4c7a58a43a49aac0ae0911e2b09d770a20e8605b3023da8d2c7e23eef036f.jpg)
630
+ Figure 7: Expected rate of error decay (equation 1) vs condition number for various methods for the linear regression problem. Left is for discrete distribution and right is for Gaussian distribution.
631
+ Table 3: Slopes (i.e. $\gamma$ ) obtained by fitting a line to the curves in Figure 7. A value of $\gamma$ indicates that the error decays at a rate of exp $\left( { \frac { - t } { \kappa ^ { \gamma } } } \right)$ . A smaller value of $\gamma$ indicates a faster rate of error decay.
632
+
633
+ <table><tr><td>Algorithm</td><td>Slope - discrete</td><td>Slope- Gaussian</td></tr><tr><td>SGD</td><td>0.9990</td><td>0.9995</td></tr><tr><td>HB</td><td>1.0340</td><td>0.9989</td></tr><tr><td>NAG</td><td>1.0627</td><td>1.0416</td></tr><tr><td>ASGD</td><td>0.4923</td><td>0.4906</td></tr></table>
634
+
635
+ # C.2 AUTOENCODERS FOR MNIST
636
+
637
+ We begin by noting that the learning rates tend to vary as we vary batch sizes, which is something that is known in theory (Jain et al., 2016). Furthermore, we extend the grid especially whenever our best parameters of a baseline method tends to land at the edge of a grid. The parameter ranges explored by our grid search are:
638
+
639
+ Batch Size 1: (parameters chosen by running for 20 epochs)
640
+
641
+ • SGD: learning rate: $\{ 0 . 0 1 , 0 . 0 1 { \sqrt { 1 0 } } , 0 . 1 , 0 . 1 { \sqrt { 1 0 } } , 1 , { \sqrt { 1 0 } } , 5 , 1 0 , 2 0 , 1 0 { \sqrt { 1 0 } } , 4 0 , 6 0 , 8 0 , 1 0 0 .$
642
+ • NAG/HB: learning rate: $\{ 0 . 0 1 \sqrt { 1 0 } , 0 . 1 , 0 . 1 \sqrt { 1 0 } , 1 , \sqrt { 1 0 } , 1 0 \}$ , momentum $\left\{ 0 , 0 . 5 , 0 . 7 5 , 0 . 9 , 0 . 9 5 , 0 . 9 7 \right\}$ .
643
+ • ASGD: learning rate: $\{ 2 . 5 , 5 \}$ , long step $\{ 1 0 0 . 0 , 1 0 0 0 . 0 \}$ , advantage parameter $\{ 2 . 5 , 5 . 0 , 1 0 . 0 , 2 0 . 0 \}$ .
644
+
645
+ Batch Size 8: (parameters chosen by running for 50 epochs)
646
+
647
+ • SGD: learning rate: $\{ 0 . 0 0 1 , 0 . 0 0 1 \sqrt { 1 0 . 0 } , 0 . 0 1 , 0 . 0 1 \sqrt { 1 0 } , 0 . 1 , 0 . 1 \sqrt { 1 0 } , 1 , \sqrt { 1 0 } , 5 , 1 0 \}$ , $1 0 \sqrt { 1 0 } , 4 0 , 6 0 , 8 0 , 1 0 0 , 1 2 0 , 1 4 0 \}$ .
648
+ • NAG/HB: learning rate: $\{ 5 . 0 , 1 0 . 0 , 2 0 . 0 , 1 0 \sqrt { 1 0 } , 4 0 , 6 0 \} .$ , momentum $\{ 0 , 0 . 2 5 , 0 . 5 , 0 . 7 5 , 0 . 9 , 0 . 9 5 \}$ .
649
+ • ASGD: learning rate $\{ 4 0 , 6 0 \}$ . For a long step of 100, advantage parameters of $\{ 1 . 5 , 2 , 2 . 5 , 5 , 1 \bar { 0 } , 2 0 \}$ . For a long step of 1000, we swept over advantage parameters of $\{ 2 . 5 , 5 , 1 0 \}$ .
650
+
651
+ # C.3 DEEP RESIDUAL NETWORKS FOR CIFAR-10
652
+
653
+ In this section, we will provide more details on our experiments on cifar-10, as well as present some additional results. We used a weight decay of 0.0005 in all our experiments. The grid search parameters we used for various algorithms are as follows. Note that the ranges in which parameters such as learning rate need to be searched differ based on batch size (Jain et al., 2016). Furthermore, we tend to extrapolate the grid search whenever a parameter (except for the learning rate decay factor) at the edge of the grid has been chosen; this is done so that we always tend to lie in the interior of the grid that we have searched on. Note that for the purposes of the grid search, we choose a hold out set from the training data and add it in to the training data after the parameters are chosen, for the final run.
654
+
655
+ Batch Size 8: Note: (i) parameters chosen by running for 40 epochs and picking the grid search parameter that yields the smallest validation $0 / 1$ error. (ii) The validation set decay scheme that we use is that if the validation error does not decay by at least $1 \%$ every three passes over the data, we cut the learning rate by a constant factor (which is grid searched as described below). The minimal learning rate to use is fixed to be $6 . 2 5 \times 1 0 ^ { - 5 }$ , so that we do not decay far too many times and curtail progress prematurely.
656
+
657
+ • SGD: learning rate: $\left\{ 0 . 0 0 3 3 , 0 . 0 1 , 0 . 0 3 3 , 0 . 1 , 0 . 3 3 \right\}$ , learning rate decay factor $\{ 5 , 1 0 \}$ .
658
+ • NAG/HB: learning rate: $\{ 0 . 0 0 1 , 0 . 0 0 3 3 , 0 . 0 1 , 0 . 0 3 3 \}$ , momentum $\{ 0 . 8 , 0 . 9 , 0 . 9 5 , 0 . 9 7 \}$ , learning rate decay factor $\{ 5 , 1 0 \}$ .
659
+ • ASGD: learning rate $\{ 0 . 0 1 , 0 . 0 3 3 0 , 0 . 1 \}$ , long step $\{ 1 0 0 0 , 1 0 0 0 0 , 5 0 0 0 0 \}$ , advantage parameter $\{ 5 , 1 0 \}$ , learning rate decay factor $\{ 5 , 1 0 \}$ .
660
+
661
+ Batch Size 128: Note: (i) parameters chosen by running for 120 epochs and picking the grid search parameter that yields the smallest validation $0 \dot { / } 1$ error. (ii) The validation set decay scheme that we use is that if the validation error does not decay by at least $0 . 2 \%$ every four passes over the data, we cut the learning rate by a constant factor (which is grid searched as described below). The minimal learning rate to use is fixed to be $1 \times 1 0 ^ { - 3 }$ , so that we do not decay far too many times and curtail progress prematurely.
662
+
663
+ • SGD: learning rate: $\{ 0 . 0 1 , 0 . 0 3 , 0 . 0 9 , 0 . 2 7 , 0 . 8 1 \}$ , learning rate decay factor $\{ 2 , { \sqrt { 1 0 } } , 5 \}$ .
664
+ • NAG/HB: learning rate: $\{ 0 . 0 1 , 0 . 0 3 , 0 . 0 9 , 0 . 2 7 \}$ , momentum $\left. 0 . 5 , 0 . 8 , 0 . 9 , 0 . 9 5 , 0 . 9 7 \right.$ , learning rate decay factor $\{ 2 , { \sqrt { 1 0 } } , 5 \}$ .
665
+ • ASGD: learning rate $\{ 0 . 0 1 , 0 . 0 3 , 0 . 0 9 , 0 . 2 7 \}$ , long step √ $\{ 1 0 0 , 1 0 0 0 , 1 0 0 0 0 \}$ , advantage parameter $\{ 5 , 1 0 , 2 0 \}$ , learning rate decay factor $\{ 2 , { \sqrt { 1 0 } } , 5 \}$ .
666
+
667
+ As a final remark, for any comparison across algorithms, such as, (i) ASGD vs. NAG, (ii) ASGD vs HB, we fix the starting learning rate, learning rate decay factor and decay schedule chosen by the best grid search run of NAG/HB respectively and perform a grid search over the long step and advantage parameter of ASGD. In a similar manner, when we compare (iii) SGD vs NAG or, (iv) SGD vs. HB, we choose the learning rate, learning rate decay factor and decay schedule of SGD and simply sweep over the momentum parameter of NAG or HB and choose the momentum that offers the best validation error.
668
+
669
+ We now present plots of training function value for different algorithms and batch sizes.
670
+
671
+ Effect of minibatch sizes: Figure 8 plots training function value for batch sizes of 128 and 8 for SGD, HB and NAG. We notice that in the initial stages of training, NAG obtains substantial improvements compared to SGD and HB for batch size 128 but not for batch size 8. Towards the end of training however, NAG starts decreasing the training function value rapidly for both the batch sizes. The reason for this phenomenon is not clear. Note however, that at this point, the test error has already stabilized and the algorithms are just overfitting to the data.
672
+
673
+ Comparison of ASGD with momentum methods: We now present the training error plots for ASGD compared to HB and NAG in Figures 9 and 10 respectively. As mentioned earlier, in order to see a clear trend, we constrain the learning rate and decay schedule of ASGD to be the same as that of HB and NAG respectively, which themselves were learned using grid search. We see similar trends as in the validation error plots from Figures 5 and 6. Please see the figures and their captions for more details.
674
+
675
+ ![](images/d4f9589382a35d59086f9e033e6141ac77583966f826f72c83135bd3dea92e69.jpg)
676
+ Figure 8: Training loss for batch sizes 128 and 8 respectively for SGD, HB and NAG.
677
+
678
+ ![](images/2974afd1ee80f1ce8e17340db6d644072d3bfc4ff9a48fb040725052e5588668.jpg)
679
+ Figure 9: Training function value for ASGD compared to HB for batch sizes 128 and 8 respectively.
680
+
681
+ ![](images/c730a68098f40ebfb306a2227df07eefd31a0cc84e8d3ba245c31b1e5fcb3db8.jpg)
682
+ Figure 10: Training function value for ASGD compared to NAG for batch size 128 and 8 respectively.
md/train/rJwelMbR-/rJwelMbR-.md ADDED
@@ -0,0 +1,296 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DIVIDE-AND-CONQUER REINFORCEMENT LEARNING
2
+
3
+ Dibya Ghosh1, Avi Singh1, Aravind Rajeswaran2, Vikash Kumar2, Sergey Levine1
4
+
5
+ 1 University of California Berkeley 2 University of Washington Seattle dibya@berkeley.edu, avisingh@cs.berkeley.edu, {aravraj, vikash}@cs.washington.edu, svlevine@eecs.berkeley.edu
6
+
7
+ # ABSTRACT
8
+
9
+ Standard model-free deep reinforcement learning (RL) algorithms sample a new initial state for each trial, allowing them to optimize policies that can perform well even in highly stochastic environments. However, problems that exhibit considerable initial state variation typically produce high-variance gradient estimates for model-free RL, making direct policy or value function optimization challenging. In this paper, we develop a novel algorithm that instead partitions the initial state space into “slices”, and optimizes an ensemble of policies, each on a different slice. The ensemble is gradually unified into a single policy that can succeed on the whole state space. This approach, which we term divide-and-conquer $R L$ , is able to solve complex tasks where conventional deep RL methods are ineffective. Our results show that divide-and-conquer RL greatly outperforms conventional policy gradient methods on challenging grasping, manipulation, and locomotion tasks, and exceeds the performance of a variety of prior methods. Videos of policies learned by our algorithm can be viewed at https://sites.google.com/view/dnc-rl/.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Deep reinforcement learning (RL) algorithms have demonstrated an impressive potential for tackling a wide range of complex tasks, from game playing (Mnih et al., 2015) to robotic manipulation (Levine et al., 2016; Kumar et al., 2016; Popov et al., 2017; Andrychowicz et al., 2017). However, many of the standard benchmark tasks in reinforcement learning, including the Atari benchmark suite (Mnih et al., 2013) and all of the OpenAI gym continuous control benchmarks (Brockman et al., 2016) lack the kind of diversity that is present in realistic environments.
14
+
15
+ One of the most compelling use cases for RL algorithms is to create autonomous agents that can interact intelligently with diverse stochastic environments. However, such environments present a major challenge for current RL algorithms. Environments which require a lot of diversity can be expressed in the framework of RL as having a “wide” stochastic initial state distribution for the underlying Markov decision process. Highly stochastic initial state distributions lead to highvariance policy gradient estimates, which in turn hamper effective learning. Similarly, diversity and variability can also be incorporated by picking a wide distribution over goals.
16
+
17
+ In this paper, we explore RL algorithms that are especially well-suited for tasks with a high degree of variability in both initial and goal states. We argue that a large class of practically interesting real-world problems fall into this category, but current RL algorithms are poorly equipped to handle them, as illustrated in our experimental evaluation. Our main observation is that, for tasks with a high degree of initial state variability, it is often much easier to obtain effective solutions to individual parts of the initial state space and then merge these solutions into a single policy, than to solve the entire task as a monolithic stochastic MDP. To that end, we can autonomously partition the state distribution into a set of distinct “slices,” and train a separate policy for each slice. For example, if we imagine the task of picking up a block with a robotic arm, different slices might correspond to different initial positions of the block. Similarly, for placing the block, different slices will correspond to the different goal positions. For each slice, the algorithm might train a different policy with a distinct strategy. As the training proceeds, we can gradually merge the distinct policies into a single global policy that succeeds in the entire space, by employing a combination of mutual KL-divergence constraints and supervised distillation.
18
+
19
+ It may at first seem surprising that this procedure provides benefit. After all, if the final global policy can solve the entire task, then surely each local policy also has the representational capacity to capture a strategy that is effective on the entire initial state space. However, it is worth considering that a policy in a reinforcement learning algorithm must be able to represent not only the final optimal policy, but also all of the intermediate policies during learning. By decomposing these intermediate policies over the different slices of the initial state space, our method enables effective learning even on tasks with very diverse initial state and goal distributions. Since variation in the initial state distribution leads to high variance gradient estimates, this strategy also benefits from the fact that gradients can be better estimated in the local slices leading to accelerated learning. Intermediate supervised distillation steps help share information between the local policies which accelerates learning for slow learning policies, and helps policies avoid local optima.
20
+
21
+ The main contribution of this paper is a reinforcement learning algorithm specifically designed for tasks with a high degree of diversity and variability. We term this approach as divide-and-conquer (DnC) reinforcement learning. Detailed empirical evaluation on a variety of difficult robotic manipulation and locomotion scenarios reveals that the proposed DnC algorithm substantially improves the performance over prior techniques.
22
+
23
+ # 2 RELATED WORK
24
+
25
+ Prior work has addressed reinforcement learning tasks requiring diverse behaviors, both in locomotion (Heess et al., 2017) and manipulation (Osa et al., 2016; Kober et al., 2012; Andrychowicz et al., 2017; Nair et al., 2017; Rajeswaran et al., 2017a). However, these methods typically make a number of simplifications, such as the use of demonstrations to help guide reinforcement learning (Osa et al., 2016; Kober et al., 2012; Nair et al., 2017; Rajeswaran et al., 2017a), or the use of a higher-level action representation, such as Cartesian end-effector control for a robotic arm (Osa et al., 2016; Kober et al., 2012; Andrychowicz et al., 2017; Nair et al., 2017). We show that the proposed DnC approach can solve manipulation tasks such as grasping and catching directly in the low-level torque action space without the need for demonstrations or a high-level action representation.
26
+
27
+ The selection of benchmark tasks in this work is significantly more complex than those leveraging Cartesian position action spaces in prior work (Andrychowicz et al., 2017; Nair et al., 2017) or the relatively simple picking setup proposed by Popov et al. (2017), which consists of minimal task variation and a variety of additional shaping rewards. In the domain of locomotion, we show that our approach substantially outperforms the direct policy search method proposed by Heess et al. (2017). Curriculum learning has been applied to similar problems in reinforcement learning, with approaches that require the practitioner to design a sequence of progressively harder subsets of the initial state distribution, culminating in the original task (Asada et al., 1996; Karpathy & van de Panne, 2012). Our method allows for arbitrary decompositions, and we further show that DnC can work with automatically generated decompositions without human intervention.
28
+
29
+ Our method is related to guided policy search (GPS) algorithms (Levine & Koltun, 2013; Mordatch & Todorov, 2014; Levine et al., 2016). These algorithms train several “local” policies by using a trajectory-centric reinforcement learning method, and a single “global” policy, typically represented by a deep neural network, which attempts to mimic the local policies. The local policies are constrained to the global policy, typically via a KL-divergence constraint. Our method also trains local policies, though the local policies are themselves represented by more flexible, nonlinear neural network policies. Use of neural network policies significantly improves the representational power of the individual controllers and facilitates the use of various off-the-shelf reinforcement learning algorithms. Furthermore, we constrain the various policies to one another, rather than to a single central policy, which we find substantially improves performance, as discussed in Section 5.
30
+
31
+ Along similar lines, Teh et al. (2017) propose an approach similar to GPS for the purpose of transfer learning, where a single policy is trained to mimic the behavior of policies trained in specific domains. Our approach resembles GPS, in that we decompose a single complex task into local pieces, but also resembles Teh et al. (2017), in that we use nonlinear neural network local policies. Although Teh et al. (2017) propose a method intended for transfer learning, it can be adapted to the setting of stochastic initial states for comparison. We present results demonstrating that our approach substantially outperforms the method of Teh et al. (2017) in this setting.
32
+
33
+ # 3 PRELIMINARIES
34
+
35
+ An episodic Markov decision process (MDP) is defined as $\mathbf { M } = ( S , \mathcal { A } , P , r , \rho )$ where $s , A$ are continuous sets of states and actions respectively. $P ( s ^ { \prime } , s , a )$ is the transition probability distribution, $r : { \mathcal { S } } \mathbb { R }$ is the reward function, and $\rho : S \to \mathbb { R } _ { + }$ is the initial state distribution. We consider a modified MDP formulation, where the initial state distribution is conditioned on some variable $\omega$ , which we refer to as a “context.” Formally, $\Omega = ( \omega _ { i } ) _ { i = 1 } ^ { n }$ is a finite set of contexts, and $\rho : \Omega \times S $ $\mathbb { R } _ { + }$ is a joint distribution over contexts $\omega$ and initial states $s _ { 0 }$ . One can imagine that sampling initial states is a two stage process: first, contexts are sampled as $\rho ( \omega )$ , and then initial states are drawn given the sampled context as $\rho ( s | \omega )$ . Note that this formulation of a MDP with context is unrelated to the similarly named “contextual MDPs” (Hallak et al., 2015).
36
+
37
+ For an arbitrary MDP, one can embed the context into the state as an additional state variable with independent distribution structure that factorizes as $P ( s _ { 0 } , \omega ) = P ( s _ { 0 } | \omega ) P ( \omega )$ . The context will provide us with a convenient mechanism to solve complex tasks, but we will describe how we can still train policies that, at convergence, no longer require any knowledge of the context, and operate only on the raw state of the MDP. We aim to find a stochastic policy $\pi : { \mathcal { S } } , { \mathcal { A } } \to \mathbb { R } _ { + }$ under which the expected reward of the policy $\eta ( \pi ) = \operatorname { \mathbb { E } } _ { \tau \sim \pi } [ r ( \tau ) ]$ is maximized.
38
+
39
+ # 4 DIVIDE-AND-CONQUER REINFORCEMENT LEARNING
40
+
41
+ In this section, we derive our divide-and-conquer reinforcement learning algorithm. We first motivate the approach by describing a policy learning framework for the MDP with context described above, and then introduce a practical algorithm that can implement this framework for complex reinforcement learning problems.
42
+
43
+ # 4.1 LEARNING POLICIES FOR MDPS WITH CONTEXT
44
+
45
+ We consider two extensions of the MDP M that exploit this contextual structure. First, we define an augmented MDP $\mathbf { M } ^ { \prime }$ that augments each state with information about the context $( \boldsymbol { S } \times \Omega , \boldsymbol { A } , P , \boldsymbol { r } , \rho )$ ; a trajectory in this MDP is $\bar { \tau = } ( ( \omega , s _ { 0 } ) , a _ { 0 } , ( \omega , s _ { 1 } ) , a _ { 1 } , \ldots )$ . We also consider the class of contextrestricted MDPs: for a context $\omega$ , we have $\mathbf { M } _ { \omega } = ( S , A , P , r , \rho _ { \omega } )$ , where $\rho _ { \omega } ( s ) = \mathbb { P } ( s | \Omega = \omega )$ ; i.e. the context is always fixed to $\omega$ .
46
+
47
+ A stochastic policy $\pi$ in the augmented MDP $\mathbf { M } ^ { \prime }$ decouples into a family of simpler stochastic policies $\pi = ( \pi _ { i } ) _ { i = 1 } ^ { n }$ , where $\pi _ { i } : { \mathcal { S } } , { \mathcal { A } } \to [ 0 , 1 ]$ , and $\pi _ { i } ( s , a ) = \pi ( ( \omega _ { i } , s ) , a )$ . We can consider $\pi _ { i }$ to be a policy for the context-restricted MDP $\mathbf { M } _ { \omega _ { i } }$ , resulting in an equivalence between optimal policies in augmented MDPs and context-restricted MDPs. A family of optimal policies in the class of context-restricted MDPs is an optimal policy $\pi$ in $\mathbf { M } ^ { \prime }$ .This implies that policy search in the augmented MDP reduces to policy search in the context-restricted MDPs.
48
+
49
+ Given a stochastic policy in the augmented MDP $( \pi _ { i } ) _ { i = 1 } ^ { n }$ , we can induce a stochastic policy $\pi _ { c }$ in the original MDP, by defining $\begin{array} { r } { \pi _ { c } ( s , a ) = \sum _ { \omega \in \Omega } p ( \omega | s ) \overline { { \pi _ { \omega } } } ( s , a ) } \end{array}$ , where $p ( \cdot | s )$ is a belief distribution of what context the trajectory is in. From here on, we refer to $\pi _ { c }$ as the central or global policy, and $\pi _ { i }$ as the context-specific or local policies.
50
+
51
+ Our insight is that it is important for each local policy to not only be good for its designated context, but also be capable of working in other contexts. Requiring that local policies be capable of working broadly allows for sharing of information so that local policies designated for difficult contexts can bootstrap their solutions off easier contexts. As discussed in the previous section, we seek a policy in the original MDP, and local policies that generalize well to many other contexts induce global policies that are capable of operating in the original MDP, where no context is provided.
52
+
53
+ In order to find the optimal policy for the original MDP, we search for a policy $\pi = ( \pi _ { i } ) _ { i = 1 } ^ { n }$ in the augmented MDP that maximizes $\eta ( \pi ) - \alpha \mathbb { E } _ { \pi } [ D _ { K L } ( \pi \| \pi _ { c } ) ] :$ maximizing expected reward for each instance while remaining close to a central policy, where $\alpha$ is a penalty hyperparameter. This encourages the central policy $\pi _ { c }$ to work for all the contexts, thereby transferring to the original
54
+
55
+ MDP. Using Jensen’s inequality to bound the KL divergence between $\pi$ and $\pi _ { c }$ , we minimize the right hand side of Equation 1 as a bound for minimizing the intractable KL divergence optimization problem.
56
+
57
+ $$
58
+ \mathbb { E } _ { \pi } [ D _ { K L } ( \pi \| \pi _ { c } ) ] \leq \sum _ { i , j } \rho ( \omega _ { i } ) \rho ( \omega _ { j } ) \mathbb { E } _ { \pi _ { i } } [ D _ { K L } ( \pi _ { i } \| \pi _ { j } ) ]
59
+ $$
60
+
61
+ Equation 1 shows that finding a set of local policies that translates well into a global policy reduces into minimizing a weighted sum of pairwise KL divergence terms between local policies.
62
+
63
+ # 4.2 THE DIVIDE-AND-CONQUER REINFORCEMENT LEARNING ALGORITHM
64
+
65
+ We now present a policy optimization algorithm that takes advantage of this contextual starting state, following the framework discussed in the previous section. Given an MDP with structured initial state variation, we add contextual information by inducing contexts from a partition of the initial state distribution. More precisely, for a partition of $\textstyle S = \bigcup _ { i = 1 } ^ { n } S _ { i }$ , we associate a context $\omega _ { i }$ to each set $S _ { i }$ , so that $\omega = \omega _ { i }$ when $s _ { 0 } \in S _ { i }$ . This partition of the initial state space is generated by sampling initial states from the MDP, and running an automated clustering procedure. We use $\mathbf { k }$ -means clustering in our evaluation, since we focus on tasks with highly stochastic and structured initial states, and recommend alternative procedures for tasks with more intricate stochasticity.
66
+
67
+ Having retrieved contexts $( \omega _ { i } ) _ { i = 1 } ^ { n }$ , we search for a global policy $\pi _ { c }$ by learning local policies $( \pi _ { i } ) _ { i = 1 } ^ { n }$ that maximize expected reward in the individual contexts, while constrained to not diverge from one another. We modify policy gradient algorithms, which directly optimize the parameters of a stochastic policy through local gradient-based methods, to optimize the local policies with our constraints.
68
+
69
+ In particular, we base our algorithm on trust region policy optimization, TRPO, (Schulman et al., 2015), a policy gradient method which takes gradient steps according to the surrogate loss ${ \mathcal { L } } ( \pi )$ in Equation 2 while constraining the mean divergence from the old policy by a fixed constant.
70
+
71
+ $$
72
+ { \mathcal { L } } ( \pi ) = - \mathbb { E } _ { \pi _ { o l d } } \left[ A ( s , a ) { \frac { \pi ( a | s ) } { \pi _ { o l d } ( a | s ) } } \right]
73
+ $$
74
+
75
+ We choose TRPO for its practical performance on high-dimensional continuous control problems, but our procedure extends easily to other policy gradient methods (Kakade, 2002; Williams, 1992) as well.
76
+
77
+ In our framework, we optimize $\eta ( \pi ) - \alpha \mathbb { E } _ { \pi } [ D _ { K L } ( \pi \| \pi _ { c } ) ]$ , where $\alpha$ determines the relative balancing effect of expected reward and divergence. We adapt the TRPO surrogate loss to this objective, and with the bound in Equation 1, the surrogate objective simplifies to
78
+
79
+ $$
80
+ \mathcal { L } ( \pi _ { 1 } \dots \pi _ { n } ) = - \sum _ { i = 1 } ^ { n } \mathbb { E } _ { \pi _ { i , o l d } } \left[ A ( s , a ) \frac { \pi _ { i } ( a | s ) } { \pi _ { i , o l d } ( a | s ) } \right] + \alpha \left( \sum _ { i , j } \rho ( \omega _ { i } ) \rho ( \omega _ { j } ) \mathbb { E } _ { \pi _ { i } } \left[ D _ { K L } ( \pi _ { i } | | \pi _ { j } ) \right] \right)
81
+ $$
82
+
83
+ The KL divergence penalties encourage each local policy $\pi _ { i }$ to be close to other local policies on its own context $\omega _ { i }$ , and to mimic the other local policies on other contexts. As with standard policy gradients, the objective for $\pi _ { i }$ uses trajectories from context $\omega _ { i }$ , but the constraint on other contexts adds additional dependencies on trajectories from all the other contexts $( \omega _ { j } ) _ { j \neq i }$ . Despite only taking actions in a restricted context, each local policy is trained with data from the full context distribution. In Equation 4, we consider the loss as a function of a single local policy $\pi _ { i }$ , which reveals the dependence on data from the full context distribution, and explicitly lists the pairwise KL divergence penalties.
84
+
85
+ $$
86
+ \Sigma ( \pi ) \propto _ { \pi _ { i } } \underbrace { - \mathbb { E } _ { \pi _ { i , o l d } } \left[ A ( s , a ) \frac { \pi _ { i } ( a | s ) } { \pi _ { i , o l d } ( a | s ) } \right] } _ { \mathrm { M a x i m i z e s ~ } \eta ( \pi _ { i } ) } + \alpha \rho ( \omega _ { i } ) \sum _ { j } \rho ( \omega _ { j } ) \left( \underbrace { \mathbb { E } _ { \pi _ { i } } [ D _ { K L } ( \pi _ { i } | | \pi _ { j } ) ] } _ { \mathrm { C o n s t r a i n t o n ~ o n e n t e x t } } + \underbrace { \mathbb { E } _ { \pi _ { j } } [ D _ { K L } ( \pi _ { j } | | \pi _ { i } ) ] } _ { \mathrm { C o n s t r a i n t o n ~ o n e r ~ c o n e x t } } \right)
87
+ $$
88
+
89
+ On each iteration, trajectories from each context-restricted MDP $\mathbf { M } _ { \omega _ { i } }$ are collected using $\pi _ { i }$ , and each local policy $\pi _ { i }$ takes a gradient step with the surrogate loss in succession. It should be noted that the cost of evaluating and optimizing the KL divergence penalties grows quadratically with the number of contexts, as the number of penalty terms is quadratic. For practical tasks however, the number of contexts will be on the order of 5-10, and the quadratic cost imposes minimal overhead for the TRPO conjugate gradient evaluation.
90
+
91
+ After repeating the trajectory collection and policy optimization procedure for a fixed number of iterations, we seek to retrieve $\pi _ { c }$ , a central policy in the original task from the local policies trained via TRPO. As discussed in Section 4.1, this corresponds to minimizing the KL divergence between $\pi$ and $\pi _ { c }$ , which neatly simplifies into a maximum likelihood problem with samples from all the various policies.
92
+
93
+ $$
94
+ \mathcal { L } _ { c e n t e r } ( \pi _ { c } ) = \mathbb { E } _ { \pi } [ D _ { K L } ( \pi ( \cdot | s ) \| \pi _ { c } ( \cdot | s ) ) ] \propto \sum _ { i } \rho ( \omega _ { i } ) \mathbb { E } _ { \pi _ { i } } \left[ - \log \pi _ { c } ( s , a ) \right]
95
+ $$
96
+
97
+ If $\pi _ { c }$ performs inadequately on the full task, the local policy training procedure is repeated, initializing the local policies to start at $\pi _ { c }$ . We alternately optimize the local policies and the global policy in this manner, until convergence. The algorithm is laid out fully in pseudocode below.
98
+
99
+ <table><tr><td>R ←Distillation Period function DNC()</td></tr><tr><td>Sample initial states so from the task</td></tr><tr><td>Produce contexts W1, W2,...Wn by clustering initial states so</td></tr><tr><td>Randomly initialize central policy Tc</td></tr><tr><td>for t = 1,2... until convergence do</td></tr><tr><td>Setπi=πc foralli=1...n</td></tr><tr><td>for R iterations do</td></tr><tr><td>Collect trajectories Ti in context wi using policy πi for all i = 1...n for all local policies Ti do</td></tr><tr><td>Take gradient step in surrogate loss L wrt Ti</td></tr><tr><td>Minimize Lcenter W.r.t. πc using previously sampled states (Ti)=1</td></tr><tr><td>return Tc</td></tr></table>
100
+
101
+ # 5 EXPERIMENTAL EVALUATION
102
+
103
+ We focus our analysis on tasks spanning two different domains: manipulation and locomotion. Manipulation tasks involve handling an un-actuated object with a robotic arm, and locomotion tasks involve tackling challenging terrains. We illustrate a variety of behaviors in both settings. Standard continuous control benchmarks are known to represent relatively mild representational challenges (Rajeswaran et al., 2017b), and thus it was important to design new tasks that are more challenging in order to illustrate the potential of proposed approach. Tasks were designed to bring out complex contact rich behaviors in settings with considerable variation and diversity. All of our environments are designed and simulated in MuJoCo (Todorov et al., 2012).
104
+
105
+ Our experiments and analysis aim to address the following questions:
106
+
107
+ 1. Can DnC solve highly complex tasks in a variety of domains, especially tasks that cannot be solved with current conventional policy gradient methods? 2. How does the form of the constraint on the ensemble policies in DnC affect the performance of the final policy, as compared to previously proposed constraints?
108
+
109
+ We compare DnC to the following prior methods and ablated variants:
110
+
111
+ • TRPO. TRPO (Schulman et al., 2015) represents a state-of-the-art policy gradient method, which we use for the standard RL comparison without decomposition into contexts. TRPO is provided with the same batch size as the sum of the batches over all of the policies in our algorithm, to ensure a fair comparison. Distral. Originally formulated as transfer learning in a discrete action space (Teh et al., 2017), we extend Distral to our stochastic initial state continuous control setting, where each context $\omega$ is a different task. For proper comparison between the algorithms, we port
112
+
113
+ Distral to the TRPO objective, since empirically TRPO outperforms other policy gradient methods in this domain. This algorithm, which resembles the structure of guided policy search, also trains an ensemble of policies, but constrains them at each gradient step against a single global policy trained with supervised learning, and omits the distillation step that our method performs every $R$ iterations.
114
+
115
+ • Unconstrained DnC. We run the DnC algorithm without any KL constraints. This reduces to running TRPO to train policies $( \pi _ { i } ) _ { i = 1 } ^ { n }$ on each context, and distilling the resulting local policies every $R$ iterations.
116
+
117
+ • Centralized DnC. Whereas DnC doesn’t perform inference on context, centralized DnC uses an oracle to perfectly identify the context $\omega$ from the state $s$ . The resulting algorithm is equivalent to the Distral objective, but distills every $R$ steps.
118
+
119
+ Performance of these methods is highly dependent on the choice of $\alpha$ , the penalty hyperparameter that controls how tightly to couple the local policies. For each task, we run a hyperparameter sweep for each method, showing results for the best penalty weight. Furthermore, performance of policy gradient methods like TRPO varies significantly from run to run, so we run each experiment with 5 random seeds, reporting mean statistics and standard deviations. The experimental procedure is detailed more extensively in Appendix A.
120
+
121
+ For each evaluation task, we use a k-means clustering procedure to partition the initial state space into four contexts, which we found empirically to create stable partitions, and yield high performance across algorithms. We further detail the clustering procedure and examine the effect of partition size on DnC in Appendix C. The focus of our work is finding a single global policy that performs well on the full state space, but we further compare to oracle-based ensemble policies in Appendix D.
122
+
123
+ # 6 ROBOTIC MANIPULATION
124
+
125
+ For robotic manipulation, we simulate the Kinova Jaco, a 7 DoF robotic arm with 3 fingers. The agent receives full state information, which includes the current absolute location of external objects such as boxes. The agent uses low-level joint torque control to perform the required actions. Note that use of low-level torque control significantly increases complexity, as raw torque control on a 7 DoF arm requires delicate movements of the joints to perform each task. We describe the tasks below, and present full specifics in Appendix B.
126
+
127
+ Picking. The Picking task requires the Jaco to pick up a small block and raise it as high as possible. The agent receives reward only when the block is in the agent’s hand. The starting position of the block is randomized within a fixed $3 0 \mathrm { c m }$ by $3 0 \mathrm { c m }$ square surface on the table. Picking up the block from different locations within the workspace require diverse poses, making this task challenging in the torque control framework. TRPO can only solve the picking task from a 4cm by 4cm workspace, and from wider configurations, the Jaco fails to grasp with a high success rate with policies learnt via TRPO.
128
+
129
+ Lobbing. The Lobbing task requires the Jaco to flick a block into a target box, which is placed in a randomized location within a 1m by 1m square, far enough that the arm cannot reach it directly. This problem inherits many challenges from the picking task. Furthermore, the sequential nature of grasping and flicking necessitates that information pass temporally and requires synthesis of multiple skills.
130
+
131
+ Catching. In the Catching task, a ball is thrown at the robot with randomized initial position and velocity, and the arm must catch it in the air. Fixed reward is awarded every step that the ball is in or next to the hand. This task is particularly challenging due the temporal sensitivity of the problem, since the end-effector needs to be in perfect sync with the flying object successfully finish the grasp. This extreme temporal dependency renders stochastic estimates of the gradients ineffective in guiding the learning.
132
+
133
+ DnC exceeds the performance of the alternative methods on all of the manipulation tasks, as shown in Figure 1. For each task, we include the average reward, as well as a success rate measure, which provides a more interpretable impression of the performance of the final policy. TRPO by itself is unable to solve any of the tasks, with success rates below $10 \%$ in each case. The policies learned by
134
+
135
+ ![](images/d7369b44ff08b0fde7b1c188d2da07b91bd7675d1c7ced992eddcb40c0ff8bb6.jpg)
136
+ Figure 1: Average return and success rate learning curves of the global policy on Picking, Lobbing, Catching, Ant, and Stairs when partitioned into 4 contexts. Metrics are evaluated each iteration on the global policy distilled from the current local policies at that iteration. On all of the tasks, DnC RL achieves the best results. On the Catching and Ant tasks, DnC performs comparably to the centralized variant, while on the Picking, Lobbing, and Stairs tasks, the full algorithm outperforms all others by a wide margin. All of the experiments are shown with 5 random seeds.
137
+
138
+ <table><tr><td></td><td>Picker</td><td>Lobber</td><td>Catcher</td><td>Ant Position</td><td>Stairs</td></tr><tr><td>TRPO</td><td>0.5± 0.2</td><td>23.5±1.2</td><td>6.6 ±1.3</td><td>23.7 ± 3.0</td><td>563.7 ± 61.2</td></tr><tr><td>Distral</td><td>23.0± 5.0</td><td>31.4 ± 0.7</td><td>36.9 ± 4.5</td><td>137.5 ± 1.5</td><td>616.0 ± 121.3</td></tr><tr><td>Unconstrained</td><td>16.9 ± 5.2</td><td>32.3 ± 0.8</td><td>40.2 ± 2.9</td><td>138.8 ± 4.2</td><td>1087.0 ± 196.8</td></tr><tr><td>Centralized DnC (ours)</td><td>37.2 ± 8.7</td><td>31.8 ± 0.5</td><td>46.6 ± 3.5</td><td>138.6 ± 4.4</td><td>1018.1 ± 207.1</td></tr><tr><td>DnC (ours)</td><td>55.3 ± 6.3</td><td>41.3 ± 0.4</td><td>48.9 ± 1.0</td><td>146.3 ± 1.3</td><td>1137.6 ± 71.5</td></tr></table>
139
+
140
+ Table 1: Overall performance comparison between DnC and competing methods, based on final average return. Performance varies from run to run, so we run each experiment with five random seeds. For each of the tasks, the best performing method is $\mathrm { D n C }$ or centralized DnC.
141
+
142
+ TRPO are qualitatively reasonable, but lack the intricate details required to address the variability of the task.
143
+
144
+ TRPO fails because of the high stochasticity in the problem and the diversity of optimal behaviour for various initial states, because the algorithm cannot make progress on the full task with such noisy gradients. When we partition the manipulation tasks into contexts, the behavior within each context is much more homogeneous.
145
+
146
+ Figure 1 shows that DnC outperforms both the adapted Distral variant and the two ablations of our method. On the picking task, DnC has a $16 \%$ higher success rate than the next best method, which is an ablated variant of DnC, and on the lobbing task, places the object three times closer to the goal as the other methods do. Both the pairwise KL penalty and the periodic reset in DnC appear to be crucial for the algorithm’s performance. In contrast to the methods that share information exclusively though a single global policy, the pairwise KL terms allow for more efficient information exchange. On the Picking task, the centralized variant of DnC struggles to pick up the object pockets along the boundaries of the contexts, likely because the local policies differ too much in these regions, and centralized distillation is insufficient to produce effective behavior.
147
+
148
+ On the catching task (Figure 1c), the baselines which are distilled every 100 iterations (the DnC variants) all perform well, whereas Distral lags behind. The policy learned by Distral grasps the ball from an awkward orientation, so the grip is unstable and the ball quickly drops out. Since Distral does not distill and reset the local policies, it fails to escape this local optimal behaviour.
149
+
150
+ # 7 LOCOMOTION
151
+
152
+ Our locomotion tasks involve learning parameterized navigation skills in two domains.
153
+
154
+ Ant Position In the Ant Position task, the quadruped ant is tasked with reaching a particular goal position; the exact goal position is randomly selected along the perimeter of a circle $5 \mathrm { m }$ in radius for each trajectory. The ant is penalized for its distance from the goal every timestep. Although moving the ant in a single direction is solved, training an ant to walk to an arbitrary point is difficult because the task is symmetric and the global gradients may be dampened by noise in several directions.
155
+
156
+ Stairs In the Stairs task, a planar (2D) bipedal robot must climb a set of stairs, where the stairs have varying heights and lengths. The agent is rewarded for forward progress. Unlike the other tasks in this paper, there exists a single gait that can solve all possible heights, since a policy that can clear the highest stair can also clear lower stairs with no issues. However, optimal behavior that maximizes reward will maintain more specialized gaits for various heights. The agent locally observes the structure of the environment via a perception system that conveys the information about the height of the next step. This task is particularly interesting because it requires the agent to compose and maintain various gaits in an diverse environment with rich contact dynamics.
157
+
158
+ As in manipulation, we find that DnC performs either on par or better than all of the alternative methods on each task. TRPO is able to solve the Ant task, but requires 400 million samples, whereas variants of our method solve the task in a tenth of the sample complexity. Initial behaviour of TRPO has the ant moving in random directions throughout a trajectory, unable to clearly associate movement in a direction with the goal reward. On the Stairs task, TRPO learns to take long striding gaits that perform well on shorter stairs but cause the agent to trip on the taller stairs, because the reward signal from the shorter stairs is much stronger. In DnC, by separating the gradient updates by context, we can mitigate the effect of a strong reward signal on a context from affecting the policies of the other contexts.
159
+
160
+ We notice large differences between the gaits learned by the baselines and DnC on the Stairs task. DnC learns a striding gait on shorter stairs, and a jumping gait on taller stairs, but it is clearly visible that the two gaits share structure. In contrast, the other partitioning algorithms learn hopping motions that perform well on tall stairs, but are suboptimal on shorter stairs, so brittle to context.
161
+
162
+ # 8 DISCUSSION AND FUTURE WORK
163
+
164
+ In this paper, we proposed divide-and-conquer reinforcement learning, an RL algorithm that separates complex tasks into a set of local tasks, each of which can be used to learn a separate policy. These separate policies are constrained against one another to arrive at a single, globally coherent solution, which can then be used to solve the task from any initial state. Our experimental results show that divide-and-conquer reinforcement learning substantially outperforms standard RL algorithms that samples initial and goal states from their respective distributions at each trial, as well as previously proposed methods that employ ensembles of policies. For each of the domains in our experimental evaluation, standard policy gradient methods are generally unable to find a successful solution.
165
+
166
+ Although our approach improves on the power of standard reinforcement learning methods, it does introduce additional complexity due to the need to train ensembles of policies. Sharing of information across the policies is accomplished by means of KL-divergence constraints, but no other explicit representation sharing is provided. A promising direction for future research is to both reduce the computational burden and improve representation sharing between trained policies with both shared and separate components. Exploring this direction could yield methods that are more efficient both computationally and in terms of experience.
167
+
168
+ # ACKNOWLEDGEMENTS
169
+
170
+ This research was supported by the National Science Foundation through IIS-1651843 and IIS1614653, an ONR Young Investigator Program award, and Berkeley DeepDrive.
171
+
172
+ # REFERENCES
173
+
174
+ Marcin Andrychowicz, Filip Wolski, Alex Ray, Jonas Schneider, Rachel Fong, Peter Welinder, Bob McGrew, Josh Tobin, Pieter Abbeel, and Wojciech Zaremba. Hindsight experience replay. CoRR, abs/1707.01495, 2017.
175
+
176
+ Minoru Asada, Shoichi Noda, Sukoya Tawaratsumida, and Koh Hosoda. Purposive behavior acquisition for a real robot by vision-based reinforcement learning. Machine Learning, 1996.
177
+
178
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym, 2016.
179
+
180
+ Assaf Hallak, Dotan Di Castro, and Shie Mannor. Contextual Markov Decision Processes. CoRR, abs/1502.02259, 2015.
181
+
182
+ Nicolas Heess, Dhruva TB, Srinivasan Sriram, Jay Lemmon, Josh Merel, Greg Wayne, Yuval Tassa, Tom Erez, Ziyu Wang, S. M. Ali Eslami, Martin A. Riedmiller, and David Silver. Emergence of locomotion behaviours in rich environments. CoRR, abs/1707.02286, 2017.
183
+
184
+ Sham M Kakade. A natural policy gradient. In NIPS, 2002.
185
+
186
+ Andrej Karpathy and Michiel van de Panne. Curriculum Learning for Motor Skills, pp. 325–330. 2012.
187
+
188
+ Jens Kober, Katharina Mulling, and Jan Peters. Learning throwing and catching skills. In ¨ IROS, 2012.
189
+
190
+ Vikash Kumar, Emanuel Todorov, and Sergey Levine. Optimal control with learned local models: Application to dexterous manipulation. In ICRA, 2016.
191
+
192
+ Sergey Levine and Vladlen Koltun. Guided policy search. In ICML, 2013.
193
+
194
+ Sergey Levine, Chelsea Finn, Trevor Darrell, and Pieter Abbeel. End-to-end learning of deep visuomotor policies. Journal of Machine Learning Research (JMLR), 2016.
195
+
196
+ 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.
197
+
198
+ 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.
199
+
200
+ Igor Mordatch and Emanuel Todorov. Combining the benefits of function approximation and trajectory optimization. In RSS, 2014.
201
+
202
+ Igor Mordatch, Kendall Lowrey, Galen Andrew, Zoran Popovic, and Emanuel Todorov. Interactive Control of Diverse Complex Characters with Neural Networks. In NIPS, 2015.
203
+
204
+ Ashvin Nair, Bob McGrew, Marcin Andrychowicz, Wojciech Zaremba, and Pieter Abbeel. Overcoming exploration in reinforcement learning with demonstrations. CoRR, abs/1709.10089, 2017.
205
+
206
+ Takayuki Osa, Jan Peters, and Gerhard Neumann. Experiments with hierarchical reinforcement learning of multiple grasping policies. In ISER, 2016.
207
+
208
+ Ivaylo Popov, Nicolas Heess, Timothy P. Lillicrap, Roland Hafner, Gabriel Barth-Maron, Matej Vecerik, Thomas Lampe, Yuval Tassa, Tom Erez, and Martin A. Riedmiller. Data-efficient deep reinforcement learning for dexterous manipulation. CoRR, abs/1704.03073, 2017.
209
+
210
+ Aravind Rajeswaran, Vikash Kumar, Abhishek Gupta, John Schulman, Emanuel Todorov, and Sergey Levine. Learning complex dexterous manipulation with deep reinforcement learning and demonstrations. CoRR, abs/1709.10087, 2017a.
211
+
212
+ Aravind Rajeswaran, Kendall Lowrey, Emanuel Todorov, and Sham Kakade. Towards Generalization and Simplicity in Continuous Control. In NIPS, 2017b.
213
+
214
+ John Schulman, Sergey Levine, Philipp Moritz, Michael Jordan, and Pieter Abbeel. Trust region policy optimization. In ICML, 2015.
215
+
216
+ Yee Whye Teh, Victor Bapst, Wojciech Marian Czarnecki, John Quan, James Kirkpatrick, Raia Hadsell, Nicolas Heess, and Razvan Pascanu. Distral: Robust multitask reinforcement learning. In NIPS, 2017.
217
+
218
+ Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In IROS, 2012.
219
+
220
+ Ronald J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine Learning, 8(3):229–256, 1992.
221
+
222
+ # A EXPERIMENTAL DETAILS
223
+
224
+ To ensure consistency, all the methods tested are implemented on the TRPO objective function, allowing for comparisons between the various types of constraint. In particular, the Distral algorithm is ported from a soft Q-learning setting to TRPO. TRPO was chosen as it outperforms other policy gradient methods on challenging continuous control tasks. To properly compare TRPO to the partition-based methods for sample efficiency, we increase the number of timesteps of simulation used per policy update for TRPO. Explicitly, if $B$ is the number of timesteps simulated used for a single local policy iteration in $\mathrm { D n C }$ , and $N$ the number of local policies, then we use $B * N$ timesteps for each policy iteration in TRPO.
225
+
226
+ Stochastic policies are parametrized as $\pi _ { \boldsymbol { \theta } } ( a | s ) \sim \mathcal { N } ( \mu _ { \boldsymbol { \theta } } ( s ) , \Sigma _ { \boldsymbol { \theta } } )$ . The mean, $\mu _ { \theta } ( \cdot )$ , is a fullyconnected neural network with 3 hidden layers containing 150, 100, and 50 units respectively. $\Sigma$ is a learned diagonal covariance matrix, and is initially set to $\Sigma = I$ .
227
+
228
+ The primary hyperparameters of concern are the TRPO learning rate $\bar { D } _ { K L }$ and the penalty $\alpha$ . The TRPO learning rate is global to the task; for each task, to find an appropriate learning rate, we ran TRPO with five learning rates $\{ . 0 0 2 5 , . 0 0 5 , . 0 1 , . 0 2 , . 0 4 \}$ . The penalty parameter is not shared across the methods, since a fixed penalty might yield different magnitudes of constraint for each method. We ran DnC, Centralized DnC, and Distral with five penalty parameters on each task. The penalty parameter with the highest final reward was selected for each algorithm on each task. Because of variance of performance between runs, each experiment was replicated with five random seeds, reporting average and SD statistics.
229
+
230
+ <table><tr><td></td><td>Picker</td><td>Lobber</td><td>Catcher</td><td>Ant Position</td><td>Stairs</td></tr><tr><td>State Space Dimension</td><td>34</td><td>40</td><td>34</td><td>146</td><td>41</td></tr><tr><td>Action Space Dimension</td><td>7</td><td>7</td><td>7</td><td>8</td><td>6</td></tr><tr><td># Steps per Local Iteration</td><td>30000</td><td>30000</td><td>30000</td><td>50000</td><td>50000</td></tr><tr><td># Iterations</td><td>1000</td><td>1000</td><td>750</td><td>750</td><td>1000</td></tr><tr><td>Distillation Period</td><td>100</td><td>100</td><td>100</td><td>50</td><td>100</td></tr><tr><td>Learning Rate</td><td>.01</td><td>.02</td><td>.02</td><td>.01</td><td>.02</td></tr></table>
231
+
232
+ # B TASK DESCRIPTIONS
233
+
234
+ All the tasks in this work have the agent operate via low-level joint torque control. For Jaco-related tasks, the action space is 7 dimensional, and the control frequency is $2 0 \mathrm { H z }$ . For target-based tasks, instead of using the true distance to the target, we normalize the distance so the initial distance to the target is 1.
235
+
236
+ Picking The observation space includes the box position, box velocity, and end-effector position. On each trajectory, the box is placed in an arbitrary location within a $3 0 \mathrm { c m }$ by $3 0 \mathrm { c m }$ square surface of the table.
237
+
238
+ $$
239
+ R ( s ) = \mathbf { 1 } \{ \mathrm { B o x ~ i n ~ a i r ~ a n d ~ B o x ~ w i t h i n ~ 8 c m ~ o f ~ J a c o ~ e n d - e f f e c t o r } \}
240
+ $$
241
+
242
+ Lobbing. The observation space includes the box position,box velocity, end-effector position, and target position. On each trajectory, the target location is randomized over a 1m by 1m square.
243
+
244
+ An episode runs until the box is lobbed and lands on the ground. Reward is received only on the final step of the episode when the lobbed box lands; reward is proportional to the box’s time in air, $t _ { a i r }$ , and the box’s normalized distance to target, $d _ { t a r g e t } ^ { \prime }$ .
245
+
246
+ $$
247
+ R ( s ) = t _ { a i r } + 4 0 \operatorname* { m a x } ( 0 , 1 - d _ { t a r g e t } ^ { \prime } )
248
+ $$
249
+
250
+ Catching. The observation space includes the ball position, ball velocity, and end-effector position. On each trajectory, both the ball position and velocity are randomized, while ensuring the ball is still “catchable”.
251
+
252
+ $$
253
+ R ( s ) = \mathbf { 1 } \{ \mathrm { B a l l ~ i n ~ a i r ~ a n d ~ B a l l ~ w i t h i n ~ \& m ~ o f ~ J a c o ~ e n d - e f f e c t o r } \}
254
+ $$
255
+
256
+ Ant Position. The target location of the ant is chosen randomly on a circle with radius $5 \mathrm { m }$ .
257
+
258
+ The reward function takes into account the normalized distance of the ant to target, $d _ { t a r g e t } ^ { \prime }$ , and as with the standard quadruped, the magnitude of torque, $\| a \|$ , and the magnitude of contact force, $\| c \|$ .
259
+
260
+ $$
261
+ R ( s , a ) = 1 - d _ { t a r g e t } ^ { \prime } - 0 . 0 1 \| a \| - 0 . 0 0 1 \| c \|
262
+ $$
263
+
264
+ Stairs. The planar bipedal robot has a perception system which is used to communicate the local terrain. The height of the platforms are given at 25 points evenly spaced from 0.5 meters behind the robot to 1 meters in front. On each trajectory, the heights of stairs are randomized between $5 \mathrm { c m }$ and $2 5 \mathrm { { c m } }$ , and lengths randomized between $5 0 \mathrm { c m }$ and $6 0 \mathrm { c m }$ . The reward weighs the forward velocity $v _ { x }$ , and the torque magnitude $\| a \|$ .
265
+
266
+ $$
267
+ R ( s , a ) = v _ { x } - 0 . 5 \| a \| + 0 . 0 1
268
+ $$
269
+
270
+ # C AUTOMATED PARTITIONING
271
+
272
+ In this section, we detail the procedure used to partition the initial state space into contexts, and examine performance of $\scriptstyle \mathrm { D n C }$ as the number of contexts is varied. 10000 initial states are sampled from the task, and are fed through a $K$ -means clustering procedure to produce $k$ cluster centers $( c _ { i } ) _ { i = 1 } ^ { k }$ . We assign initial states to the context with the closest center:
273
+
274
+ $$
275
+ \omega _ { i } = \arg \operatorname* { m i n } _ { i } \| c _ { i } - s _ { 0 } \| ^ { 2 }
276
+ $$
277
+
278
+ The $\mathbf { k }$ -means procedure is sensitive to the relative scaling of the state, but we found empirically that the clustering procedure yielded sane partitions on all the benchmark tasks. We examine the performance of DnC with this partitioning scheme when split into two,four, and eight contexts respectively, and for comparison, we also include a manually labelled partition. The manual partition into four contexts is a grid decomposition along the axes of stochasticity. To ensure a fair comparison, the sample complexity is kept constant across variants: when run with two contexts, each local policy consumes twice the number of samples as when run with four contexts.
279
+
280
+ <table><tr><td></td><td>Picker</td><td>Lobber</td><td>Catcher</td><td>Ant Position</td><td>Stairs</td></tr><tr><td>2 Contexts</td><td>14.7± 2.2</td><td>42.0 ± 0.7</td><td>39.2 ± 9.4</td><td>145.2 ± 1.5</td><td>1040.8 ± 44.2</td></tr><tr><td>4 Contexts</td><td>55.3± 6.3</td><td>41.3 ± 0.4</td><td>48.9 ± 1.0</td><td>146.3 ± 1.3</td><td>1137.6 ± 71.5</td></tr><tr><td>4 Contexts (Manual)</td><td>44.5 ± 6.8</td><td>42.2 ± 0.7</td><td>35.8 ± 4.1</td><td>81.7 ± 1.8</td><td>1218.2 ± 27.8</td></tr><tr><td>8 Contexts</td><td>51.0 ± 4.3</td><td>40.6 ± 0.6</td><td>43.8 ± 3.7</td><td>133.4 ± 3.3</td><td>1084.9 ± 41.0</td></tr></table>
281
+
282
+ On all the tasks, running DnC with four contexts is either the best performing method, or closely matches the best performing method. This indicates a balance between representation sharing within a context, and the benefit from optimizing over small contexts. When run with two contexts, the contexts being optimized over are relatively large, and thus face many of the same issues as TRPO in extracting a signal from a noisy gradient, perhaps best seen in the Picking task. The performance increase from TRPO to two-context DnC however seems to indicate that the distillation and reset of local policies prevents the learning algorithm from being stuck in local optima. When run with eight tasks, we notice a representation sharing issue, since even between very similar initial states, information can only be shared through the KL constraint, which is a bottleneck. This analysis indicates that the choice of the number of clusters is a trade-off between having large enough contexts to share information freely between similar states, and having small enough states to overcome the noise in the policy gradient signal.
283
+
284
+ ![](images/34eb842b19e91b72b2ce08b8eefdb6a70c493f224edd4fb1b35e40a824a56f56.jpg)
285
+
286
+ # D ORACLE-BASED ABLATIONS
287
+
288
+ Whereas DnC maintains a global policy to run on all contexts, we consider in this section ablations whose final output is an ensemble of local policies, choosing the appropriate policy on each trajectory via oracle.
289
+
290
+ Final Local Policies We run the DnC algorithm, and return the ensemble of final local policies instead of the resulting global policy. This method is expected to outperform DnC, since the global policy should be strictly worse than the local ensemble. However, as seen in the table below, the gap in performance is low for the majority of tasks, showing that minimal information is lost in transferring from the ensemble of local policies to the global policy.
291
+
292
+ <table><tr><td></td><td>Picker</td><td>Lobber</td><td>Catcher</td><td>Ant Position</td><td>Stairs</td></tr><tr><td>Final Global Policy (DnC)</td><td>55.3 ± 6.3</td><td>41.3 ± 0.4</td><td>48.9 ±1.0</td><td>146.3 ± 1.3</td><td>1137.6 ± 71.5</td></tr><tr><td>Final Local Policies</td><td>56.6 ± 6.4</td><td>41.2 ± 0.4</td><td>50.2±0.7</td><td>146.6 ± 0.5</td><td>1170.0 ± 68.4</td></tr></table>
293
+
294
+ No Distillation We run the DnC algorithm, discarding the distillation step every $R$ iterations. This is equivalent to training local policies with pairwise KL constraints till convergence, and considering the resulting ensemble of local policies. We notice that DnC significantly outperforms the variant without distillation on three of the tasks, and has equivalent performance on the other two. We hypothesize this is because the local policies often become trapped in local minima, and the distillation step helps adjust the policy out of the optima. This is consistent with observations in previous work involving trajectory optimization (Mordatch et al., 2015), where adding a central neural network to which trajectories were distilled significantly increased performance.
295
+
296
+ <table><tr><td></td><td>Picker</td><td>Lobber</td><td>Catcher</td><td>Ant Position</td><td>Stairs</td></tr><tr><td>Distillation (DnC)</td><td>55.3 ± 6.3</td><td>41.3 ± 0.4</td><td>48.9 ± 1.0</td><td>146.3 ± 1.3</td><td>1137.6 ± 71.5</td></tr><tr><td>No Distillation</td><td>30.2±6.8</td><td>40.6 ± 1.0</td><td>20.3±2.7</td><td>69.8 ± 1.4</td><td>919.5 ± 28.2</td></tr></table>
md/train/rJxDkvqee/rJxDkvqee.md ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MULTI-VIEW RECURRENT NEURALACOUSTIC WORD EMBEDDINGS
2
+
3
+ # Wanjia He
4
+
5
+ Department of Computer Science University of Chicago Chicago, IL 60637, USA wanjia@ttic.edu
6
+
7
+ Weiran Wang & Karen Livescu Toyota Technological Institute at Chicago Chicago, IL 60637, USA {weiranwang,klivescu}@ttic.edu
8
+
9
+ # ABSTRACT
10
+
11
+ Recent work has begun exploring neural acoustic word embeddings—fixeddimensional vector representations of arbitrary-length speech segments corresponding to words. Such embeddings are applicable to speech retrieval and recognition tasks, where reasoning about whole words may make it possible to avoid ambiguous sub-word representations. The main idea is to map acoustic sequences to fixed-dimensional vectors such that examples of the same word are mapped to similar vectors, while different-word examples are mapped to very different vectors. In this work we take a multi-view approach to learning acoustic word embeddings, in which we jointly learn to embed acoustic sequences and their corresponding character sequences. We use deep bidirectional LSTM embedding models and multi-view contrastive losses. We study the effect of different loss variants, including fixed-margin and cost-sensitive losses. Our acoustic word embeddings improve over previous approaches for the task of word discrimination. We also present results on other tasks that are enabled by the multi-view approach, including cross-view word discrimination and word similarity.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Word embeddings—continuous-valued vector representations of words—are an almost ubiquitous component of recent natural language processing (NLP) research. Word embeddings can be learned using spectral methods (Deerwester et al., 1990) or, more commonly in recent work, via neural networks (Bengio et al., 2003; Mnih & Hinton, 2007; Mikolov et al., 2013; Pennington et al., 2014). Word embeddings can also be composed to form embeddings of phrases, sentences, or documents (Socher et al., 2014; Kiros et al., 2015; Wieting et al., 2016; Iyyer et al., 2015).
16
+
17
+ In typical NLP applications, such embeddings are intended to represent the semantics of the corresponding words/sequences. In contrast, embeddings that represent the way a word or sequence sounds are rarely considered. In this work we address this problem, starting with embeddings of individual words. Such embeddings could be useful for tasks like spoken term detection (Fiscus et al., 2007), spoken query-by-example search (Anguera et al., 2014), or even speech recognition using a whole-word approach (Gemmeke et al., 2011; Bengio & Heigold, 2014). In tasks that involve comparing speech segments to each other, vector embeddings can allow more efficient and more accurate distance computation than sequence-based approaches such as dynamic time warping (Levin et al., 2013, 2015; Kamper et al., 2016; Settle & Livescu, 2016; Chung et al., 2016).
18
+
19
+ We consider the problem of learning vector representations of acoustic sequences and orthographic (character) sequences corresponding to single words, such that the learned embeddings represent the way the word sounds. We take a multi-view approach, where we jointly learn the embeddings for character and acoustic sequences. We consider several contrastive losses, based on learning from pairs of matched acoustic-orthographic examples and randomly drawn mismatched pairs. The losses correspond to different goals for learning such embeddings; for example, we might want the embeddings of two waveforms to be close when they correspond to the same word and far when they correspond to different ones, or we might want the distances between embeddings to correspond to some ground-truth orthographic edit distance.
20
+
21
+ One of the useful properties of this multi-view approach is that, unlike earlier work on acoustic word embeddings, it produces both acoustic and orthographic embeddings that can be directly compared. This makes it possible to use the same learned embeddings for multiple single-view and cross-view tasks. Our multi-view embeddings produce improved results over earlier work on acoustic word discrimination, as well as encouraging results on cross-view discrimination and word similarity.1
22
+
23
+ # 2 OUR APPROACH
24
+
25
+ In this section, we first introduce our approach for learning acoustic word embeddings in a multiview setting, after briefly reviewing related approaches to put ours in context. We then discuss the particular neural network architecture we use, based on bidirectional long short-term memory (LSTM) networks (Hochreiter & Schmidhuber, 1997).
26
+
27
+ # 2.1 MULTI-VIEW LEARNING OF ACOUSTIC WORD EMBEDDINGS
28
+
29
+ Previous approaches have focused on learning acoustic word embeddings in a “single-view” setting. In the simplest approach, one uses supervision of the form “acoustic segment $\mathbf { x }$ is an instance of the word dataset oing optim $\mathbf { y } ^ { \mathsf { , , } \mathsf { , } }$ , and trains the embedding to be discriired acoustic segments and word labels tion: word identity. Formally, given a, this approach solves the follow$\{ ( \mathbf { x } _ { i } , \mathbf { y } _ { i } ) \} _ { i = 1 } ^ { N }$
30
+
31
+ $$
32
+ \operatorname* { m i n } _ { f , h } { \mathrm { \ o b j } _ { c l a s s i f y } } : = \frac { 1 } { N } \sum _ { i } ^ { N } \ell \left( h ( f ( \mathbf { x } _ { i } ) ) , \mathbf { y } _ { i } \right) ,
33
+ $$
34
+
35
+ where network $f$ maps an acoustic segment into a fixed-dimensional feature vector/embedding, $h$ is a classifier that predicts the corresponding word label from the label set of the training data, and the loss $\ell$ measures the discrepancy between the prediction and ground-truth word label (one can use any multi-class classification loss here, and a typical choice is the cross-entropy loss where $h$ has a softmax top layer). The two networks $f$ and $h$ are trained jointly. Equivalently, one could consider the composition $h ( f ( \mathbf { x } ) )$ as a classifier network, and use any intermediate layer’s activations as the features. We refer to the objective in (1) as the “classifier network” objective, which has been used in several prior studies on acoustic word embeddings (Bengio & Heigold, 2014; Kamper et al., 2016; Settle & Livescu, 2016).
36
+
37
+ This objective, however, is not ideal for learning acoustic word embeddings. This is because the set of possible word labels is huge, and we may not have enough instances of each label to train a good classifier. In downstream tasks, we may encounter acoustic segments of words that did not appear in the embedding training set, and it is not clear that the classifier-based embeddings will have reasonable behavior on previously unseen words.
38
+
39
+ An alternative approach, based on Siamese networks (Bromley et al., 1993), uses supervision of the form “segment $\mathbf { \dot { x } } ^ { \hat { 1 } }$ is similar to segment $\mathbf { x } ^ { 2 }$ , and is not similar to segment $\mathbf { x } ^ { 3 } \mathbf { \ ' }$ ”, where two segments are considered similar if they have the same word label and dissimilar otherwise. Models based on Siamese networks have been used for a variety of representation learning problems in NLP $\mathrm { H u }$ et al., 2014; Wieting et al., 2016), vision (Hadsell et al., 2006), and speech (Synnaeve et al., 2014; Kamper et al., 2015) including acoustic word embeddings (Kamper et al., 2016; Settle & Livescu, 2016). A typical objective in this category enforces that the distance between $( \mathbf { x } ^ { 1 } , \mathbf { x } ^ { 3 } )$ is larger than the distance between $( \mathbf { x } ^ { 1 } , \mathbf { x } ^ { 2 } )$ by some margin:
40
+
41
+ $$
42
+ \operatorname* { m i n } _ { f } \ \mathrm { o b j } _ { s i a m e s e } : = \frac { 1 } { N } \sum _ { i } ^ { N } \operatorname* { m a x } \left( 0 , \ m + d i s \left( f ( \mathbf { x } _ { i } ^ { 1 } ) , \ f ( \mathbf { x } _ { i } ^ { 2 } ) \right) - d i s \left( f ( \mathbf { x } _ { i } ^ { 1 } ) , \ f ( \mathbf { x } _ { i } ^ { 3 } ) \right) \right) ,
43
+ $$
44
+
45
+ where the network $f$ extracts the fixed-dimensional embedding, the distance function $d i s \left( \cdot , \cdot \right)$ measures the distance between the two embedding vectors, and $m > 0$ is the margin parameter. The term “Siamese” (Bromley et al., 1993; Chopra et al., 2005) refers to the fact that the triplet $( \mathbf { x } ^ { 1 } , \mathbf { x } ^ { 2 } , \mathbf { x } ^ { 3 } )$ share the same embedding network $f$ .
46
+
47
+ Unlike the classification-based loss, the Siamese network loss does not enforce hard decisions on the label of each segment. Instead it tries to learn embeddings that respect distances between word pairs, which can be helpful for dealing with unseen words. The Siamese network approach also uses more examples in training, as one can easily generate many more triplets than (segment, label) pairs, and it is not limited to those labels that occur a sufficient number of times in the training set.
48
+
49
+ The above approaches treat the word labels as discrete classes, which ignores the similarity between different words, and does not take advantage of the more complex information contained in the character sequences corresponding to word labels. The orthography naturally reflects some aspects of similarity between the words’ pronunciations, which should also be reflected in the acoustic embeddings. One way to learn features from multiple sources of complementary information is using a multi-view representation learning setting. We take this approach, and consider the acoustic segment and the character sequence to be two different views of the pronunciation of the word.
50
+
51
+ While many deep multi-view learning objectives are applicable (Ngiam et al., 2011; Srivastava & Salakhutdinov, 2014; Sohn et al., 2014; Wang et al., 2015), we consider the multi-view contrastive loss objective of (Hermann & Blunsom, 2014), which is simple to optimize and implement and performs well in practice. In this algorithm, we embed acoustic segments $\mathbf { x }$ by a network $f$ and character label sequences c by another network $g$ into a common space, and use weak supervision of the form “for paired segment $\mathbf { x } ^ { + }$ and its character label sequence $\mathbf { c } ^ { + }$ , the distance between their embedding is much smaller than the distance between embeddings of $\mathbf { x } ^ { + }$ and an unmatched character label sequence $\mathbf { c } ^ { - , }$ ”. Formally, we optimize the following objective with such supervision:
52
+
53
+ $$
54
+ \operatorname* { m i n } _ { f , g } \mathrm { ~ o b j } ^ { 0 } : = \frac { 1 } { N } \sum _ { i } ^ { N } \operatorname* { m a x } \left( 0 , m + d i s \left( f ( \mathbf { x } _ { i } ^ { + } ) , g ( \mathbf { c } _ { i } ^ { + } ) \right) - d i s \left( f ( \mathbf { x } _ { i } ^ { + } ) , g ( \mathbf { c } _ { i } ^ { - } ) \right) \right) ,
55
+ $$
56
+
57
+ where $\mathbf { c } _ { i } ^ { - }$ is a negative character label sequence of $\mathbf { x } _ { i } ^ { + }$ to be contrasted with the positive/correct character sequence ${ \mathbf { c } } _ { i } ^ { + }$ , and $m$ is the margin parameter. In this paper we use the cosine distance, $\begin{array} { r } { d i s \left( \mathbf { a } , \mathbf { b } \right) = 1 - \bigg \langle \frac { \mathbf { a } } { \left\| \mathbf { a } \right\| } , \ \frac { \mathbf { b } } { \left\| \mathbf { b } \right\| } \bigg \rangle . ^ { 2 } } \end{array}$
58
+
59
+ Note that in the multi-view setting, we have multiple ways of generating triplets that contain one positive pair and one negative pair each. Below are the other three objectives we explore in this paper:
60
+
61
+ $$
62
+ \begin{array} { r l r } & { \underset { f , g } { \operatorname* { m i n } \mathrm { ~ o b j } } ^ { 1 } : = \frac { 1 } { N } \sum _ { i } ^ { N } \operatorname* { m a x } \left( 0 , m + d i s \left( f ( \mathbf { x } _ { i } ^ { + } ) , g ( \mathbf { c } _ { i } ^ { + } ) \right) - d i s \left( g ( \mathbf { c } _ { i } ^ { + } ) , g ( \mathbf { c } _ { i } ^ { - } ) \right) \right) , } & \\ & { \underset { f , g } { \operatorname* { m i n } \mathrm { ~ o b j } } ^ { 2 } : = \frac { 1 } { N } \sum _ { i } ^ { N } \operatorname* { m a x } \left( 0 , m + d i s \left( f ( \mathbf { x } _ { i } ^ { + } ) , g ( \mathbf { c } _ { i } ^ { + } ) \right) - d i s \left( f ( \mathbf { x } _ { i } ^ { - } ) , g ( \mathbf { c } _ { i } ^ { + } ) \right) \right) , } & \\ & { \underset { f , g } { \operatorname* { m i n } \mathrm { ~ o b j } } ^ { 3 } : = \frac { 1 } { N } \sum _ { i } ^ { N } \operatorname* { m a x } \left( 0 , m + d i s \left( f ( \mathbf { x } _ { i } ^ { + } ) , g ( \mathbf { c } _ { i } ^ { + } ) \right) - d i s \left( f ( \mathbf { x } _ { i } ^ { + } ) , f ( \mathbf { x } _ { i } ^ { - } ) \right) \right) . } \end{array}
63
+ $$
64
+
65
+ $\mathbf { x } _ { i } ^ { - }$ in (5) and (6) refers to a negative acoustic feature sequence, that is one with a different label from ${ \bf x } _ { i } ^ { + }$ . We note that $\mathrm { \ o b j } ^ { \mathrm { 1 } }$ and $\mathrm { o b j } ^ { 3 }$ contain distances between same-view embeddings, and are less thoroughly explored in the literature. We will also consider combinations of obj0 through obj3.
66
+
67
+ Finally, thus far we have considered losses that do not explicitly take into account the degree of difference between the positive and negative pairs (although the learned embeddings may implicitly learn this through the relationship between sequences in the two views). We also consider a costsensitive objective designed to explicitly arrange the embedding space such that word similarity is respected. In (3), instead of a fixed margin $m$ , we use:
68
+
69
+ $$
70
+ m ( { \bf c } ^ { + } , { \bf c } ^ { - } ) : = m _ { \mathrm { m a x } } \cdot \frac { \mathrm { m i n } \left( t _ { \mathrm { m a x } } , e d i t d i s ( { \bf c } ^ { + } , { \bf c } ^ { - } ) \right) } { t _ { \mathrm { m a x } } } ,
71
+ $$
72
+
73
+ where $t _ { \mathrm { m a x } } > 0$ is a threshold for edit distances (all edit distances above $t _ { \mathrm { m a x } }$ are considered equally bad), and $m _ { m a x }$ is the maximum margin we impose. The margin is set to $m _ { m a x }$ if the edit distance between two character sequences is above $t _ { \mathrm { m a x } }$ ; otherwise it scales linearly with the edit distance $e d i t d i s ( { \bf c } ^ { + } , { \bf c } ^ { - } ) )$ . We use the Levenshtein distance as the edit distance. Here we explore the costsensitive margin with $\mathrm { o b j } ^ { \mathrm { 0 } }$ , but it could in principle be used with other objectives as well.
74
+
75
+ ![](images/c3ff837397d39b835e1fc3d63562ed43f1f1a643589586c9893411912a989b7d.jpg)
76
+ Figure 1: Illustration of our embedding architecture and contrastive multi-view approach.
77
+
78
+ # 2.2 RECURRENT NEURAL NETWORK ARCHITECTURE
79
+
80
+ Since the inputs of both views have a sequential structure, we implement both $f$ and $g$ with recurrent neural networks and in particular long-short term memory networks (LSTMs). Recurrent neural networks are the state-of-the-art models for a number of speech tasks including speech recognition Graves et al. (2013), and LSTM-based acoustic word embeddings have produced the best results on one of the tasks in our experiments (Settle & Livescu, 2016).
81
+
82
+ As shown in Figure 1, our $f$ and $g$ are produced by multi-layer (stacked) bidirectional LSTMs. The inputs can be any frame-level acoustic feature representation and vector representation of the characters in the orthographic input. At each layer, two LSTM cells process the input sequence from left to right and from right to left respectively. At intermediate layers, the outputs of the two LSTMs at each time step are concatenated to form the input sequence to the next layer. At the top layer, the last time step outputs of the two LSTMs are concatenated to form a fixed-dimensional embedding of the view, and the embeddings are then used to calculate the cosine distances in our objectives.
83
+
84
+ # 3 RELATED WORK
85
+
86
+ We are aware of no prior work on multi-view learning of acoustic and character-based word embeddings. However, acoustic word embeddings learned in other ways have recently begun to be studied. Levin et al. (2013) proposed an approach for embedding an arbitrary-length segment of speech as a fixed-dimensional vector, based on representing each word as a vector of dynamic time warping (DTW) distances to a set of template words. This approach produced improved performance on a word discrimination task compared to using raw DTW distances, and was later also applied successfully for a query-by-example task (Levin et al., 2015). One disadvantage of this approach is that, while DTW handles the issue of variable sequence lengths, it is computationally costly and involves a number of DTW parameters that are not learned.
87
+
88
+ Kamper et al. (2016) and Settle & Livescu (2016) later improved on Levin et al.’s word discrimination results using convolutional neural networks (CNNs) and recurrent neural networks (RNNs) trained with either a classification or contrastive loss. Bengio & Heigold (2014) trained convolutional neural network (CNN)-based acoustic word embeddings for rescoring the outputs of a speech recognizer, using a loss combining classification and ranking criteria. Maas et al. (2012) trained a CNN to predict a semantic word embedding from an acoustic segment, and used the resulting embeddings as features in a segmental word-level speech recognizer. Harwath and Glass Harwath & Glass (2015); Harwath et al. (2016); Harwath & Glass (2017) jointly trained CNN embeddings of images and spoken captions, and showed that word-like unit embeddings can be extracted from the speech model. CNNs require normalizing the duration of the input sequences, which has typically been done via padding. RNNs, on the other hand, are more flexible in dealing with very different-length sequences. Chen et al. (2015) used long short-term memory (LSTM) networks with a classification loss to embed acoustic words for a simple (single-query) query-by-example search task. Chung et al. (2016) learned acoustic word embeddings based on recurrent neural network (RNN) autoencoders, and found that they improve over DTW for a word discrimination task similar to that of Levin et al. (2013). Audhkhasi et al. (2017) learned autoencoders for acoustic and written words, as well as a model for comparing the two, and applied these to a keyword search task.
89
+
90
+ Evaluation of acoustic word embeddings in downstream tasks such as speech recognition and search can be costly, and can obscure details of embedding models and training approaches. Most evaluations have been based on word discrimination – the task of determining whether two speech segments correspond to the same word or not – which can be seen as a proxy for query-by-example search (Levin et al., 2013; Kamper et al., 2016; Settle & Livescu, 2016; Chung et al., 2016). One difference between word discrimination and search/recognition tasks is that in word discrimination the word boundaries are given. However, prior work has been able to apply results from word discrimination Levin et al. (2013) to improve a query-by-example system without known word boundaries Levin et al. (2015), by simply applying their embeddings to non-word segments as well.
91
+
92
+ The only prior work focused on vector embeddings of character sequences explicitly aimed at representing their acoustic similarity is that of Ghannay et al. (2016), who proposed evaluations based on nearest-neighbor retrieval, phonetic/orthographic similarity measures, and homophone disambiguation. We use related tasks here, as well as acoustic word discrimination for comparison with prior work on acoustic embeddings.
93
+
94
+ # 4 EXPERIMENTS AND RESULTS
95
+
96
+ The ultimate goal is to gain improvements in speech systems where word-level discrimination is needed, such as speech recognition and query-by-example search. However, in order to focus on the content of the embeddings themselves and to more quickly compare a variety of models, it is desirable to have surrogate tasks that serve as intrinsic measures of performance. Here we consider three forms of evaluation, all based on measuring whether cosine distances between learned embeddings correspond well to desired properties.
97
+
98
+ In the first task, acoustic word discrimination, we are given a pair of acoustic sequences and must decide whether they correspond to the same word or to different words. This task has been used in several prior papers on acoustic word embeddings Kamper et al. (2015, 2016); Chung et al. (2016); Settle & Livescu (2016) and is a proxy for query-by-example search. For each given spoken word pair, we calculate the cosine distance between their embeddings. If the cosine distance is below a threshold, we output “yes” (same word), otherwise we output “no” (different words). The performance measure is the average precision (AP), which is the area under the precision-recall curve generated by varying the threshold and has a maximum value of 1.
99
+
100
+ In our multi-view setup, we embed not only the acoustic words but also the character sequences. This allows us to use our embeddings also for tasks involving comparisons between written and spoken words. For example, the standard task of spoken term detection (Fiscus et al., 2007) involves searching for examples of a given text query in spoken documents. This task is identical to queryby-example except that the query is given as text. In order to explore the potential of multi-view embeddings for such tasks, we design another proxy task, cross-view word discrimination. Here we are given a pair of inputs, one a written word and one an acoustic word segment, and our task is to determine if the acoustic signal is an example of the written word. The evalution proceeds analogously to the acoustic word discrimination task: We output “yes” if the cosine distance between the embeddings of the written and spoken sequences are below some threshold, and measure performance as the average precision (AP) over all thresholds.
101
+
102
+ Finally, we also would like to obtain a more fine-grained measure of whether the learned embeddings capture our intuitive sense of similarity between words. Being able to capture word similarity may also be useful in building query or recognition systems that fail gracefully and produce humanlike errors. For this purpose we measure the rank correlation between embedding distances and character edit distances. This is analogous to the evaluation of semantic word embeddings via the rank correlation between embedding distances and human similarity judgments (Finkelstein et al., 2001; Hill et al., 2015). In our case, however, we do not use human judgments since the ground-truth edit distances themselves provide a good measure. We refer to this as the word similarity task, and we apply this measure to both pairs of acoustic embeddings and pairs of character sequence embeddings. Similar measures have been proposed by Ghannay et al. (2016) to evaluate acoustic word embeddings, although they considered only near neighbors of each word whereas we consider the correlation across the full range of word pairs.
103
+
104
+ In the experiments described below, we first focus on the acoustic word discrimination task for purposes of initial exploration and hyperparameter search, and then largely fix the models for evaluation using the cross-view word discrimination and word similarity measures.
105
+
106
+ # 4.1 DATA
107
+
108
+ We use the same experimental setup and data as in Kamper et al. (2015, 2016); Settle & Livescu (2016). The task and setup were first developed by (Carlin et al., 2011). The data is drawn from the Switchboard English conversational speech corpus (Godfrey et al., 1992). The spoken word segments range in duration from 50 to 200 frames $0 . 5 \textrm { - } 2$ seconds). The train/dev/test splits contain 9971/10966/11024 pairs of acoustic segments and character sequences, corresponding to 1687/3918/3390 unique words. In computing the AP for the dev or test set, all pairs in the set are used, yielding approximately 60 million word pairs.
109
+
110
+ The input to the embedding model in the acoustic view is a sequence of 39-dimensional vectors (one per frame) of standard mel frequency cepstral coefficients (MFCCs) and their first and second derivatives. The input to the character sequence embedding model is a sequence of 26-dimensional one-hot vectors indicating each character of the word’s orthography.
111
+
112
+ # 4.2 MODEL DETAILS AND HYPERPARAMETER TUNING
113
+
114
+ We experiment with different neural network architectures for each view, varying the number of stacked LSTM layers, the number of hidden units for each layer, and the use of single- or bidirectional LSTM cells. A coarse grid search shows that 2-layer bidirectional LSTMs with 512 hidden units per direction per layer perform well on the acoustic word discrimination task, and we keep this structure fixed for subsequent experiments (see Appendix A for more details). We use the outputs of the top-layer LSTMs as the learned embedding for each view, which is 1024-dimensional if bidirectional LSTMs are used.
115
+
116
+ In training, we use dropout on the inputs of the acoustic view and between stacked layers for both views. The architecture is illustrated in Figure 1. For each training example, our contrastive losses require a corresponding negative example. We generate a negative character label sequence by uniformly sampling a word label from the training set that is different from the positive label. We perform a new negative label sampling at the beginning of each epoch. Similarly, negative acoustic feature sequences are uniformly sampled from all of the differently labeled acoustic feature sequences in the training set.
117
+
118
+ The network weights are initialized with values sampled uniformly from the range $[ - 0 . 0 5 , 0 . 0 5 ]$ . We use the Adam optimizer (Kingma & Ba, 2015) for updating the weights using mini-batches of 20 acoustic segments, with an initial learning rate tuned over $\{ \mathrm { { 0 . 0 0 0 1 , \bar { 0 . 0 0 1 } } } \}$ . Dropout is used at each layer, with the rate tuned over $\{ 0 , 0 . 2 , 0 . 4 , 0 . 5 \}$ , in which 0.4 usually outperformed others. The margin in our basic contrastive objectives 0-3 is tuned over $\{ 0 . 3 , 0 . 4 , 0 . 5 , 0 . 6 , 0 . 7 \}$ , out of which 0.4 and 0.5 typically yield best results. For obj0 with the cost-sensitive margin, we tune the maximum margin $m _ { \mathrm { m a x } }$ over $\{ 0 . 5 , 0 . 6 , 0 . 7 \}$ and the threshold $t _ { \mathrm { m a x } }$ over $\{ 9 , 1 1 , 1 3 \}$ . We train each model for up to 1000 epochs. The model that gives the best AP on the development set is used for evaluation on the test set.
119
+
120
+ # 4.3 EFFECTS OF DIFFERENT OBJECTIVES
121
+
122
+ We presented four contrastive losses (3)–(6) and potential combinations in Section 2.1. We now explore the effects of these different objectives on the word discrimination tasks.
123
+
124
+ Table 1 shows the development set AP for acoustic and cross-view word discrimination achieved using the various objectives. We tuned the objectives for the acoustic discrimination task, and then used the corresponding converged models for the cross-view task. Of the simple contrastive objectives, obj0 and $\mathrm { { \bar { \ o b j } } ^ { 2 } }$ (which involve only cross-view distances) slightly outperform the other two on the acoustic word discrimination task. The best-performing objective is the “symmetrized” objective $\mathrm { \ o b j ^ { 0 } + o b j ^ { 2 } }$ , which significantly outperforms all individual objectives (and the combination of the four). Finally, the cost-sensitive objective is very competitive as well, while falling slightly short of the best performance. We note that a similar objective to our ob $\mathrm { \hbar ^ { 6 } + o b j ^ { 2 } }$ was used by Vendrov et al. (2016) for the task of caption-image retrieval, where the authors essentially use all non-paired examples from the other view in the minibatch as negative examples (instead of random sampling one negative example as we do) to be contrasted with one paired example.
125
+
126
+ ![](images/04d3643ce9c112935d084f301ba1e540e182a27589bdeea428f56c642fe7c2c6.jpg)
127
+ Figure 2: Development set AP for several objectives on acoustic word discrimination.
128
+
129
+ <table><tr><td>Objective</td><td>Dev AP (acoustic)</td><td>Dev AP (cross-view)</td></tr><tr><td></td><td></td><td></td></tr><tr><td>obj0</td><td>0.659</td><td>0.791</td></tr><tr><td>obj1</td><td>0.654</td><td>0.807</td></tr><tr><td>obj2</td><td>0.675</td><td>0.788</td></tr><tr><td>obj3</td><td>0.640</td><td>0.782</td></tr><tr><td>obj+ obj²</td><td>0.702</td><td>0.814</td></tr><tr><td>M obji</td><td>0.672</td><td>0.804</td></tr><tr><td>cost-sensitive</td><td>0.671</td><td>0.802</td></tr></table>
130
+
131
+ Table 1: Word discrimination performance with different objectives.
132
+ Table 2: Final test set AP for different word discrimination approaches. The first line is a baseline using no word embeddings, but rather applying dynamic time warping (DTW) to the input MFCC features. The second and third lines are prior results using no word embeddings (but rather using DTW with learned correspondence autoencoder-based or phone posterior features, trained on larger external (in-domain) data). The remaining prior work corresponds to using cosine similarity between acoustic word embeddings.
133
+
134
+ <table><tr><td>Method</td><td>Test AP (acoustic)</td><td>Test AP (cross-view)</td></tr><tr><td>MFCCs + DTW (Kamper et al.,2016)</td><td>0.214</td><td></td></tr><tr><td>Correspondence autoencoder + DTW (Kamper et al., 2015)</td><td>0.469</td><td></td></tr><tr><td>Phone posteriors + DTW (Carlin et al., 2011)</td><td>0.497</td><td></td></tr><tr><td>Siamese CNN (Kamper et al., 2016)</td><td>0.549</td><td></td></tr><tr><td>Siamese LSTM (Settle &amp;Livescu, 2016)</td><td>0.671</td><td></td></tr><tr><td>Our multi-view LSTM obj° + obj²</td><td>0.806</td><td>0.892</td></tr></table>
135
+
136
+ Figure 2 shows the progression of the development set AP for acoustic word discrimination over 1000 training epochs, using several of the objectives, where AP is evaluated every 5 epochs. We observe that even after 1000 epochs, the development set AP has not quite saturated, indicating that it may be possible to further improve performance.
137
+
138
+ Overall, our best-performing objective is the combined ob $^ { 0 } + \mathrm { o b j } ^ { 2 }$ , and we use it for reporting final test-set results. Table 2 shows the test set AP for both the acoustic and cross-view tasks using our final model (“multi-view LSTM”). For comparison, we also include acoustic word discrimination results reported previously by Kamper et al. (2016); Settle & Livescu (2016). Previous approaches have not addressed the problem of learning embeddings jointly with the text view, so they can not be evaluated on the cross-view task.
139
+
140
+ # 4.4 WORD SIMILARITY TASKS
141
+
142
+ Table 3 gives our results on the word similarity tasks, that is the rank correlation (Spearman’s $\rho$ ) between embedding distances and orthographic edit distance (Levenshtein distance between character sequences). We measure this correlation for both our acoustic word embeddings and for our text embeddings. In the case of the text embeddings, we could of course directly measure the Levenshtein distance between the inputs; here we are simply measuring how much of this information the text embeddings are able to retain.
143
+
144
+ Table 3: Word similarity results using fixed-margin and cost-sensitive objectives, given as rank correlation (Spearman’s $\rho$ ) between embedding distances and orthographic edit distances.
145
+
146
+ <table><tr><td>Objective</td><td>ρ (acoustic embedding)</td><td>)ρ (text embedding)</td></tr><tr><td>fixed-margin (objo)</td><td>0.179</td><td>0.207</td></tr><tr><td>cost-sensitive margin (objo)</td><td>0.240</td><td>0.270</td></tr></table>
147
+
148
+ Interestingly, while the cost-sensitive objective did not produce substantial gains on the word discrimination tasks above, it does greatly improve the performance on this word similarity measure. This is a satisfying observation, since the cost-sensitive loss is trying to improve precisely this relationship between distances in the embedding space and the orthographic edit distance.
149
+
150
+ Although we have trained our embeddings using orthographic labels, it is also interesting to consider how closely aligned the embeddings are with the corresponding phonetic pronunciations. For comparison, the rank correlation between our acoustic embeddings and phonetic edit distances is 0.226, and for our text embeddings it is 0.241, which are relatively close to the rank correlations with orthographic edit distance. A future direction is to directly train embeddings with phonetic sequence supervision rather than orthography; this setting involves somewhat stronger supervision, but it is easy to obtain in many cases.
151
+
152
+ Another interesting point is that the performance is not a great deal better for the text embeddings than for the acoustic embeddings, even though the text embeddings have at their disposal the text input itself. We believe this has to do with the distribution of words in our data: While the data includes a large variety of words, it does not include many very similar pairs. In fact, of all possible pairs of unique training set words, fewer than $2 \%$ have an edit distance below 5 characters. Therefore, there may not be sufficient information to learn to distinguish detailed differences among character sequences, and the cost-sensitive loss ultimately does not learn much more than to separate different words. In future work it would be interesting to experiment with data sets that have a larger variety of similar words.
153
+
154
+ # 4.5 VISUALIZATION OF LEARNED EMBEDDINGS
155
+
156
+ Figure 3 gives a 2-dimensional t-SNE (van der Maaten & Hinton, 2008) visualization of selected acoustic and character sequences from the development set, including some that were seen in the training set and some previously unseen words. The previously seen words in this figure were selected uniformly at random among those that appear at least 15 times in the development set (the unseen words are the only six that appear at least 15 times in the development set). This visualization demonstrates that the acoustic embeddings cluster very tightly and are very close to the text embeddings, and that unseen words cluster nearly as well as previously seen ones.
157
+
158
+ While Figure 3 shows the relationship among the multiple acoustic embeddings and the text embeddings, the words are all very different so we cannot draw conclusions about the relationships between words. Figure 4 provides another visualization, this time exploring the relationship among the text embeddings of a number of closely related words, namely all development set words ending in “-ly”, “-ing”, and “-tion”. This visualization confirms that related words are embedded close together, with the words sharing a suffix forming fairly well-defined clusters.
159
+
160
+ # 5 CONCLUSION
161
+
162
+ We have presented an approach for jointly learning acoustic word embeddings and their orthographic counterparts. This multi-view approach produces improved acoustic word embedding performance over previous approaches, and also has the benefit that the same embeddings can be applied for both spoken and written query tasks. We have explored a variety of contrastive objectives: ones with a fixed margin that aim to separate same and different word pairs, as well as a cost-sensitive loss that aims to capture orthographic edit distances. While the losses generally perform similarly for word discrimination tasks, the cost-sensitive loss improves the correlation between embedding distances and orthographic distances. One interesting direction for future work is to directly use knowledge about phonetic pronunciations, in both evaluation and training. Another direction is to extend our approach to directly train on both word and non-word segments.
163
+
164
+ ![](images/7c2f0d642050b64e900351eedc1ff0cfc1f14c96aa149fba6cc6e339a7d8ef0f.jpg)
165
+ Figure 3: Visualization via t-SNE of acoustic word embeddings (colored markers) and corresponding character sequence embeddings (text), for a set of development set words with at least 15 acoustic tokens. Words seen in training are in lower-case; unseen words are in upper-case.
166
+
167
+ ![](images/55e4866a47801c808bb2254e65ce6dee329cfb482f9799ded969933d263e1930.jpg)
168
+ Figure 4: Visualization via $\mathbf { t } { - } \mathbf { S N E }$ of character sequence embeddings for words with the suffixes “-ly” (blue), “-ing” (red), and “-tion” (green).
169
+
170
+ # ACKNOWLEDGMENTS
171
+
172
+ This research was supported by a Google Faculty Award and by NSF grant IIS-1321015. The opinions expressed in this work are those of the authors and do not necessarily reflect the views of the funding agency. This research used GPUs donated by NVIDIA Corporation. We thank Herman Kamper and Shane Settle for their assistance with the data and experimental setup.
173
+
174
+ # REFERENCES
175
+
176
+ Xavier Anguera, Luis Javier Rodriguez-Fuentes, Igor Szoke, Andi Buzo, and Florian Metze. Query ¨ by example search on speech at mediaeval 2014. In MediaEval, 2014.
177
+
178
+ Kartik Audhkhasi, Andrew Rosenberg, Abhinav Sethy, Bhuvana Ramabhadran, and Brian Kingsbury. End-to-end ASR-free keyword search from speech. arXiv preprint arXiv:1701.04313, 2017.
179
+
180
+ Samy Bengio and Georg Heigold. Word embeddings for speech recognition. In IEEE Int. Conf. Acoustics, Speech and Sig. Proc., 2014.
181
+
182
+ Yoshua Bengio, Rejean Ducharme, Pascal Vincent, and Christian Jauvin. A neural probabilistic ´ language model. Journal of Machine Learing Research, 3(Feb):1137–1155, 2003.
183
+
184
+ Jane Bromley, Isabelle Guyon, Yann Lecun, Eduard Sackinger, and Roopak Shah. Signature verifi- ¨ cation using a siamese time delay neural network. In Advances in Neural Information Processing Systems (NIPS), pp. 737–744, 1993.
185
+
186
+ Michael A Carlin, Samuel Thomas, Aren Jansen, and Hynek Hermansky. Rapid evaluation of speech representations for spoken term discovery. In Proc. Interspeech, 2011.
187
+
188
+ Guoguo Chen, Carolina Parada, and Tara N Sainath. Query-by-example keyword spotting using long short-term memory networks. In Proc. ICASSP, 2015.
189
+
190
+ Sumit Chopra, Raia Hadsell, and Yann LeCun. Learning a similarity metric discriminatively, with application to face verification. In IEEE Computer Society Conf. Computer Vision and Pattern Recognition, pp. 539–546, 2005.
191
+
192
+ Yu-An Chung, Chao-Chung Wu, Chia-Hao Shen, and Hung-Yi Lee. Unsupervised learning of audio segment representations using sequence-to-sequence recurrent neural networks. In Proc. Interspeech, 2016.
193
+
194
+ Scott Deerwester, Susan T Dumais, George W Furnas, Thomas K Landauer, and Richard Harshman. Indexing by latent semantic analysis. Journal of the American society for information science, 41 (6):391, 1990.
195
+
196
+ Lev Finkelstein, Evgeniy Gabrilovich, Yossi Matias, Ehud Rivlin, Zach Solan, Gadi Wolfman, and Eytan Ruppin. Placing search in context: The concept revisited. In Proceedings of the 10th international conference on World Wide Web, 2001.
197
+
198
+ Jonathan G Fiscus, Jerome Ajot, John S Garofolo, and George Doddingtion. Results of the 2006 spoken term detection evaluation. In Proc. SIGIR, volume 7, pp. 51–57. Citeseer, 2007.
199
+
200
+ Jort F Gemmeke, Tuomas Virtanen, and Antti Hurmalainen. Exemplar-based sparse representations for noise robust automatic speech recognition. IEEE Transactions on Acoustics, Speech, and Language Processing, 19(7):2067–2080, 2011.
201
+
202
+ Sahar Ghannay, Yannick Esteve, Nathalie Camelin, and Paul Deleglise. Evaluation of acoustic word embeddings. In Proc. ACL Workshop on Evaluating Vector-Space Representations for NLP, 2016.
203
+
204
+ John J Godfrey, Edward C Holliman, and Jane McDaniel. SWITCHBOARD: Telephone speech corpus for research and development. In IEEE Int. Conf. Acoustics, Speech and Sig. Proc., 1992.
205
+
206
+ Alex Graves, Abdel rahman Mohamed, and Geoffrey Hinton. Speech recognition with deep recurrent neural networks. In IEEE Int. Conf. Acoustics, Speech and Sig. Proc., 2013.
207
+
208
+ Raia Hadsell, Sumit Chopra, and Yann LeCun. Dimensionality reduction by learning an invariant mapping. In IEEE Computer Society Conf. Computer Vision and Pattern Recognition, 2006.
209
+
210
+ David Harwath and James Glass. Deep multimodal semantic embeddings for speech and images. In Proc. IEEE Workshop on Automatic Speech Recognition and Understanding (ASRU), 2015.
211
+
212
+ David Harwath and James R Glass. Learning word-like units from joint audio-visual analysis. arXiv preprint arXiv:1701.07481, 2017.
213
+
214
+ David Harwath, Antonio Torralba, and James Glass. Unsupervised learning of spoken language with visual context. In Advances in Neural Information Processing Systems (NIPS), 2016.
215
+
216
+ Karl Moritz Hermann and Phil Blunsom. Multilingual distributed representations without word alignment. In Int. Conf. Learning Representations, 2014. arXiv:1312.6173 [cs.CL].
217
+
218
+ Felix Hill, Roi Reichart, and Anna Korhonen. SimLex-999: Evaluating semantic models with (genuine) similarity estimation. Computational Linguistics, 41(4), 2015.
219
+
220
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural Computation, 9(8): 1735–1780, 1997.
221
+
222
+ Baotian Hu, Zhengdong Lu, Hang Li, and Qingcai Chen. Convolutional neural network architectures for matching natural language sentences. In Advances in Neural Information Processing Systems (NIPS), 2014.
223
+
224
+ Mohit Iyyer, Varun Manjunatha, Jordan Boyd-Graber, and Hal Daume III. Deep unordered com-´ position rivals syntactic methods for text classification. In Proc. Association for Computational Linguistics, 2015.
225
+
226
+ Herman Kamper, Micah Elsner, Aren Jansen, and Sharon J. Goldwater. Unsupervised neural network based feature extraction using weak top-down constraints. In IEEE Int. Conf. Acoustics, Speech and Sig. Proc., 2015.
227
+
228
+ Herman Kamper, Weiran Wang, and Karen Livescu. Deep convolutional acoustic word embeddings using word-pair side information. In IEEE Int. Conf. Acoustics, Speech and Sig. Proc., 2016.
229
+
230
+ Diederik Kingma and Jimmy Ba. ADAM: A method for stochastic optimization. In Int. Conf. Learning Representations, 2015.
231
+
232
+ 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 (NIPS), 2015.
233
+
234
+ Keith Levin, Katharine Henry, Aren Jansen, and Karen Livescu. Fixed-dimensional acoustic embeddings of variable-length segments in low-resource settings. In Proc. IEEE Workshop on Automatic Speech Recognition and Understanding (ASRU), 2013.
235
+
236
+ Keith Levin, Aren Jansen, and Benjamin Van Durme. Segmental acoustic indexing for zero resource keyword search. In IEEE Int. Conf. Acoustics, Speech and Sig. Proc., 2015.
237
+
238
+ Andrew L Maas, Stephen D Miller, Tyler M O’neil, Andrew $\mathrm { \Delta Y N g }$ , and Patrick Nguyen. Word-level acoustic modeling with convolutional vector regression. In Proc. ICML Workshop on Representation Learning, 2012.
239
+
240
+ Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. Distributed representations of words and phrases and their compositionality. In Advances in Neural Information Processing Systems (NIPS), 2013.
241
+
242
+ Andriy Mnih and Geoffrey Hinton. Three new graphical models for statistical language modelling. In ICML, 2007.
243
+
244
+ Jiquan Ngiam, Aditya Khosla, Mingyu Kim, Juhan Nam, Honglak Lee, and Andrew Ng. Multimodal deep learning. In ICML, pp. 689–696, 2011.
245
+
246
+ Jeffrey Pennington, Richard Socher, and Christopher D Manning. GloVe: Global vectors for word representation. In Proc. Conference on Empirical Methods in Natural Language Processing, 2014.
247
+
248
+ Shane Settle and Karen Livescu. Discriminative acoustic word embeddings: Recurrent neural network-based approaches. In Proc. IEEE Workshop on Spoken Language Technology (SLT), 2016.
249
+
250
+ Richard Socher, Andrej Karpathy, Quoc V Le, Christopher D Manning, and Andrew Y Ng. Grounded compositional semantics for finding and describing images with sentences. Transactions of the Association for Computational Linguistics, 2:207–218, 2014.
251
+
252
+ Kihyuk Sohn, Wenling Shang, and Honglak Lee. Improved multimodal deep learning with variation of information. In Advances in Neural Information Processing Systems (NIPS), pp. 2141–2149, 2014.
253
+
254
+ Nitish Srivastava and Ruslan Salakhutdinov. Multimodal learning with deep boltzmann machines. Journal of Machine Learing Research, pp. 2949–2980, 2014.
255
+
256
+ Gabriel Synnaeve, Thomas Schatz, and Emmanuel Dupoux. Phonetics embedding learning with side information. In Proc. IEEE Workshop on Spoken Language Technology (SLT), 2014.
257
+
258
+ Laurens J. P. van der Maaten and Geoffrey E. Hinton. Visualizing data using $t$ -SNE. Journal of Machine Learing Research, 9:2579–2605, November 2008.
259
+
260
+ Ivan Vendrov, Ryan Kiros, Sanja Fidler, and Raquel Urtasun. Order-embeddings of images and language. In Int. Conf. Learning Representations, 2016.
261
+
262
+ Weiran Wang, Raman Arora, Karen Livescu, and Jeff Bilmes. On deep multi-view representation learning. In ICML, pp. 1083–1092, 2015.
263
+
264
+ John Wieting, Mohit Bansal, Kevin Gimpel, and Karen Livescu. Towards universal paraphrastic sentence embeddings. In Int. Conf. Learning Representations, 2016.
265
+
266
+ # A ADDITIONAL ANALYSIS
267
+
268
+ We first explore the effect of network architectures for our embedding models. We learn embeddings using objective obj0 and evaluate them on the acoustic and cross-view word discrimination tasks. The resulting average precisions on the development set are given in Table 4. All of the models were trained for 1000 epochs, except for the 1-layer unidirectional models which converged after 500 epochs. It is clear that bidirectional LSTMs are more successful than unidirectional LSTMs for these tasks, and two layers of LSTMs are much better than a single layer of LSTMs. We did not observe significant further improvement by using more than two layers of LSTMs. For all other experiments, we fix the architecture to 2-layer bidirectional LSTMs for each view.
269
+
270
+ Dev AP Dev AP (acoustic word discrimination) (cross-view word discrimination)
271
+
272
+ <table><tr><td>1-layer unidirectional</td><td>0.379</td><td>0.616</td></tr><tr><td>1-layer bidirectional</td><td>0.466</td><td>0.690</td></tr><tr><td>2-layer bidirectional</td><td>0.659</td><td>0.791</td></tr></table>
273
+
274
+ Table 4: Average precision (AP) for acoustic and cross-view word discrimination tasks on the development set, using embeddings learned with objective obj0 and different LSTM architectures.
275
+
276
+ ![](images/0618f23038e66a0aa68d56348d9bef2abac0f6d0be9848722320fd08dc601a54.jpg)
277
+ Figure 5: Precision-recall curve (left: two-layer bidirectional LSTM trained with $\mathrm { \ o b j ^ { 0 } + o b j ^ { 2 } }$ for word discrimination task) and scatter plot of embedding distances vs. orthographic distances (right: cost-sensitive margin model for word similarity task), for our best embedding models.
278
+
279
+ In Figure 5 we also give the precision-recall curve for our best models, as well as the scatter plot of cosine distances between acoustic embeddings vs. orthographic edit distances.
md/train/rkxaNjA9Ym/rkxaNjA9Ym.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/ry8dvM-R-/ry8dvM-R-.md ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ROUTING NETWORKS: ADAPTIVE SELECTION OF NON-LINEAR FUNCTIONS FOR MULTI-TASK LEARNING
2
+
3
+ Clemens Rosenbaum
4
+ College of Information and Computer Sciences
5
+ University of Massachusetts Amherst
6
+ 140 Governors Dr., Amherst, MA 01003
7
+ cgbr@cs.umass.edu
8
+
9
+ Tim Klinger & Matthew Riemer IBM Research AI 1101 Kitchawan Rd, Yorktown Heights, NY 10598 {tklinger,mdriemer}@us.ibm.com
10
+
11
+ # ABSTRACT
12
+
13
+ Multi-task learning (MTL) with neural networks leverages commonalities in tasks to improve performance, but often suffers from task interference which reduces the benefits of transfer. To address this issue we introduce the routing network paradigm, a novel neural network and training algorithm. A routing network is a kind of self-organizing neural network consisting of two components: a router and a set of one or more function blocks. A function block may be any neural network – for example a fully-connected or a convolutional layer. Given an input the router makes a routing decision, choosing a function block to apply and passing the output back to the router recursively, terminating when a fixed recursion depth is reached. In this way the routing network dynamically composes different function blocks for each input. We employ a collaborative multi-agent reinforcement learning (MARL) approach to jointly train the router and function blocks. We evaluate our model against cross-stitch networks and shared-layer baselines on multi-task settings of the MNIST, mini-imagenet, and CIFAR-100 datasets. Our experiments demonstrate a significant improvement in accuracy, with sharper convergence. In addition, routing networks have nearly constant per-task training cost while cross-stitch networks scale linearly with the number of tasks. On CIFAR100 (20 tasks) we obtain cross-stitch performance levels with an $8 5 \%$ reduction in training time.
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ Multi-task learning (MTL) is a paradigm in which multiple tasks must be learned simultaneously. Tasks are typically separate prediction problems, each with their own data distribution. In an early formulation of the problem, (Caruana, 1997) describes the goal of MTL as improving generalization performance by “leveraging the domain-specific information contained in the training signals of related tasks.” This means a model must leverage commonalities in the tasks (positive transfer) while minimizing interference (negative transfer). In this paper we propose a new architecture for MTL problems called a routing network, which consists of two trainable components: a router and a set of function blocks. Given an input, the router selects a function block from the set, applies it to the input, and passes the result back to the router, recursively up to a fixed recursion depth. If the router needs fewer iterations then it can decide to take a PASS action which leaves the current state unchanged. Intuitively, the architecture allows the network to dynamically self-organize in response to the input, sharing function blocks for different tasks when positive transfer is possible, and using separate blocks to prevent negative transfer.
18
+
19
+ The architecture is very general allowing many possible router implementations. For example, the router can condition its decision on both the current activation and a task label or just one or the other. It can also condition on the depth (number of router invocations), filtering the function module choices to allow layering. In addition, it can condition its decision for one instance on what was historically decided for other instances, to encourage re-use of existing functions for improved compression. The function blocks may be simple fully-connected neural network layers or whole networks as long as the dimensionality of each function block allows composition with the previous function block choice. They needn’t even be the same type of layer. Any neural network or part of a network can be “routed” by adding its layers to the set of function blocks, making the architecture applicable to a wide range of problems. Because the routers make a sequence of hard decisions, which are not differentiable, we use reinforcement learning (RL) to train them. We discuss the training algorithm in Section 3.1, but one way we have modeled this as an RL problem is to create a separate RL agent for each task (assuming task labels are available in the dataset). Each such task agent learns its own policy for routing instances of that task through the function blocks.
20
+
21
+ To evaluate we have created a “routed” version of the convnet used in (Ravi & Larochelle, 2017) and use three image classification datasets adapted for MTL learning: a multi-task MNIST dataset that we created, a Mini-imagenet data split as introduced in (Vinyals et al., 2016), and CIFAR-100 (Krizhevsky, 2009), where each of the 20 label superclasses are treated as different tasks.1 We conduct extensive experiments comparing against cross-stitch networks (Misra et al., 2016) and the popular strategy of joint training with layer sharing as described in (Caruana, 1997). Our results indicate a significant improvement in accuracy over these strong baselines with a speedup in convergence and often orders of magnitude improvement in training time over cross-stitch networks.
22
+
23
+ # 2 RELATED WORK
24
+
25
+ Work on multi-task deep learning (Caruana, 1997) traditionally includes significant hand design of neural network architectures, attempting to find the right mix of task-specific and shared parameters. For example, many architectures share low-level features like those learned in shallow layers of deep convolutional networks or word embeddings across tasks and add task-specific architectures in later layers. By contrast, in routing networks, we learn a fully dynamic, compositional model which can adjust its structure differently for each task.
26
+
27
+ Routing networks share a common goal with techniques for automated selective transfer learning using attention (Rajendran et al., 2017) and learning gating mechanisms between representations (Stollenga et al., 2014), (Misra et al., 2016), (Ruder et al., 2017). In the latter two papers, experiments are performed on just 2 tasks at a time. We consider up to 20 tasks in our experiments and compare directly to (Misra et al., 2016).
28
+
29
+ Our work is also related to mixtures of experts architectures (Jacobs et al., 1991), (Jordan & Jacobs, 1994) as well as their modern attention based (Riemer et al., 2016) and sparse (Shazeer et al., 2017) variants. The gating network in a typical mixtures of experts model takes in the input and chooses an appropriate weighting for the output of each expert network. This is generally implemented as a soft mixture decision as opposed to a hard routing decision, allowing the choice to be differentiable. Although the sparse and layer-wise variant presented in (Shazeer et al., 2017) does save some computational burden, the proposed end-to-end differentiable model is only an approximation and doesn’t model important effects such as exploration vs. exploitation tradeoffs, despite their impact on the system. Mixtures of experts have recently been considered in the transfer learning setting (Aljundi et al., 2016), however, the decision process is modelled by an autoencoder-reconstructionerror-based heuristic and is not scaled to a large number of tasks.
30
+
31
+ In the use of dynamic representations, our work is also related to single task and multi-task models that learn to generate weights for an optimal neural network (Ha et al., 2016), (Ravi & Larochelle, 2017), (Munkhdalai & Yu, 2017). While these models are very powerful, they have trouble scaling to deep models with a large number of parameters (Wichrowska et al., 2017) without tricks to simplify the formulation. In contrast, we demonstrate that routing networks can be applied to create dynamic network architectures for architectures like convnets by routing some of their layers.
32
+
33
+ Our work extends an emerging line of recent research focused on automated architecture search. In this work, the goal is to reduce the burden on the practitioner by automatically learning black box algorithms that search for optimal architectures and hyperparameters. These include techniques based on reinforcement learning (Zoph & Le, 2017), (Baker et al., 2017), evolutionary algorithms (Miikkulainen et al., 2017), approximate random simulations (Brock et al., 2017), and adaptive growth (Cortes et al., 2016). To the best of our knowledge we are the first to apply this idea to multitask learning. Our technique can learn to construct a very general class of architectures without the need for human intervention to manually choose which parameters will be shared and which will be kept task-specific.
34
+
35
+ Also related to our work is the literature on minimizing computation cost for single-task problems by conditional routing. These include decisions trained with REINFORCE (Denoyer & Gallinari, 2014), (Bengio et al., 2015), (Hamrick et al., 2017), Q Learning (Liu & Deng, 2017), and actor-critic methods (McGill & Perona, 2017). Our approach differs however in the introduction of several novel elements. Specifically, our work explores the multi-task learning setting, it uses a multi-agent reinforcement learning training algorithm, and it is structured as a recursive decision process.
36
+
37
+ There is a large body of related work which focuses on continual learning, in which tasks are presented to the network one at a time, potentially over a long period of time. One interesting recent paper in this setting, which also uses the notion of routes (“paths”), but uses evolutionary algorithms instead of RL is Fernando et al. (2017).
38
+
39
+ While a routing network is a novel artificial neural network formulation, the high-level idea of task specific “routing” as a cognitive function is well founded in biological studies and theories of the human brain (Gurney et al., 2001), (Buschman & Miller, 2010), (Stocco et al., 2010).
40
+
41
+ # 3 ROUTING NETWORKS
42
+
43
+ ![](images/beef216d6b096bdb3000462f2c4a9f74cd80f741b1d7085a3f1e07c21aef2807.jpg)
44
+ Figure 1: Routing (forward) Example
45
+
46
+ A routing network consists of two components: a router and a set of function blocks, each of which can be any neural network layer. The router is a function which selects from among the function blocks given some input. Routing is the process of iteratively applying the router to select a sequence of function blocks to be composed and applied to the input vector. This process is illustrated in Figure 1. The input to the routing network is an instance to be classified $( v , \dot { t } ) , v \in \mathbb { R } ^ { d }$ is a representation vector of dimension $d$ and $t$ is an integer task identifier. The router is given $v , t$ and a depth $( = 1 )$ , the depth of the recursion, and selects from among a set of function block choices available at depth 1, $\left\{ f _ { 1 3 } , f _ { 1 2 } , f _ { 1 1 } \right\}$ , picking $f _ { 1 3 }$ which is indicated with a dashed line. $f _ { 1 3 }$ is applied to the input $( v , t )$ to produce an output activation. The router again chooses a function block from those available at depth 2 (if the function blocks are of different dimensions then the router is constrained to select dimensionally matched blocks to apply) and so on. Finally the router chooses a function block from the last (classification) layer function block set and produces the classification $\hat { y }$ .
47
+
48
+ Algorithm 1 gives the routing procedure in detail. The algorithm takes as input a vector $v$ , task label $t$ and maximum recursion depth $n$ . It iterates $n$ times choosing a function block on each iteration and applying it to produce an output representation vector. A special PASS action (see Appendix Section 7.2 for details) just skips to the next iteration. Some experiments don’t require a task label and in that case we just pass a dummy value. For simplicity we assume the algorithm has access to the router function and function blocks and don’t include them explicitly in the input. The router decision function router : $\mathbb { R } ^ { d } \times \mathbb { Z } ^ { + } \times \mathbb { Z } ^ { + } $ $\{ 1 , 2 , \ldots , k , P A S S \}$ (for $d$ the input representation dimension and $k$ the number of function blocks) maps the current representation $v$ , task label $t \in \mathbb { Z } ^ { + }$ , and current depth $\bar { i } \in \mathbb { Z } ^ { + }$ to the index of the function block to route next in the ordered set function block.
49
+
50
+ # Algorithm 1: Routing Algorithm
51
+
52
+ input : $x , t , n$ : $x \in \mathbb { R } ^ { d }$ , $d$ the representation dim; $t$ integer task id; $n$ max depth output: $v$ - the vector result of applying the composition of the selected functions to the input $x$ 1 $v x$ 2 for $i$ in $1 . . . n$ do 3 $\boldsymbol { a } \gets \mathbf { r o u t e r } ( \boldsymbol { x } , t , i )$ 4 if $a \neq P A S S$ then 5 $x \gets$ function blocka(x) 6 return $\nu$
53
+
54
+ If the routing network is run for $d$ invocations then we say it has depth $d$ . For $N$ function blocks a routing network run to a depth $d$ can select from $N ^ { d }$ distinct trainable functions (the paths in the network). Any neural network can be represented as a routing network by adding copies of its layers as routing network function blocks. We can group the function blocks for each network layer and constrain the router to pick from layer 0 function blocks at depth 0, layer 1 blocks at depth 1, and so on. If the number of function blocks differs from layer to layer in the original network, then the router may accommodate this by, for example, maintaining a separate decision function for each depth.
55
+
56
+ # 3.1 ROUTER TRAINING USING RL
57
+
58
+ # Algorithm 2: Router-Trainer: Training of a Routing Network.
59
+
60
+ input: A dataset $D$ of samples $( v , t , y )$ , $v$ the input representation, $t$ an integer task label, $y$ a ground-truth target label 1 for each sample $s = ( v , t , y ) \in D$ do 2 Do a forward pass through the network, applying Algorithm 1 to sample $s$ . Store a trace $T = ( S , A , R , r _ { f i n a l } )$ , where $S =$ sequence of visited states $\left( { { s } _ { i } } \right)$ ; $A =$ sequence of actions taken $\left( { { a } _ { i } } \right)$ ; $R =$ sequence of immediate action rewards $( r _ { i } )$ for action $a _ { i }$ ; and the final reward rf inal. The last output as the network’s prediction $\hat { y }$ and the final reward $r _ { f i n a l }$ is $+ 1$ if the prediction $\hat { y }$ is correct; $^ { - 1 }$ if not. 3 Compute the loss $\mathcal { L } ( \hat { y } , y )$ between prediction $\hat { y }$ and ground truth $y$ and backpropagate along the function blocks on the selected route to train their parameters. 4 Use the trace $T$ to train the router using the desired RL training algorithm.
61
+
62
+ We can view routing as an RL problem in the following way. The states of the MDP are the triples $( v ,$ $t , i )$ where $v \in \mathbb { R } ^ { d }$ is a representation vector (initially the input), $t$ is an integer task label for $v$ , and $i$ is the depth (initially 1). The actions are function block choices (and PASS) in $\{ 1 , \dots k , P A S S \}$ for $k$ the number of function blocks. Given a state $s = ( \boldsymbol { v } , t , i )$ , the router makes a decision about which action to take. For the non-PASS actions, the state is then updated $s ^ { \prime } = ( v ^ { \prime } , t , i + 1 )$ and the process continues. The PASS action produces the same representation vector again but increments the depth, so $s ^ { \prime } = ( v , t , i + 1 )$ . We train the router policy using a variety of RL algorithms and settings which we will describe in detail in the next section.
63
+
64
+ Regardless of the RL algorithm applied, the router and function blocks are trained jointly. For each instance we route the instance through the network to produce a prediction $\hat { y }$ . Along the way we record a trace of the states $s _ { i }$ and the actions $a _ { i }$ taken as well as an immediate reward $r _ { i }$ for action $a _ { i }$ . When the last function block is chosen, we record a final reward which depends on the prediction $\hat { y }$ and the true label $y$ .
65
+
66
+ $$
67
+ \begin{array} { r l r } & { \left[ \frac { \hat { \rho } _ { 1 3 } ^ { \varDelta } } { \int \ d _ { 1 3 } } \right] \times \frac { \hat { \rho } _ { 2 3 } ^ { \varDelta } } { - \left( - \frac { 1 } { 2 } - 1 \right) ! } = \frac { \hat { \rho } _ { 2 2 } ^ { \varDelta } } { - \left( - \frac { 1 } { 2 } - 1 \right) ! } - \left[ \frac { \hat { \rho } _ { 3 2 } ^ { \varDelta } } { 2 - 1 } - \mathcal { L } ( \hat { y } , y ) \right] \stackrel { \mathrm { R o u t i n g ~ E x a m p l e ~ ( s e e ~ F i g u r e ~ 1 ) } } { - \left( \frac { 1 } { \sqrt { 3 } } \right) ! } \Longrightarrow } & \\ & a _ { 1 } \ll - \frac { + r _ { 1 } } { - \left( - \frac { 1 } { 2 } - 1 - a _ { 2 } \right) + \left( - \frac { 1 } { 2 } - \frac { 1 } { 2 } - 1 - a _ { 3 } \right) + \left( \frac { + r _ { 3 } } { 2 } - \frac { 1 } { \sqrt { 3 } } - r _ { f i n a l } \right. _ { + } . . . . . . . . . . . . . . . . } \end{array}
68
+ $$
69
+
70
+ Figure 2: Training (backward) Example
71
+
72
+ We train the selected function blocks using SGD/backprop. In the example of Figure 1 this means computing gradients for $f _ { 3 2 }$ , $f _ { 2 1 }$ and $f _ { 1 3 }$ . We then use the computed trace to train the router using an RL algorithm. The high-level procedure is summarized in Algorithm 2 and illustrated in Figure 2. To keep the presentation uncluttered we assume the RL training algorithm has access to the router function, function blocks, loss function, and any specific hyper-parameters such as discount rate needed for the training and don’t include them explicitly in the input.
73
+
74
+ # 3.1.1 REWARD DESIGN
75
+
76
+ A routing network uses two kinds of rewards: immediate action rewards $r _ { i }$ given in response to an action $a _ { i }$ and a final reward $r _ { f i n a l }$ , given at the end of the routing. The final reward is a function of the network’s performance. For the classification problems focused on in this paper, we set it to $+ 1$ if the prediction was correct $( \hat { y } = y )$ ), and $- 1$ otherwise. For other domains, such as regression domains, the negative loss $( - \hat { \cal L } ( \hat { y } , y ) )$ could be used.
77
+
78
+ We experimented with an immediate reward that encourages the router to use fewer function blocks when possible. Since the number of function blocks per-layer needed to maximize performance is not known ahead of time (we just take it to be the same as the number of tasks), we wanted to see whether we could achieve comparable accuracy while reducing the number of function blocks ever chosen by the router, allowing us to reduce the size of the network after training. We experimented with two such rewards, multiplied by a hyper-parameter $\rho \in [ 0 , 1 ]$ : the average number of times that block was chosen by the router historically and the average historical probability of the router choosing that block. We found no significant difference between the two approaches and use the average probability in our experiments. We evaluated the effect of $\rho$ on final performance and report the results in Figure 12 in the appendix. We see there that generally $\rho = 0 . 0$ (no collaboration reward) or a small value works best and that there is relatively little sensitivity to the choice in this range.
79
+
80
+ # 3.1.2 RL ALGORITHMS
81
+
82
+ ![](images/634d136a9723c1621e164cd582e41d12d5863568c68d20387f56aef9215c1a8a.jpg)
83
+ Figure 3: Task-based routing. $\langle v a l u e , t a s k \rangle$ is the input consisting of value, the partial evaluation of the previous function block (or input $x$ ) and the task label task. $\alpha _ { i }$ is a routing agent; $\alpha _ { d }$ is a dispatching agent.
84
+
85
+ To train the router we evaluate both single-agent and multi-agent RL strategies. Figure 3 shows three variations which we consider. In Figure 3(a) there is just a single agent which makes the routing decision. This is be trained using either policy-gradient (PG) or Q-Learning experiments. Figure 3(b) shows a multi-agent approach. Here there are a fixed number of agents and a hard rule which assigns the input instance to a an agent responsible for routing it. In our experiments we create one agent per task and use the input task label as an index to the agent responsible for routing that instance. Figure 3(c) shows a multi-agent approach in which there is an additional agent, denoted $\alpha _ { d }$ and called a dispatching agent which learns to assign the input to an agent, instead of using a fixed rule. For both of these multi-agent scenarios we additionally experiment with a MARL algorithm called Weighted Policy Learner (WPL).
86
+
87
+ We experiment with storing the policy both as a table and in form of an approximator. The tabular representation has the invocation depth as its row dimension and the function block as its column dimension with the entries containing the probability of choosing a given function block at a given depth. The approximator representation can consist of either one MLP that is passed the depth (represented in 1-hot), or a vector of $d$ MLPs, one for each decision/depth.
88
+
89
+ Both the Q-Learning and Policy Gradient algorithms are applicable with tabular and approximation function policy representations. We use REINFORCE (Williams, 1992) to train both the approximation function and tabular representations. For Q-Learning the table stores the Q-values in the entries. We use vanilla Q-Learning (Watkins, 1989) to train tabular representation and train the approximators to minimize the $\ell _ { 2 }$ norm of the temporal difference error.
90
+
91
+ Implementing the router decision policy using multiple agents turns the routing problem into a stochastic game, which is a multi-agent extension of an MDP. In stochastic games multiple agents interact in the environment and the expected return for any given policy may change without any action on that agent’s part. In this view incompatible agents need to compete for blocks to train, since negative transfer will make collaboration unattractive, while compatible agents can gain by sharing function blocks. The agent’s (locally) optimal policies will correspond to the game’s Nash equilibrium 2
92
+
93
+ For routing networks, the environment is non-stationary since the function blocks are being trained as well as the router policy. This makes the training considerably more difficult than in the singleagent (MDP) setting. We have experimented with single-agent policy gradient methods such as REINFORCE but find they are less well adapted to the changing environment and changes in other agent’s behavior, which may degrade their performance in this setting.
94
+
95
+ One MARL algorithm specifically designed to address this problem, and which has also been shown to converge in non-stationary environments, is the weighted policy learner (WPL) algorithm (Abdallah & Lesser, 2006), shown in Algorithm 3. WPL is a PG algorithm designed to dampen oscillation and push the agents to converge more quickly. This is done by scaling the gradient of the expected return for an action $a$ according the probability of taking that action $\pi ( a )$ (if the gradient is positive) or $1 - { \overset { - } { \pi } } ( a )$ (if the gradient is negative). Intuitively, this has the effect of slowing down the learning rate when the policy is moving away from a Nash equilibrium strategy and increasing it when it approaches one. The full WPL algorithm is shown in Algorithm 3. It is assumed that the historical average return $\hat { \mathcal { R } } _ { i }$ for each action $a _ { i }$ is initialized to 0 before the start of training. The function simplex-projection projects the updated policy values to make it a valid probability distribution. The projection is defined as: $c l i p ( \pi ) \dot { / } \sum ( c l i p ( \pi ) )$ , where $c l i p ( x ) = \operatorname* { m a x } ( 0 , m i n ( 1 , x ) )$ . The states $S$ in the trace are not used by the WPL algorithm.
96
+
97
+ # Algorithm 3: Weighted Policy Learner
98
+
99
+ input : A trace $\overline { { T = ( S , A , R , r _ { f i n a l } ) } }$ $n$ the maximum depth; $\hat { \mathcal { R } }$ , the historical average returns (initialized to 0 at the start of training); $\gamma$ the discount factor ; and $\lambda _ { \pi }$ the policy learning rate output: An updated router policy $\pi$ 1 for each action $a _ { i } \in A$ do 2 $\begin{array} { r } { \mathcal { R } _ { i } r _ { f i n a l } + \sum _ { j = i } ^ { n } \gamma ^ { j - i } r _ { j } } \end{array}$ 4 Update the average return: 5 $\hat { \mathcal R } _ { i } \gets ( 1 - \lambda _ { \pi } ) \hat { \mathcal R } _ { i } + \lambda _ { \pi } \mathcal R _ { i }$ 6 Compute the gradient: 7 $\Delta ( a _ { i } ) \gets \mathcal { R } _ { i } - \hat { \mathcal { R } } _ { i }$ 8 Update the policy: 9 if $\Delta ( a _ { i } ) < 0$ then 10 $\begin{array} { r l } { | } & { { } \dot { \Delta } ( \dot { a } _ { i } ) \gets \Delta ( a _ { i } ) ( 1 - \pi ( a _ { i } ) ) } \end{array}$ 11 else 12 $\begin{array} { r l } & { \dot { \mathbf { \bigcup } } \Delta ( a _ { i } ) \gets \Delta ( a _ { i } ) ( \pi ( a _ { i } ) ) } \\ & { \pi \gets \mathrm { s i m p l e x – p r o j e c t i o n } ( \pi + \lambda _ { \pi } \Delta ) } \end{array}$ 13
100
+
101
+ Details, including convergence proofs and more examples giving the intuition behind the algorithm, can be found in (Abdallah & Lesser, 2006). A longer explanation of the algorithm can be found in Section 7.4 in the appendix. The WPL-Update algorithm is defined only for the tabular setting. It is future work to adapt it to work with function approximators.
102
+
103
+ As we have described it, the training of the router and function blocks is performed independently after computing the loss. We have also experimented with adding the gradients from the router choices $\Delta ( a _ { i } )$ to those for the function blocks which produce their input. We found no advantage but leave a more thorough investigation for future work.
104
+
105
+ # 4 QUANTITATIVE RESULTS
106
+
107
+ We experiment with three datasets: multi-task versions of MNIST (MNIST-MTL) (Lecun et al., 1998), Mini-Imagenet (MIN-MTL) (Vinyals et al., 2016) as introduced by (Ravi & Larochelle, 2017), and CIFAR-100 (CIFAR-MTL) (Krizhevsky, 2009) where we treat the 20 superclasses as tasks. In the binary MNIST-MTL dataset, the task is to differentiate instances of a given class $c$ from non-instances. We create 10 tasks and for each we use 1k instances of the positive class $c$ and 1k each of the remaining 9 negative classes for a total of 10k instances per task during training, which we then test on 200 samples per task (2k samples in total). MIN-MTL is a smaller version of ImageNet (Deng et al., 2009) which is easier to train in reasonable time periods. For mini-ImageNet we randomly choose 50 labels and create tasks from 10 disjoint random subsets of 5 labels each chosen from these. Each label has 800 training instances and 50 testing instances – so 4k training and 250 testing instances per task. For all 10 tasks we have a total of 40k training instances. Finally,
108
+
109
+ CIFAR-100 has coarse and fine labels for its instances. We follow existing work (Krizhevsky, 2009) creating one task for each of the 20 coarse labels and include 500 instances for each of the corresponding fine labels. There are 20 tasks with a total of $2 . 5 \mathrm { k }$ instances per task; $2 . 5 \mathrm { k }$ for training and 500 for testing. All results are reported on the test set and are averaged over 3 runs. The data are summarized in Table 1.
110
+
111
+ Each of these datasets has interesting characteristics which challenge the learning in different ways. CIFAR-MTL is a “natural” dataset whose tasks correspond to human categories. MIN-MTL is randomly generated so will have less task coherence. This makes positive transfer more difficult to achieve and negative transfer more of a problem. And MNIST-MTL, while simple, has the difficult property that the same instance can appear with different labels in different tasks, causing interference. For example, in the $^ { 6 6 } 0$ vs other digits” task, “0” appears with a positive label but in the “1 vs other digits” task it appears with a negative label.
112
+
113
+ Our experiments are conducted on a convnet architecture (SimpleConvNet) which appeared recently in (Ravi & Larochelle, 2017). This model has 4 convolutional layers, each consisting of a 3x3 convolution and 32 filters, followed by batch normalization and a ReLU. The convolutional layers are followed by 3 fully connected layers, with 128 hidden units each. Our routed version of the network routes the 3 fully connected layers and for each routed layer we supply one randomly initialized function block per task in the dataset. When we use neural net approximators for the router agents they are always 2 layer MLPs with a hidden dimension of 64. A state $( v , t , i )$ is encoded for input to the approximator by concatenating $v$ with a 1-hot representation of $t$ (if used). That is, encoding(s) $=$ concat $( v , \mathrm { o n e . h o t } ( t ) )$ .
114
+
115
+ Table 1: Dataset training and testing splits
116
+
117
+ <table><tr><td>Dataset</td><td># Training</td><td># Testing</td></tr><tr><td>CIFAR-MTL</td><td>50k</td><td>10k</td></tr><tr><td>MIN-MTL</td><td>40k</td><td>2.5k</td></tr><tr><td>MNIST-MTL</td><td>100k</td><td>2k</td></tr></table>
118
+
119
+ We did a parameter sweep to find the best learning rate and $\rho$ value for each algorithm on each dataset. We use $\rho = 0 . 0$ (no collaboration reward) for CIFAR-MTL and MIN-MTL and $\rho = 0 . 3$ for MNIST-MTL. The learning rate is initialized to $1 0 ^ { - 2 }$ and annealed by dividing by 10 every 20 epochs. We tried both regular SGD as well as Adam Kingma & Ba (2014), but chose SGD as it resulted in marginally better performance. The SimpleConvNet has batch normalization layers but we use no dropout.
120
+
121
+ For one experiment, we dedicate a special “PASS” action to allow the agents to skip layers during training which leaves the current state unchanged (routing-all-fc recurrent/+PASS). A detailed description of the PASS action is provided in the Appendix in Section 7.2.
122
+
123
+ All data are presented in Table 2 in the Appendix.
124
+
125
+ In the first experiment, shown in Figure 4, we compare different RL training algorithms on CIFARMTL. We compare five algorithms: MARL:WPL; a single agent REINFORCE learner with a separate approximation function per layer; an agent-per-task REINFORCE learner which maintains a separate approximation function for each layer; an agent-per-task Q learner with a separate approximation function per layer; and an agent-per-task Q learner with a separate table for each layer. The best performer is the WPL algorithm which outperforms the nearest competitor, tabular Q-Learning by about $4 \%$ . We can see that (1) the WPL algorithm works better than a similar vanilla PG, which has trouble learning; (2) having multiple agents works better than having a single agent; and (3) the tabular versions, which just use the task and depth to make their predictions, work better here than the approximation versions, which all use the representation vector in addition predict the next action.
126
+
127
+ The next experiment compares the best performing algorithm WPL against other routing approaches, including the already introduced REINFORCE: single agent (for which WPL is not applicable). All of these algorithms route the full-connected layers of the SimpleConvNet using the layering approach we discussed earlier. To make the next comparison clear we rename MARL:WPL to routingall- $f c$ in Figure 5 to reflect the fact that it routes all the fully connected layers of the SimpleConvNet, and rename REINFORCE: single agent to routing-all-fc single agent. We compare against several other approaches. One approach, routing-all-fc-recurrent/+PASS, has the same setup as routing-all$f c$ , but does not constrain the router to pick only from layer 0 function blocks at depth 0, etc. It is allowed to choose any function block from two of the layers (since the first two routed layers have identical input and output dimensions; the last is the classification layer). Another approach, soft-mixture- $- f c$ , is a soft version of the router architecture. This soft version uses the same function blocks as the routed version, but replaces the hard selection with a trained softmax attention (see the discussion below on cross-stitch networks for the details). We also compare against the single agent architecture shown in 3(a) called routing-all-fc single agent and the dispatched architecture shown in Figure 3(c) called routing-all-fc dispatched. Neither of these approached the performance of the per-task agents. The best performer by a large margin is routing-all-fc, the fully routed WPL algorithm.
128
+
129
+ ![](images/b07c936d83c15481cb07612d35a8674028ea0d6eed1852a144ec44d37573bc97.jpg)
130
+ Figure 4: Influence of the RL algorithm on CIFAR-MTL. Detailed descriptions of the implementation each approach can be found in the Appendix in Section 7.3.
131
+
132
+ ![](images/875c4b81a61835505d90425430736c742102358871510d6ebad2dacdab9230d0.jpg)
133
+ Figure 5: Comparison of Routing Architectures on CIFAR-MTL. Implementation details of each approach can be found in the Appendix in Section 7.3.
134
+
135
+ We next compare routing-all-fc on different domains against the cross-stitch networks of Misra et al.
136
+ (2016) and two challenging baselines: task specific-1-fc and task specific-all-fc, described below.
137
+
138
+ Cross-stitch networks Misra et al. (2016) are a kind of linear-combination model for multi-task learning. They maintain one model per task with a shared input layer, and “cross stitch” connection layers, which allow sharing between tasks. Instead of selecting a single function block in the next layer to route to, a cross-stitch network routes to all the function blocks simultaneously, with the input for a function block all the function blocks of l $i$ inyer r . $l$ given That is: the activations com, for learned weights d byand $l - 1$ $\begin{array} { r } { \operatorname* { i n p u t } _ { l i } = \sum _ { j = 1 } ^ { k } w _ { i j } ^ { l } v _ { l - 1 , j } } \end{array}$ $w _ { i j } ^ { l }$ layer activations $v _ { l - 1 , j }$ . For our experiments, we add a cross-stitch layer to each of the routed layers of SimpleConvNet. We additional compare to a similar “soft routing” version soft-mixture- $f c$ in Figure 5. Soft-routing uses a softmax to normalize the weights used to combine the activations of previous layers and it shares parameters for a given layer so that $\mathbf { w _ { i } ^ { l } } = \mathbf { w _ { i ^ { \prime } } ^ { l } }$ for all $i , i ^ { \prime } , l$ .
139
+
140
+ ![](images/676b0c7334a7585674d98f96712ee5e69602b166a1f3f8f87f2dde4f04032b68.jpg)
141
+ Figure 6: Results on domain CIFAR-MTL
142
+
143
+ ![](images/229c7b7f761eb4ed6f17f577f35ff39f0ec1369467c36e87c0cd7e3838e896e4.jpg)
144
+ Figure 7: Results on domain MIN-MTL (mini ImageNet)
145
+
146
+ The task-specific-1-fc baseline has a separate last fully connected layer for each task and shares the rest of the layers for all tasks. The task specific-all-fc baseline has a separate set of all the fully connected layers for each task. These baseline architectures allow considerable sharing of parameters but also grant the network private parameters for each task to avoid interference. However, unlike routing networks, the choice of which parameters are shared for which tasks, and which parameters are task-private is made statically in the architecture, independent of task.
147
+
148
+ The results are shown in Figures 6, 7, and 8. In each case the routing net routing-all-fc performs consistently better than the cross-stitch networks and the baselines. On CIFAR-MTL, the routing net beats cross-stitch networks by $7 \%$ and the next closest baseline task-specific-1-fc by $11 \%$ . On MIN-MTL, the routing net beats cross-stitch networks by about $2 \%$ and the nearest baseline taskspecific- ${ \mathbf { } } I { \mathbf { - } } f c$ by about $6 \%$ . We surmise that the results are better on CIFAR-MTL because the task instances have more in common whereas the MIN-MTL tasks are randomly constructed, making sharing less profitable.
149
+
150
+ On MNIST-MTL the random baseline is $90 \%$ . We experimented with several learning rates but were unable to get the cross-stitch networks to train well here. Routing nets beats the cross-stitch networks by $9 \%$ and the nearest baseline (task-specific-all- $f c$ ) by $3 \%$ . The soft version also had trouble learning on this dataset.
151
+
152
+ In all these experiments routing makes a significant difference over both cross-stitch networks and the baselines and we conclude that a dynamic policy which learns the function blocks to compose on a per-task basis yields better accuracy and sharper convergence than simple static sharing baselines or a soft attention approach.
153
+
154
+ In addition, router training is much faster. On CIFAR-MTL for example, training time on a stable compute cluster was reduced from roughly 38 hours to 5.6, an $85 \%$ improvement. We have conducted a set of scaling experiments to compare the training computation of routing networks and cross-stitch networks trained with 2, 3, 5, and 10 function blocks. The results are shown in the appendix in Figure 15. Routing networks consistently perform better than cross-stitch networks and the baselines across all these problems. Adding function blocks has no apparent effect on the computation involved in training routing networks on a dataset of a given size. On the other hand, cross-stitch networks has a soft routing policy that scales computation linearly with the number of function blocks. Because the soft policy backpropagates through all function blocks and the hard routing policy only backpropagates through the selected block, the hard policy can much more easily scale to many task learning scenarios that require many diverse types of functional primitives.
155
+
156
+ To explore why the multi-agent approach seems to do better than the single-agent, we manually compared their policy dynamics for several CIFAR-MTL examples. For these experiments $\rho = 0 . 0$ so there is no collaboration reward which might encourage less diversity in the agent choices. In the cases we examined we found that the single agent often chose just 1 or 2 function blocks at each depth, and then routed all tasks to those. We suspect that there is simply too little signal available to the agent in the early, random stages, and once a bias is established its decisions suffer from a lack of diversity.
157
+
158
+ ![](images/565c8e0c91534b53902ac96aef8a96a184d4b48ef8cc0d9a551a2ab8deeb5f40.jpg)
159
+ Figure 8: Results on domain MNIST-MTL
160
+
161
+ The routing network on the other hand learns a policy which, unlike the baseline static models, partitions the network quite differently for each task, and also achieves considerable diversity in its choices as can be seen in Figure 11. This figure shows the routing decisions made over the whole MNIST MTL dataset. Each task is labeled at the top and the decisions for each of the three routed layers are shown below. We believe that because the routing network has separate policies for each task, it is less sensitive to a bias for one or two function blocks and each agent learns more independently what works for its assigned task.
162
+
163
+ ![](images/f09ff43021494ef2c749fcee6f91f1eea02adce162ebbce48cd661c61f47131f.jpg)
164
+ Figure 9: The Policies of all Agents for the first function block layer for the first 100 samples of each task of MNIST-MTL
165
+
166
+ ![](images/2633118d0022706909199b6f61540b85d8e550f9bd16814867c1af8d9098de43.jpg)
167
+ Figure 10: The Probabilities of all Agents of taking Block 7 for the first 100 samples of each task (totalling 1000 samples) of MNIST-MTL
168
+
169
+ # 5 QUALITATIVE RESULTS
170
+
171
+ To better understand the agent interaction we have created several views of the policy dynamics. First, in Figure 9, we chart the policy over time for the first decision. Each rectangle labeled $T _ { i }$ on the left represents the evolution of the agent’s policy for that task. For each task, the horizontal axis is number of samples per task and the vertical axis is actions (decisions). Each vertical slice shows the probability distribution over actions after having seen that many samples of its task, with darker shades indicating higher probability. From this picture we can see that, in the beginning, all task agents have high entropy. As more samples are processed each agent develops several candidate function blocks to use for its task but eventually all agents converge to close to $100 \%$ probability for one particular block. In the language of games, the agents find a pure strategy for routing.
172
+
173
+ In the next view of the dynamics, we pick one particular function block (block 7) and plot the probability, for each agent, of choosing that block over time. The horizontal axis is time (sample) and the vertical axis is the probability of choosing block 7. Each colored curve corresponds to a different task agent. Here we can see that there is considerable oscillation over time until two agents, pink and green, emerge as the “victors” for the use of block 7 and each assign close to $100 \%$ probability for choosing it in routing their respective tasks. It is interesting to see that the eventual winners, pink and green, emerge earlier as well as strongly interested in block 7. We have noticed this pattern in the analysis of other blocks and speculate that the agents who want to use the block are being pulled away from their early Nash equilibrium as other agents try to train the block away.
174
+
175
+ ![](images/591416dc70bd339360d8b3929df2d93dacdcb0455ae0122a12157625919a6641.jpg)
176
+ Figure 11: An actual routing map for MNIST-MTL.
177
+
178
+ Finally, in Figure 11 we show a map of the routing for MNIST-MTL. Here tasks are at the top and each layer below represents one routing decision. Conventional wisdom has it that networks will benefit from sharing early, using the first layers for common representations, diverging later to accommodate differences in the tasks. This is the setup for our baselines. It is interesting to see that this is not what the network learns on its own. Here we see that the agents have converged on a strategy which first uses 7 function blocks, then compresses to just 4, then again expands to use 5. It is not clear if this is an optimal strategy but it does certainly give improvement over the static baselines.
179
+
180
+ # 6 FUTURE WORK
181
+
182
+ We have presented a general architecture for routing and multi-agent router training algorithm which performs significantly better than cross-stitch networks and baselines and other single-agent approaches. The paradigm can easily be applied to a state-of-the-art network to allow it to learn to dynamically adjust its representations.
183
+
184
+ As described in the section on Routing Networks, the state space to be learned grows exponentially with the depth of the routing, making it challenging to scale the routing to deeper networks in their entirety. It would be interesting to try hierarchical RL techniques (Barto & Mahadevan (2003)) here.
185
+
186
+ Our most successful experiments have used the multi-agent architecture with one agent per task, trained with the Weighted Policy Learner algorithm (Algorithm 3). Currently this approach is tabular but we are investigating ways to adapt it to use neural net approximators.
187
+
188
+ We have also tried routing networks in an online setting, training over a sequence of tasks for few shot learning. To handle the iterative addition of new tasks we add a new routing agent for each and overfit it on the few shot examples while training the function modules with a very slow learning rate. Our results so far have been mixed, but this is a very useful setting and we plan to return to this problem.
189
+
190
+ # REFERENCES
191
+
192
+ Sherief Abdallah and Victor Lesser. Learning the task allocation game. In Proceedings of the fifth international joint conference on Autonomous agents and multiagent systems, pp. 850–857. ACM, 2006. URL http://dl.acm.org/citation.cfm?id=1160786.
193
+
194
+ Rahaf Aljundi, Punarjay Chakravarty, and Tinne Tuytelaars. Expert gate: Lifelong learning with a network of experts. arXiv preprint arXiv:1611.06194, 2016.
195
+
196
+ Bowen Baker, Otkrist Gupta, Nikhil Naik, and Ramesh Raskar. Designing neural network architectures using reinforcement learning. ICLR, 2017.
197
+
198
+ Andrew G. Barto and Sridhar Mahadevan. Recent advances in hierarchical reinforcement learning. Discrete Event Dynamic Systems, 13(4):341–379, 2003. URL http://link.springer. com/article/10.1023/A:1025696116075.
199
+
200
+ Emmanuel Bengio, Pierre-Luc Bacon, Joelle Pineau, and Doina Precup. Conditional computation in neural networks for faster models. CoRR, abs/1511.06297, 2015. URL http://arxiv.org/ abs/1511.06297.
201
+
202
+ Andrew Brock, Theodore Lim, James M. Ritchie, and Nick Weston. SMASH: one-shot model architecture search through hypernetworks. CoRR, abs/1708.05344, 2017. URL http://arxiv. org/abs/1708.05344.
203
+
204
+ Timothy J Buschman and Earl K Miller. Shifting the spotlight of attention: evidence for discrete computations in cognition. Frontiers in human neuroscience, 4, 2010.
205
+
206
+ Rich Caruana. Multitask learning. Machine Learning, 28(1):41–75, Jul 1997. ISSN 1573-0565. doi: 10.1023/A:1007379606734. URL https://doi.org/10.1023/A:1007379606734.
207
+
208
+ Corinna Cortes, Xavi Gonzalvo, Vitaly Kuznetsov, Mehryar Mohri, and Scott Yang. Adanet: Adaptive structural learning of artificial neural networks. arXiv preprint arXiv:1607.01097, 2016.
209
+
210
+ 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.
211
+
212
+ Ludovic Denoyer and Patrick Gallinari. Deep sequential neural network. arXiv preprint arXiv:1410.0510, 2014.
213
+
214
+ Chrisantha Fernando, Dylan Banarse, Charles Blundell, Yori Zwols, David Ha, Andrei A. Rusu, Alexander Pritzel, and Daan Wierstra. Pathnet: Evolution channels gradient descent in super neural networks. CoRR, abs/1701.08734, 2017. URL http://arxiv.org/abs/1701. 08734.
215
+
216
+ Kevin Gurney, Tony J Prescott, and Peter Redgrave. A computational model of action selection in the basal ganglia. i. a new functional anatomy. Biological cybernetics, 84(6):401–410, 2001.
217
+
218
+ David Ha, Andrew Dai, and Quoc V Le. Hypernetworks. arXiv preprint arXiv:1609.09106, 2016.
219
+
220
+ Jessica B Hamrick, Andrew J Ballard, Razvan Pascanu, Oriol Vinyals, Nicolas Heess, and Peter W Battaglia. Metacontrol for adaptive imagination-based optimization. ICLR, 2017.
221
+
222
+ Robert A Jacobs, Michael I Jordan, Steven J Nowlan, and Geoffrey E Hinton. Adaptive mixtures of local experts. Neural computation, 3(1):79–87, 1991.
223
+
224
+ Michael I Jordan and Robert A Jacobs. Hierarchical mixtures of experts and the em algorithm. Neural computation, 6(2):181–214, 1994.
225
+
226
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014. URL http://arxiv.org/abs/1412.6980.
227
+
228
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. 2009.
229
+
230
+ Yann Lecun, Lon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. In Proceedings of the IEEE, pp. 2278–2324, 1998.
231
+
232
+ Lanlan Liu and Jia Deng. Dynamic deep neural networks: Optimizing accuracy-efficiency trade-offs by selective execution. arXiv preprint arXiv:1701.00299, 2017.
233
+
234
+ Mason McGill and Pietro Perona. Deciding how to decide: Dynamic routing in artificial neural networks. International Conference on Machine Learning, 2017.
235
+
236
+ Risto Miikkulainen, Jason Liang, Elliot Meyerson, Aditya Rawal, Dan Fink, Olivier Francon, Bala Raju, Arshak Navruzyan, Nigel Duffy, and Babak Hodjat. Evolving deep neural networks. arXiv preprint arXiv:1703.00548, 2017.
237
+
238
+ Ishan Misra, Abhinav Shrivastava, Abhinav Gupta, and Martial Hebert. Cross-stitch networks for multi-task learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3994–4003, 2016.
239
+
240
+ Tsendsuren Munkhdalai and Hong Yu. Meta networks. International Conference on Machine Learning, 2017.
241
+
242
+ Janarthanan Rajendran, P. Prasanna, Balaraman Ravindran, and Mitesh M. Khapra. ADAAPT: attend, adapt, and transfer: Attentative deep architecture for adaptive policy transfer from multiple sources in the same domain. ICLR, abs/1510.02879, 2017. URL http://arxiv.org/abs/ 1510.02879.
243
+
244
+ Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. ICLR, 2017.
245
+
246
+ Matthew Riemer, Aditya Vempaty, Flavio Calmon, Fenno Heath, Richard Hull, and Elham Khabiri. Correcting forecasts with multifactor neural attention. In International Conference on Machine Learning, pp. 3010–3019, 2016.
247
+
248
+ Sebastian Ruder, Joachim Bingel, Isabelle Augenstein, and Anders Søgaard. Sluice networks: Learning what to share between loosely related tasks. arXiv preprint arXiv:1705.08142, 2017.
249
+
250
+ Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz, Andy Davis, Quoc Le, Geoffrey Hinton, and Jeff Dean. Outrageously large neural networks: The sparsely-gated mixture-of-experts layer. ICLR, 2017.
251
+
252
+ Andrea Stocco, Christian Lebiere, and John R Anderson. Conditional routing of information to the cortex: A model of the basal ganglias role in cognitive coordination. Psychological review, 117 (2):541, 2010.
253
+
254
+ Marijn F Stollenga, Jonathan Masci, Faustino Gomez, and Juergen Schmidhuber. Deep networks with internal selective attention through feedback connections. In Z. Ghahramani, M. Welling, C. Cortes, N. D. Lawrence, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 27, pp. 3545–3553. Curran Associates, Inc., 2014.
255
+
256
+ Oriol Vinyals, Charles Blundell, Timothy P. Lillicrap, Koray Kavukcuoglu, and Daan Wierstra. Matching networks for one shot learning. CoRR, abs/1606.04080, 2016. URL http://arxiv. org/abs/1606.04080.
257
+
258
+ Christopher John Cornish Hellaby Watkins. Learning from delayed rewards. PhD thesis, King’s College, Cambridge, 1989.
259
+
260
+ Olga Wichrowska, Niru Maheswaranathan, Matthew W Hoffman, Sergio Gomez Colmenarejo, Misha Denil, Nando de Freitas, and Jascha Sohl-Dickstein. Learned optimizers that scale and generalize. arXiv preprint arXiv:1703.04813, 2017.
261
+
262
+ Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992. ISSN 0885-6125.
263
+
264
+ Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. ICLR, 2017.
265
+
266
+ # 7 APPENDIX
267
+
268
+ # 7.1 IMPACT OF RHO
269
+
270
+ ![](images/6365ef98272c6cbb41a3ea6b531077644e5b3d5779e2390f487395bb0fa5706b.jpg)
271
+ Figure 12: Influence of the “collaboration reward” $\rho$ on CIFAR-MTL. The architecture is routingall-fc with WPL routing agents.
272
+
273
+ ![](images/a66fa3d76532e304689191c54074d2e80c5b8a4b9bd1316e62447418d4c52395.jpg)
274
+ Figure 13: Comparison of per-task training cost for cross-stitch and routing networks. We add a function block per task and normalize the training time per epoch by dividing by the number of tasks to isolate the effect of adding function blocks on computation.
275
+
276
+ # 7.2 THE PASS ACTION
277
+
278
+ When routing networks, some resulting sets of function blocks can be applied repeatedly. While there might be other constraints, the prevalent one is dimensionality - input and output dimensions need to match. Applied to the SimpleConvNet architecture used throughout the paper, this means that of the fc layers - (convolution $ 4 8$ ), $^ { \prime } 4 8 \to 4 8$ ), $( 4 8 \to \# c l a s s e s )$ ), the middle transformation can be applied an arbitrary number of times. In this case, the routing network becomes fully recurrent and the PASS action is applicable. This allows the network to shorten the recursion depth.
279
+
280
+ # 7.3 OVERVIEW OF IMPLEMENTATIONS
281
+
282
+ We have tested 9 different implementation variants of the routing architectures. The architectures are summarized in Tables 3 and 4. The columns are:
283
+
284
+ #Agents refers to how many agents are used to implement the router. In most of the experiments, each router consists of one agent per task. However, as described in 3.1, there are implementations with 1 and #tasks $^ { + 1 }$ agents.
285
+
286
+ Table 2: Numeric results (in $\%$ accuracy) for Figures 4 through 8
287
+
288
+ <table><tr><td></td><td>Epoch</td><td>1</td><td>5</td><td>10</td><td>20</td><td>50</td><td>100</td></tr><tr><td rowspan="4">RL (Figure 4)</td><td>REINFORCE: approx</td><td>20</td><td>20</td><td>20</td><td>20</td><td>20</td><td>20</td><td></td></tr><tr><td>Qlearning: approx</td><td>20</td><td>20</td><td>20</td><td>20</td><td></td><td>24</td><td>25</td></tr><tr><td>Qlearning:table</td><td>20</td><td>36</td><td>47</td><td>50</td><td></td><td>55</td><td>55</td></tr><tr><td>MARL-WPL: table</td><td>31</td><td>53</td><td>57</td><td>58</td><td></td><td>60</td><td>60</td></tr><tr><td rowspan="5">arch (Figure 5)</td><td>routing-all-fc</td><td>31</td><td>53</td><td>57</td><td></td><td>58</td><td>60</td><td>60</td></tr><tr><td>routing-all-fc recursive</td><td>31</td><td>43</td><td>45</td><td></td><td>48</td><td>48</td><td>46</td></tr><tr><td>routing-all-fc dispatched</td><td>20</td><td>23</td><td>28</td><td></td><td>37</td><td>42</td><td>41</td></tr><tr><td>soft mixture-all-fc</td><td>20</td><td>24</td><td>27</td><td></td><td>30</td><td>32</td><td>35</td></tr><tr><td>routing-all-fc single agent</td><td>20</td><td>23</td><td>33</td><td></td><td>42</td><td>44</td><td>44</td></tr><tr><td rowspan="4">CIFAR (Figure 6</td><td>routing-all-fc</td><td>31</td><td>53</td><td>57</td><td></td><td>58</td><td>60</td><td>60</td></tr><tr><td>task specific-all-fc</td><td>21</td><td>29</td><td>33</td><td></td><td>36</td><td>42</td><td>42</td></tr><tr><td>task specific-1-fc</td><td>27</td><td>34</td><td>39</td><td></td><td>42</td><td>48</td><td>49</td></tr><tr><td>cross stitch-all-fc</td><td>26</td><td>37</td><td>42</td><td></td><td>49</td><td>52</td><td>53</td></tr><tr><td rowspan="4">MIN (Figure 7)</td><td>routing-all-fc</td><td>34</td><td>54</td><td>57</td><td></td><td>55</td><td>58</td><td>57</td></tr><tr><td>task specific-all-fc</td><td>22</td><td>30</td><td>37</td><td></td><td>43</td><td>47</td><td>48</td></tr><tr><td>task specific-1fc</td><td>29</td><td>38</td><td>43</td><td></td><td>46</td><td>51</td><td>51</td></tr><tr><td>cross-stitch-all-fc</td><td>29</td><td>41</td><td>48</td><td></td><td>53</td><td></td><td>55</td></tr><tr><td rowspan="5">MNIST (Figure : 8)</td><td>routing-all-fc</td><td></td><td></td><td></td><td></td><td></td><td>56</td><td>99</td></tr><tr><td>task specific-all-fc</td><td>90</td><td>90</td><td>98</td><td></td><td>99</td><td>99</td><td></td></tr><tr><td>task specific-1fc</td><td>90 90</td><td>91 90</td><td>94 91</td><td></td><td>95</td><td>95</td><td>96 95</td></tr><tr><td>soft mixture-all-fc</td><td>90</td><td>90</td><td>90</td><td></td><td>92 90</td><td>93 90</td><td>90</td></tr><tr><td>cross-stitch-all-fc</td><td></td><td></td><td></td><td></td><td>90</td><td>90</td><td></td></tr><tr><td></td><td></td><td>90</td><td>90</td><td>90</td><td></td><td></td><td></td><td>90</td></tr></table>
289
+
290
+ ![](images/1b52033268ba78b231876fdbc8809a6b89dd154b2f9644017dd44b618359806f.jpg)
291
+ Figure 15: Results on the first $n$ tasks of CIFAR-MTL
292
+
293
+ Table 3: Implementation details for Figure 4. All approx functions are 2 layer MLPs with a hidden dim of 64.
294
+
295
+ <table><tr><td>Name</td><td>Num Agents</td><td>Policy Representation</td><td>Part of State =(v,t,d) Used</td></tr><tr><td>MARL:WPL</td><td>Num Tasks</td><td>Tabular (num layers x num function blocks)</td><td>t,d</td></tr><tr><td>REINFORCE</td><td>Num Tasks</td><td>Vector(numlayers)ofapprox functions</td><td>v,t,d</td></tr><tr><td>Q-Learning</td><td>Num Tasks</td><td>Vector (num layers) of approx functions</td><td>v,t,d</td></tr><tr><td>Q-Learning</td><td>Num Tasks</td><td>Tabular (num layers x num function blocks)</td><td>t,d</td></tr></table>
296
+
297
+ Table 4: Implementation details for Figure 5. All approx functions are 2 layer MLP’s with a hidden dim of 64.
298
+
299
+ <table><tr><td>Name</td><td>Num Agents</td><td>Policy Representation</td><td>Part of State = (v,t,d) Used</td></tr><tr><td>routing-all-fc</td><td>Num Tasks</td><td>Tabular (numlayers X num function blocks)</td><td>t,d</td></tr><tr><td>routing-all-fc non-layered</td><td>Num Tasks</td><td>tabular (num layers X num function blocks)</td><td>t,d</td></tr><tr><td>soft-routing-all-fc</td><td>Num Tasks</td><td>Vector(num layers) of appox functions</td><td>v,t,d</td></tr><tr><td>dispatched-routing-all-fc</td><td>Num Tasks +1</td><td>Vector (num layers) of appox functions+ dispatcher</td><td>v,td</td></tr><tr><td>single-agent-routing-all-fc</td><td>1</td><td>Vector (num layers)of approx functions)</td><td>v,t,d</td></tr></table>
300
+
301
+ Policy Representation There are two dominant representation variations, as described in 3.1. In the first, the policy is stored as a table. Since the table needs to store values for each of the different layers of the routing network, it is of size num layers $\times$ num actions. In the second, it is represented either as vector of MLP’s with a hidden layer of dimension 64, one for each layer of the routing network. In this case the input to the MLP is the representation vector $v$ concatenated with a one-hot representation of the task identifier.
302
+
303
+ Policy Input describes which parts of the state are used in the decision of the routing action. For tabular policies, the task is used to index the agent responsible for handling that task. Each agent then uses the depth as a row index into into the table. For approximation-based policies, there are two variations. For the single agent case the depth is used to index an approximation function which takes as input concat $_ v$ , one-hot $\mathbf { \eta } ^ { ( t ) }$ ). For the multi-agent (non-dispatched) case the task label is used to index the agent and then the depth is used to index the corresponding approximation function for that depth, which is given concat(v, one-hot $\mathbf { \rho } ( t )$ ) as input. In the dispatched case, the dispatcher is given concat $\dot { \boldsymbol { v } }$ , one-hot(t)) and predicts an agent index. That agent uses the depth to find the approximation function for that depth which is then given concat( $\boldsymbol { v }$ , one-hot $\mathbf { \Psi } ( t ) .$ ) as input.
304
+
305
+ # 7.4 EXPLANATION OF THE WEIGHTED POLICY LEARNER (WPL) ALGORITHM
306
+
307
+ The WPL algorithm is a multi-agent policy gradient algorithm designed to help dampen policy oscillation and encourage convergence. It does this by slowly scaling down the learning rate for an agent after a gradient change in that agents policy. It determines when there has been a gradient change by using the difference between the immediate reward and historical average reward for the action taken. Depending on the sign of the gradient the algorithm is in one of two scenarios. If the gradient is positive then it is scaled by $1 - \pi ( a _ { i } )$ . Over time if the gradient remains positive it will cause $\pi ( \boldsymbol { a } _ { i } )$ to increase and so $1 - \pi ( a _ { i } )$ will go to 0, slowing the learning. If the gradient is negative then it is scaled by $\pi ( \boldsymbol { a } _ { i } )$ . Here again if the gradient remains negative over time it will cause $\pi ( \boldsymbol { a } _ { i } )$ to decrease eventually to 0, slowing the learning again. Slowing the learning after gradient changes dampens the policy oscillation and helps drive the policies towards convergence.
md/train/rylT0AVtwH/rylT0AVtwH.md ADDED
@@ -0,0 +1,418 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING FROM PARTIALLY-OBSERVED MULTIMODAL DATA WITH VARIATIONAL AUTOENCODERS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Learning from only partially-observed data for imputation has been an active research area. Despite promising progress on unimodal data imputation (e.g., image in-painting), models designed for multimodal data imputation are far from satisfactory. In this paper, we propose variational selective autoencoders (VSAE) for this task. Different from previous works, our proposed VSAE learns only from partially-observed data. VSAE is capable of learning the joint distribution of observed and unobserved modalities as well as the imputation mask, resulting in a unified model for various down-stream tasks including data generation and imputation. Evaluation on both synthetic high-dimensional and challenging lowdimensional multi-modality datasets shows significant improvement over the stateof-the-art data imputation models.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Learning from data is an integral part of machine learning and artificial intelligence. Modern deep learning techniques rely heavily on extracting information form large scale datasets. While such frameworks have been shown to be effective on various down-stream tasks such as classification, regression, representation learning, and prediction, it is typically crucial to have access to clean and complete training data. Complete data in this case can be either labeled data (for classification), or time-series data with no missing values (for regression), or simply image with no missing pixels (for generation). As such, if a model can only access partially-observed data, the performance will likely be much worse than those trained with fully-observed data, if not completely failing. In practical scenarios, however, it is usually costly to acquire clean and complete data due to the limited human resources and time. Having a model designed to learn and extract information from partially-observed data will not only largely increase the application spectrum of deep learning based models, but also provide benefit to new down-stream tasks, for example, data imputation.
12
+
13
+ Data imputation with deep generative models has been an active research area (Yoon et al., 2018; Ivanov et al., 2019; Nazabal et al., 2018). Despite promising progress, there are still challenges in learning effective models. First, some prior works focus on learning from fully-observed data while performing imputation on partially-observed data during test phase (Suzuki et al., 2016; Ivanov et al., 2019). Second, they usually have strong assumptions on missingness mechanism (see A.1) such as data is missing completely at random (MCAR) (Yoon et al., 2018). Third, mostly unimodal imputation such as image in-painting has been explored for high-dimensional data (Ivanov et al., 2019; Mattei & Frellsen, 2019). Unimodal data refers to data with only one modality such as image, video, or text. Modeling any combination of data modalities is not well-established yet, which apparently limits the potential of such models, since raw data in real-life is usually acquired in a multimodal manner (Ngiam et al., 2011) with more than one source of data gathered to represent a practical scenario. In practice, one or more of the modalities maybe be missing, leading to a challenging multimodal data imputation task.
14
+
15
+ In this work, we propose Variational Selective Autoencoder (VSAE) for multimodal data generation and imputation. Our proposed VSAE tries to address the challenges above by learning from partiallyobserved training data. By constructing an encoder for each modality independently, the latent representation selectively takes only the observed modalities as input, while a set of decoders maps the latent codes to not only full data (including both observed and unobserved modalities), but also a mask representing the missingness scheme. Thus, it can model the joint distribution of the data and the mask together and avoid limiting assumptions such as MCAR, and is optimized efficiently with a single variational objective. In our experimental validation, we evaluate our proposed VSAE on both synthetic high-dimensional multimodal data and challenging low-dimensional tabular data, and show that VSAE can outperform state-of-the-art baseline models for data imputation task. The contributions are summarized as follows:
16
+
17
+ (1) A novel framework VSAE to learn from partially-observed multimodal data. (2) The proposed VSAE is capable of learning the joint distribution of observed and unobserved modalities as well as the imputation mask, resulting in a unified model for various down-stream tasks including data generation and imputation with relaxed assumptions on missigness mechanism. (3) Evaluation on both synthetic high-dimensional and challenging low-dimensional multimodal datasets shows improvement over the state-of-the-art data imputation models.
18
+
19
+ # 2 RELATED WORK
20
+
21
+ Our work is related to literature on data imputation and multi-modal representation learning. In this section, we briefly review recent models proposed in these two domains.
22
+
23
+ Data Imputation. Classical imputation methods such as MICE (Buuren & Groothuis-Oudshoorn, 2010) and MissForest (Stekhoven & Bühlmann, 2011) learn discriminative models to impute missing features from observed ones. With recent advances in deep learning, several deep imputation models have been proposed based on autoencoders (Vincent et al., 2008; Gondara & Wang, 2017; Ivanov et al., 2019), generative adversarial nets (GANs) (Yoon et al., 2018; Li et al., 2019), and autoregressive models (Bachman & Precup, 2015). GAN-based imputation method GAIN proposed by Yoon et al. (2018) assumes that data is missing completely at random. Moreover, this method does not scale to high-dimensional multimodal data. Several VAE based methods (Ivanov et al., 2019; Nazabal et al., 2018; Mattei & Frellsen, 2019) have been proposed in recent years. Ivanov et al. (2019) formulated VAE with arbitrary conditioning (VAEAC) which allows generation of missing data conditioned on any combination of observed data. This algorithm needs complete data during training and cannot learn from partially-observed data only. Nazabal et al. (2018) and Mattei & Frellsen (2019) modified VAE formulation to model the likelihood of the observed data only. However, they require training of a separate generative network for each dimension thereby increasing computational requirements. In contrast, our method aims to model joint distribution of observed and unobserved data along with the missing pattern (imputation mask). This enables our model to perform both data generation and imputation even under relaxed assumptions on missingness mechanism (see Appendix A.1).
24
+
25
+ Learning from Multimodal Data. A class of prior works such as conditional VAE (Sohn et al., 2015) and conditional multimodal VAE (Pandey & Dukkipati, 2017) focus on learning the conditional likelihood of the modalities. However, these models requires complete data during training and cannot handle arbitrary conditioning. Alternatively, several generative models aim to model joint distribution of all modalities (Ngiam et al., 2011; Srivastava & Salakhutdinov, 2012; Sohn et al., 2014; Suzuki et al., 2016). However, multimodal VAE based methods such as joint multimodal VAE (Suzuki et al., 2016) and multimodal factorization model (MFM) (Tsai et al., 2019) require complete data during training. On the other hand, Wu & Goodman (2018) proposed another multimodal VAE (namely MVAE) can be trained with incomplete data. This model leverages a shared latent space for all modalities and obtains an approximate joint posterior for the shared space assuming each modalities to be factorized. However, if training data is complete, this model cannot learn the individual inference networks and consequently does not learn to handle missing data during test. Building over multimodal VAE approaches, our model aims to address the shortcomings above within a flexible framework. In particular, our model can learn multimodal representations from partially observed training data and perform data imputation from arbitrary subset of modalities during test. By employing a factorized multimodal representations in the latent space it resembles disentangled models which can train factors specialized for learning from different parts of data (Tsai et al., 2019).
26
+
27
+ # 3 METHOD
28
+
29
+ In this section, we introduce a novel VAE-based framework named Variational Selective Autoencoder (VSAE) to learn from partially-observed multimodal data. We first formalize our problem and then provide a detailed description of our model.
30
+
31
+ ![](images/9a34080af58e84b254d9964b9cab193900805c427f78d7d6aa779cab76ec9a20.jpg)
32
+ Figure 1: Overall architecture. The unimodal proposal network and multimodal proposal network are employed by selection. Modalities are denoted by different colors. Unobserved modalities are shaded. (i.e. blue is observed while red/yellow are unobserved.) The selected variables are indicated by the arrows. Standard normal prior is not plotted for simplicity. All components are trained simultaneously in an end-to-end manner.
33
+
34
+ # 3.1 PROBLEM STATEMENT
35
+
36
+ Let $\mathbf { x } = [ \mathbf { x } _ { 1 } , \mathbf { x } _ { 2 } . . . , \mathbf { x } _ { M } ]$ be the complete data with $M$ modalities, where $\mathbf { x } _ { i }$ denotes the feature representation for the $i$ -th modality. The size of each $\mathbf { x } _ { i }$ varies and can be very high-dimensional (e.g. multimedia data) or low-dimensional (e.g. tabular data). We define an $M$ -dimensional binary mask variable $\mathbf { m } \in \{ 0 , 1 \} ^ { M }$ to represent the observed and unobserved modalities: $m _ { i } = 1$ if the $i$ -th modality is observed and 0 if unobserved. Thus we have the set of observed modalities $\mathbb { O } = \{ i | m _ { i } = 1 \}$ , and the set of unobserved modalities $\mathbb { U } = \{ i | m _ { i } = 0 \}$ . $\mathbb { O }$ and $\mathbb { U }$ are complementary subsets of all modalities. Accordingly, we denote the representation for the observed and unobserved modalities with $\mathbf { x _ { o } } = [ \mathbf { x } _ { i } | m _ { i } = 1 ]$ and $\mathbf { x _ { u } } = [ \mathbf { x } _ { i } | m _ { i } = 0 ]$ , respectively. In this paper, we assume the data $\mathbf { x }$ and the mask $\mathbf { m }$ are dependent, and aim to model the joint distribution of them together.
37
+
38
+ As a result of such joint modeling, VSAE has higher capacity and can be used for both data imputation and data/mask generation. We encoder the multimodal data to a latent space factorized with respect to the modalities. To handle training and test with partially-observed data, the variational latent variable of each modality is modeled selectively to choose between a unimodal encoder if the corresponding modality is observed, or a multimodal encoder if the modality is unobserved. In addition, all the modalities and mask are reconstructed by decoding the aggregated latent codes through decoders.
39
+
40
+ # 3.2 BACKGROUND: VARIATIONAL AUTOENCODER
41
+
42
+ VAE (Kingma & Welling, 2013) is a probabilistic latent variable model to generate a random variable $\mathbf { x }$ from a latent variable $\mathbf { z }$ with a prior distribution $p ( \mathbf { z } )$ according to the marginalized distribution $\begin{array} { r } { p ( \mathbf { x } ) = \mathbb { E } _ { \mathbf { z } \sim p ( \mathbf { z } ) } p ( \mathbf { x } | \mathbf { z } ) = \int p ( \mathbf { x } | \mathbf { z } ) p ( \mathbf { z } ) d \mathbf { z } } \end{array}$ . However, this is computationally intractable, so the likelihood $\log p ( \mathbf { x } )$ is approximated by variational lower bound (ELBO) $\mathcal { L } _ { \theta , \phi } ( \mathbf { x } )$ :
43
+
44
+ $$
45
+ \begin{array} { r } { \log p ( \mathbf { x } ) \geq \mathcal { L } _ { \theta , \phi } ( \mathbf { x } ) = \mathbb { E } _ { \mathbf { z } \sim q _ { \phi } ( \mathbf { z } \mid \mathbf { x } ) } [ \log p _ { \theta } ( \mathbf { x } \mid \mathbf { z } ) ] - D _ { \mathrm { K L } } [ q _ { \phi } ( \mathbf { z } \mid \mathbf { x } ) | | p ( \mathbf { z } ) ] . } \end{array}
46
+ $$
47
+
48
+ In this equation, $q _ { \phi } ( \mathbf { z } | \mathbf { x } )$ is a proposal distribution to approximate intractable true posterior $p ( \mathbf { z } | \mathbf { x } )$ and parameterized by an inference network (a.k.a encoder). $p _ { \pmb { \theta } } ( \mathbf { x } | \mathbf { z } )$ is the conditional likelihood parameterized by another generative network (a.k.a decoder). $D _ { \mathrm { K L } }$ is the Kullback-Leibler (KL) divergence between the prior and the proposal distribution and functions as a regularizer term, $D _ { \mathrm { K L } } [ \bar { q } _ { \phi } ( \mathbf { z } | \mathbf { x } ) | | p ( \mathbf { z } ) ] = \mathbb { E } _ { \mathbf { z } \sim q _ { \phi } ( \mathbf { z } | \mathbf { x } ) } [ \log q _ { \phi } ( \mathbf { z } | \mathbf { x } ) - \log p ( \mathbf { z } ) ] .$ . To train this model $\mathcal { L } _ { \theta , \phi } ( \mathbf { x } )$ is optimized over all training data with respect to the parameters $\pmb { \theta }$ and $\phi$ . For more details see Appendix A.2.
49
+
50
+ # 3.3 PROPOSED MODEL: VARIATIONAL SELECTIVE AUTOENCODER
51
+
52
+ Our goal is to model the joint distribution $\begin{array} { r } { p ( \mathbf { x } , \mathbf { m } ) = \int p ( \mathbf { x } , \mathbf { m } | \mathbf { z } ) p ( \mathbf { z } ) d \mathbf { z } } \end{array}$ where $\mathbf { x } = [ \mathbf { x _ { o } } , \mathbf { x _ { u } } ]$ . Following VAE formulation, we construct a proposal distribution $q ( \mathbf { z } | \mathbf { x } , \mathbf { m } )$ to approximate the intractable true posterior. See the architecture in Figure 1, we denote the parameters of encoder by $\{ \phi , \psi \}$ , and decoders of data and mask by $\theta$ and $\epsilon$ respectively. A lower bound of $\log p ( \mathbf { x } , \mathbf { m } )$ can be derived as:
53
+
54
+ $$
55
+ \begin{array} { r l } & { { \mathcal { L } } _ { \phi , \psi , \theta , \epsilon } ( \mathbf { x } , \mathbf { m } ) = \mathbb { E } _ { \mathbf { z } \sim q _ { \phi , \psi } ( \mathbf { z } | \mathbf { x } , \mathbf { m } ) } [ \log p _ { \theta , \epsilon } ( \mathbf { x } , \mathbf { m } | \mathbf { z } ) ] - D _ { \mathrm { K L } } [ q _ { \phi , \psi } ( \mathbf { z } | \mathbf { x } , \mathbf { m } ) | | p ( \mathbf { z } ) ] } \\ & { \qquad = \mathbb { E } _ { \mathbf { z } \sim q _ { \phi , \psi } ( \mathbf { z } | \mathbf { x } , \mathbf { m } ) } [ \log p _ { \theta } ( \mathbf { x } | \mathbf { m } , \mathbf { z } ) + \log p _ { \epsilon } ( \mathbf { m } | \mathbf { z } ) - \log q _ { \phi , \psi } ( \mathbf { z } | \mathbf { x } , \mathbf { m } ) + \log p ( \mathbf { z } ) ] . } \end{array}
56
+ $$
57
+
58
+ We assume the variational latent variables can be factorized with respect to the modalities ${ \textbf { z } } =$ $[ { \bf z } _ { 1 } , { \bf z } _ { 2 } , . . . , { \bf z } _ { M } ]$ , which is a standard assumption for multimodal data (Tsai et al., 2019):
59
+
60
+ $$
61
+ p ( \mathbf { z } ) = \prod _ { i = 1 } ^ { M } p ( \mathbf { z } _ { i } ) , \qquad q ( \mathbf { z } | \mathbf { x } , \mathbf { m } ) = \prod _ { i = 1 } ^ { M } q ( \mathbf { z } _ { i } | \mathbf { x } , \mathbf { m } ) .
62
+ $$
63
+
64
+ Given this, we define the proposal distribution parameterized by $\phi$ and $\psi$ for each modality as
65
+
66
+ $$
67
+ q _ { \phi , \psi } ( \mathbf { z } _ { i } | \mathbf { x } , \mathbf { m } ) = \left\{ \begin{array} { l l } { q _ { \phi } ( \mathbf { z } _ { i } | \mathbf { x } _ { i } ) } & { \mathrm { i f } \ m _ { i } = 1 } \\ { q _ { \psi } ( \mathbf { z } _ { i } | \mathbf { x _ { o } } , \mathbf { m } ) } & { \mathrm { i f } \ m _ { i } = 0 } \end{array} \right.
68
+ $$
69
+
70
+ This is based on the intuitive assumption that the latent space of each modality is independent of other modalities given its data is observed. But, if the data is missing for some modality, its latent space is constructed from the other observed modalities. We call this selective proposal distribution.
71
+
72
+ In the decoder, the probability distribution also factorizes over the modalities assuming that the reconstructions are conditionally independent given the complete set of latent variables of all modalities:
73
+
74
+ $$
75
+ \log p _ { \theta } ( \mathbf { x } | \mathbf { m } , \mathbf { z } ) = \log p _ { \theta } ( \mathbf { x _ { o } } , \mathbf { x _ { u } } | \mathbf { m } , \mathbf { z } ) = \sum _ { i \in \mathbb { O } } \log p _ { \theta } ( \mathbf { x } _ { i } | \mathbf { m } , \mathbf { z } ) + \sum _ { j \in \mathbb { U } } \log p _ { \theta } ( \mathbf { x } _ { j } | \mathbf { m } , \mathbf { z } )
76
+ $$
77
+
78
+ To summarize, the ELBO in Equation 2 can be rewritten as
79
+
80
+ $$
81
+ \begin{array} { l } { \displaystyle \mathcal { L } _ { \phi , \psi , \theta , \epsilon } ( \mathbf { x _ { o } } , \mathbf { x _ { u } } , \mathbf { m } ) = \mathbb { E } _ { \mathbf { z } } \left[ \sum _ { i \in \mathbb { O } } \log p \varrho ( \mathbf { x } _ { i } | \mathbf { m } , \mathbf { z } ) + \sum _ { j \in \mathbb { U } } \log p \varrho ( \mathbf { x } _ { j } | \mathbf { m } , \mathbf { z } ) \right] + \mathbb { E } _ { \mathbf { z } } \big [ \log p _ { \epsilon } ( \mathbf { m } | \mathbf { z } ) \big ] } \\ { \displaystyle \qquad - \sum _ { i = 1 } ^ { M } \mathbb { E } _ { \mathbf { z } _ { i } } \big [ \log q _ { \phi , \psi } ( \mathbf { z } _ { i } | \mathbf { x } , \mathbf { m } ) - \log p ( \mathbf { z } _ { i } ) \big ] , } \end{array}
82
+ $$
83
+
84
+ where $\mathbf { z } _ { i } \sim q _ { \phi , \psi } ( \mathbf { z } _ { i } | \mathbf { x } , \mathbf { m } )$ according to the selective proposal distribution given in Equation 4.
85
+
86
+ For training the model, the ELBO should be maximized over training data. However under partiallyobserved setting, $\mathbf { x _ { u } }$ is missing and unavailable even during training. Thus, we define the objective function for training by taking expectation over $\mathbf { x _ { u } }$
87
+
88
+ $$
89
+ \mathcal { L } _ { \phi , \psi , \theta , \epsilon } ^ { \prime } ( \mathbf { x _ { o } } , \mathbf { m } ) = \mathbb { E } _ { \mathbf { x _ { u } } } [ \mathcal { L } _ { \phi , \psi , \theta , \epsilon } ( \mathbf { x _ { o } } , \mathbf { x _ { u } } , \mathbf { m } ) ]
90
+ $$
91
+
92
+ Only one term in Equation 6 is dependent on $\mathbf { x _ { u } }$ , so the final objective function is obtained as
93
+
94
+ $$
95
+ \begin{array} { l } { \displaystyle \mathcal { L } _ { \phi , \psi , \theta , \epsilon } ^ { \prime } ( \mathbf { x _ { o } } , \mathbf { m } ) = \mathbb { E } _ { \mathbf { z } } \left[ \sum _ { i \in \mathbb { O } } \log p \varrho ( \mathbf { x } _ { i } | \mathbf { m } , \mathbf { z } ) + \sum _ { j \in \mathbb { U } } \mathbb { E } _ { \mathbf { x } _ { j } } \big [ \log p \varrho ( \mathbf { x } _ { j } | \mathbf { m } , \mathbf { z } ) \big ] \right] + \mathbb { E } _ { \mathbf { z } } \big [ \log p _ { \epsilon } ( \mathbf { m } | \mathbf { z } ) \big ] } \\ { \displaystyle \qquad - \sum _ { i = 1 } ^ { M } \mathbb { E } _ { \mathbf { z } _ { i } } \big [ \log q _ { \phi , \psi } ( \mathbf { z } _ { i } | \mathbf { x } , \mathbf { m } ) - \log p ( \mathbf { z } _ { i } ) \big ] , \ : \mathrm { w h e r e ~ } \mathbf { z } _ { i } \sim q _ { \phi , \psi } ( \mathbf { z } _ { i } | \mathbf { x } , \mathbf { m } ) \qquad ( \forall \ : \mathbf { z } _ { i } \propto \mathbb { I } _ { \mathbf { z } } ) , } \end{array}
96
+ $$
97
+
98
+ In the proposed algorithm, we approximate $\mathbb { E } _ { \mathbf { x } _ { j } } [ \log p _ { \pmb { \theta } } ( \mathbf { x } _ { j } | \mathbf { m } , \mathbf { z } ) ] , j \in \mathbb { U }$ using reconstructed unobserved data sampling from the prior network. Our experiments show that even a single sample is sufficient to learn the model effectively. In fact, the prior network can be used as a self supervision mechanism to find the most likely samples which dominate the other samples when taking the expectation. In Equation 8, $p _ { \pmb { \theta } } ( \mathbf { x } _ { i } | \mathbf { m } , \mathbf { z } )$ is the decoding term of corresponding modality $\mathbf { x } _ { i }$ and the type of distribution depends on the data. The mask decoding term $p _ { \pmb { \theta } } ( \mathbf { m } | \mathbf { z } )$ is factorized Bernoulli distribution modeling the binary mask variable. The prior is standard normal distribution $\begin{array} { r } { p ( \mathbf { z } ) = \prod _ { i = 1 } ^ { M } p ( \mathbf { z } _ { i } ) = \prod _ { i = 1 } ^ { M } \mathcal { \bar { N } } ( \mathbf { z } _ { i } ; \mathbf { 0 } , \mathbf { I } ) } \end{array}$ which is fully-factorized.
99
+
100
+ # 3.4 NETWORK MODULES
101
+
102
+ We construct each module of our model using neural networks and optimize the parameters via backpropagation techniques. Following the terms in standard VAE, VSAE is composed of encoders and decoders. The architecture is shown in Figure 1. The whole architecture can be viewed as an integration of two auto-encoding structures: the top-branch data-wise encoders/decoders and the bottom-branch mask-wise encoders/decoder. The selective proposal distribution chooses between the unimodal and multimodal encoders, depending on whether the data is observed or not. The outputs of all encoders are sampled and aggregated to provide input to all the decoders. In the rest of this section we explain different modules. See Appendix B for further implementation details.
103
+
104
+ Selective Factorized Encoders Standard proposal distribution of VAEs depends on the whole data and can not handle incomplete input. To overcome this, we introduce our selective proposal distribution, which is factorized w.r.t the modalities. As defined in Equation 4, the unimodal proposal distribution $q _ { \phi } ( \mathbf { z } _ { i } | \mathbf { x } _ { i } )$ is inferred only from each individual observed modality (modeled by a set of separate encoders parameterized by $\phi$ ). If the modality is unobserved, the multimodal proposal distribution $q _ { \psi } ( \mathbf { z } _ { i } | \mathbf { x _ { o } } , \mathbf { m } )$ (a single encoder parameterized by $\psi$ ) is used to infer corresponding latent variables from other observed modalities and mask. Hence, the learned model can impute the missing information by combining unimodal proposal distribution of observed modalities and multimodal proposal distribution of the unobserved modalities. The condition on the mask could make the model aware of the missing pattern and help attend to observed modalities. We model all the proposal distributions as normal distributions by setting the outputs of all encoders as mean and covariance of a normal distribution. The reparameterization in standard VAE is used for end-to-end training.
105
+
106
+ Decoding through Latent Variable Aggregator $\mathcal { F }$ Selected and sampled from proper proposal distributions for all modalities, the variational latent codes can be fed to the downstream decoders even when the observation is incomplete. To do this, the information from different modalities are combined by aggregating their stochastic latent codes before they are decoded using a decoder: $p _ { \epsilon } ( \mathbf { m } | \mathbf { z } ) = p _ { \epsilon } ( \mathbf { m } | \mathcal { F } ( \mathbf { z } ) ) , p _ { \theta } ( \mathbf { x } _ { i } | \mathbf { z } , \mathbf { m } ) = p _ { \theta } ( \mathbf { x } _ { i } | \mathcal { F } ( \mathbf { z } ) , \mathbf { m } ) )$ . Here, we choose the aggregator $\mathcal { F } ( \cdot ) =$ concat(·), i.e., concatenating the latent codes. One may also use other aggregation functions such as max/mean pooling or matrix fusion (Veit et al., 2018) to combine latent codes from all modalities. The decoders take the shared aggregated latent codes as input to generate data and mask.
107
+
108
+ Mask Vector Encoding and Decoding The mask variable m is encoded into the latent space through the multimodal proposal network. The latent space is shared by the mask and data decoders. The mask decoder $\epsilon$ is parameterized using an MLP in our implementation. We assume each dimension of the mask variable is an independent Bernoulli distribution.
109
+
110
+ Training With reparameterization trick (Kingma & Welling, 2013), we can jointly optimize the objective derived in Equation 8 with respect to these parameters defined above on training set:
111
+
112
+ $$
113
+ \operatorname* { m a x } _ { \phi , \theta , \psi , \epsilon } \mathbb { E } _ { \mathbf { x _ { o } } , \mathbf { m } } [ \mathcal { L } _ { \phi , \theta , \psi , \epsilon } ^ { \prime } ( \mathbf { x _ { o } } , \mathbf { m } ) ]
114
+ $$
115
+
116
+ Since Equation 9 only requires the mask and observed data during training, this modified ELBO $\mathcal { L } _ { \phi , \theta , \psi , \epsilon } ^ { \prime } ( \mathbf { x _ { o } } , \mathbf { m } )$ can be optimized without the presence of unobserved modalities. The KLdivergence term is calculated analytically for each factorized term. The conditional log-likelihood term is computed by negating reconstruction loss function. (See Section 4 and Appendix B.2.)
117
+
118
+ Inference The learned model can be used for both data imputation and generation. For imputation, the observed modalities $\mathbf { x _ { o } }$ and mask m are fed through the encoders to infer the selective proposal distributions. Then the sampled latent codes are decoded to estimate the unobserved modalities $\mathbf { x _ { u } }$ All the modules in Figure 1 are used for imputation. For generation, since no data is available at all, the latent codes are sampled from the prior and go through the decoders to generate the data and the mask. In this way, only modules after the aggregator are used without any inference modules.
119
+
120
+ <table><tr><td rowspan="2"></td><td colspan="2">Categorical(PFC)</td><td colspan="2">Numerical(NRMSE)</td></tr><tr><td>Phishing</td><td>Mushroom</td><td>Yeast</td><td>Glass</td></tr><tr><td>AE</td><td>0.348 ± 0.002</td><td>0.556 ±0.009</td><td>0.737± 0.036</td><td>1.651 ± 0.049</td></tr><tr><td>VAE</td><td>0.293 ±0.003</td><td>0.470 ± 0.017</td><td>0.468 ± 0.003</td><td>1.409 ± 0.011</td></tr><tr><td>CVAE w/ mask</td><td>0.241 ±0.003</td><td>0.445 ± 0.004</td><td>0.470± 0.001</td><td>1.498 ± 0.001</td></tr><tr><td>MVAE</td><td>0.308 ± 0.015</td><td>0.586 ± 0.019</td><td>0.475 ± 0.014</td><td>1.572 ± 0.035</td></tr><tr><td>VSAE (ours)</td><td>0.237 ± 0.001</td><td>0.396 ± 0.008</td><td>0.455 ± 0.003</td><td>1.312 ± 0.021</td></tr><tr><td>CVAE w/ data</td><td>0.301±0.005</td><td>0.485 ± 0.034</td><td>0.449 ± 0.001</td><td>1.380 ± 0.045</td></tr><tr><td>VAEAC</td><td>0.240±0.006</td><td>0.403 ±0.006</td><td>0.447 ± 0.0016</td><td>1.432 ± 0.027</td></tr></table>
121
+
122
+ Table 1: Feature Imputation on UCI datasets. Missing ratio is 0.5. Categorical and numerical datasets are respectively evaluated by PFC and NRMSE. Last two rows are trained with fully-observed data, potentially serving as an upper bound for imputation models. We show mean and standard deviation over 3 independent runs. For both lower is better.
123
+
124
+ ![](images/c9391314e3073ce2a4592c4be3b82f1994f81f4784a936451b27aa14333b7666.jpg)
125
+ Figure 2: Feature Imputations on UCI datasets. Missing ratios ( $\mathbf { \sigma } _ { \mathbf { X } }$ -axis) are 0.3, 0.5, 0.7. Categorical (top row) and numerical (bottom row) datasets are evaluated by PFC and NRMSE respectively (lower is better for both). We show mean and standard deviation over 3 independent runs.
126
+
127
+ # 4 EXPERIMENT
128
+
129
+ To demonstrate the effectiveness of our model, we evaluate our model on low-dimensional tabular data imputation and high-dimensional multi-modal data imputation tasks, with extensive comparisons with state-of-the-art deep latent variable models.
130
+
131
+ Baselines. Prior work on deep latent variable models for data imputation can be categorized into two main classes: (1) models having access to fully-observed data during training, and (2) models only having access to partially observed data during training. In class (1), we report the results of VAEAC (Ivanov et al., 2019) and conditional VAE (Sohn et al., 2015); while in class (2), we report results of deterministic Autoencoder (AE), VAE (Kingma & Welling, 2013), conditional VAE (Sohn et al., 2015) (conditioned on mask) and MVAE (Wu & Goodman, 2018). Our model VSAE falls in this category since it learns the joint distribution of $p ( \mathbf { x _ { o } } , \mathbf { x _ { u } } , \mathbf { m } )$ given only observed information. Note that class (1) models can empirically represent the upper bound representative capability of imputation models, as they have access to fully-observed data during training. To establish fair comparison, all models in the experiments are implemented with the same backbone structure. Additional information on experimental details can be found in Appendix. B.
132
+
133
+ # 4.1 DATA IMPUTATION
134
+
135
+ Low-dimensional Tabular Data Imputation. We choose UCI repository datasets to demonstrate the effectiveness of our model on tabular data. It contains different tabular datasets with either numerical or categorical variables. In our experiments, we randomly sample from independent Bernoulli distributions with pre-defined missing ratio to simulate the masking mechanism. Minmax normalization is then applied to pre-process the numerical data and replace the unobserved dimensions by standard normal noise. We split training/test set by $8 0 \% / 2 0 \%$ and $2 0 \%$ of training set as validation set to choose the best model. Mean Square Error, Cross Entropy and Binary Cross Entropy are used as reconstruction loss for numerical, categorical and mask variables, respectively. We report the standard measures: NRMSE (i.e. RMSE normalized by the standard deviation of the feature and averaged over all features) for numerical datasets and PFC (i.e. proportion of falsely classified attributes of each feature and averaged over all features) for categorical datasets.
136
+
137
+ Table 2: Imputation on Bimodal datasets.. Missing ratio is 0.5. Last two rows are trained with fully-observed data. We show mean and standard deviation over 3 independent runs (lower is better). $\Delta < 0 . 0 0 1$ .
138
+
139
+ <table><tr><td rowspan="2"></td><td colspan="3">MNIST+MNIST(MSE)</td><td colspan="3">MNIST+SVHN(MSE)</td></tr><tr><td>MNIST/784</td><td>MNIST/784</td><td>combined</td><td>MNIST/784</td><td>SVHN/3072</td><td>combined</td></tr><tr><td>AE</td><td>0.1077±△</td><td>0.1070±△</td><td>0.2147±△</td><td>0.0867±△</td><td>0.1475±△</td><td>0.2342±△</td></tr><tr><td>VAE</td><td>0.0734±△</td><td>0.0682±△</td><td>0.1396±△</td><td>0.0714±△</td><td>0.0559 ±0.003</td><td>0.1273±△</td></tr><tr><td>CVAE w/ mask</td><td>0.0733±△</td><td>0.0679±△</td><td>0.1412±△</td><td>0.0692±△</td><td>0.0558±△</td><td>0.1251±△</td></tr><tr><td>MVAE</td><td>0.0760±△</td><td>0.0802±△</td><td>0.1562±△</td><td>0.0707±△</td><td>0.602±△</td><td>0.1309±△</td></tr><tr><td>VSAE (ours)</td><td>0.0712±△</td><td>0.0663±△</td><td>0.1376±△</td><td>0.0682±△</td><td>0.0516±△</td><td>0.1198±△</td></tr><tr><td>CVAE w/data</td><td>0.0694±△</td><td>0.0646±△</td><td>0.1340±△</td><td>0.0716±△</td><td>0.0550±△</td><td>0.1266±△</td></tr><tr><td>VAEAC</td><td>0.0693±△</td><td>0.0645±△</td><td>0.1338±△</td><td>0.0682±△</td><td>0.0523±△</td><td>0.1206±△</td></tr></table>
140
+
141
+ Results and Analysis. Table 1 shows that VSAE outperforms other methods on both numerical and categorical data. The first five rows are trained in partially-observed setting, while the last two trained with fully-observed data. We observe that models trained with partially-observed data can outperform those models trained with fully-observed data on some datasets. We argue this is due to two potential reasons: (1) the mask provides a natural way of dropout on the data space, thereby, helping the model to generalize; (2) if the data is noisy or has outliers (which is common in low-dimensional data), learning from partially-observed data can improve performance by ignoring these data. However, although our model does not product state-of-the-art results in fully-observed data imputation settings, these models potentially can serve as upper bound if the data is clean.
142
+
143
+ Figure 2 illustrates that our model generally has lower error with lower variance for all missing ratios. With higher missing ratio (more data is unobserved), our model achieves more stable imputation performance on most of the datasets. On the contrary, there is a performance drop along with higher variance in the case of baselines. We believe this is because of the proposal distribution selection in VSAE. As the missing ratio increases, the input to unimodal encoders stays same while other encoders have to learn to focus on the useful information in data.
144
+
145
+ High-dimensional Multimodal Data. We synthesize two bimodal datasets using MNIST and SVHN datasets. MNIST contains 28-by-28 gray images (0-9 digits); SVHN contains 32-by-32 RGB images (0-9 digits). We synthesize our datasets by pairing two different digits in MNIST (named MNIST $^ +$ MNIST) and one digit in MNIST with a same digit in SVHN (named MNIST $+$ SVHN). See Appendix C for more experimental results on multimodal FashionMNIST, MNIST and CMU-MOSI.
146
+
147
+ Results and Analysis. VSAE has better performance for imputation task on all modalities with lower variance (refer to Table 2). Figure 3 presents the qualitative results of imputations on MNIST $^ +$ MNIST. With masks sampled with different missing ratios, the combined errors on MNIST $+ ]$ MNIST (i.e. sum of MSE in each modality averaged over its dimensions) of our model are $0 . 1 3 7 1 \pm 0 . 0 0 0 1$ , $0 . 1 3 7 6 \pm 0 . 0 0 0 2$ and $0 . 1 3 7 9 \pm 0 . 0 0 0 1$ under missing ratio of 0.3, 0.5 and 0.7 (Additional results are in Appendix C.2). This indicates that VSAE is robust under different missing ratios, whereas other baselines are sensitive to the missing ratio. We believe this is because of the underlying mechanism of proper proposal distribution selection. The separate structure of unimodal/multimodal encoders helps VSAE to attend to the observed data. It limits the input of unimodal encoders to observed single modality. Thus it is more robust to the missingness. In contrast, baseline methods have only one single proposal distribution inferred from the whole input. VSAE can easily ignore unobserved noisy modalities and attends on observed useful modalities, while baselines rely on neural networks to learn useful information from the whole data (which is dominated by missing information in case of high missing ratio). For partially-observed training setting, unobserved data is not available even during training. However, the unobserved modality in one data sample could be the observed modality in another data sample. Thus, the multimodal encoders are able to construct the mapping from observable to unobservable information over the whole training set. Multimodal encoders also include the mask vector as input. This allows the multimodal encoders to be aware of the shape of the missingness and forces it to focus on the useful information in the observed modalities.
148
+
149
+ ![](images/b1a5a86058d0bf3cb0c6ff94d6651f84a41203b8ae2d63639672ab5b87411ef6.jpg)
150
+ Figure 3: Imputation on MNIST $^ +$ MNIST. Top row visualizes observed modality, middle row unobserved modality, and bottom row shows the imputation of unobserved modality from VSAE.
151
+
152
+ ![](images/db7633d65315ac6b4de86c83c4652d1bd52e63d5e2aca1bb259b42543df95a3b.jpg)
153
+ Figure 4: Generation on MNIST $+$ MNIST. Generated Samples w/o conditional information. As shown, the correspondence between modalities (predefined pairs) are preserved while stochastic multimodal generation.
154
+
155
+ # 4.2 IMPUTATION ON NON-MCAR MASKING MECHANISMS
156
+
157
+ Sampling mask on predefined missing ratio is MCAR. VSAE can model mask distribution w/o constraints on the masking mechanisms. We also evaluate our model on MAR and NMAR. Mattei & Frellsen (2019) synthesize MAR in a defined rule and we follow them to synthesize both MAR and NMAR (refer to Appendix C.4 for details). Our model can outperform state-ofthe-art non-MCAR model MIWAE (Mattei & Frellsen, 2019).
158
+
159
+ Table 3: Imputation. NRMSE on Yeast. Lower is better. $\Delta < 0 . 0 1$ .
160
+
161
+ <table><tr><td></td><td>MIWAE</td><td>VSAE</td></tr><tr><td>MCAR</td><td>0.467±△</td><td>0.455±△</td></tr><tr><td>MAR</td><td>0.493 ± 0.03</td><td>0.472 ±0.02</td></tr><tr><td>NMAR</td><td>0.513 ± 0.04</td><td>0.456±△</td></tr></table>
162
+
163
+ # 4.3 DATA AND MASK GENERATION
164
+
165
+ Unlike conventional methods modeling $p ( \mathbf { x _ { u } } | \mathbf { x _ { o } } )$ , our method is to model the joint probability $p ( \mathbf { x _ { o } } , \mathbf { x _ { u } } , \mathbf { m } )$ . Thus our model can impute missing features and also generate data and mask from scratch. Figure 4 shows the model learns the correlation between different modalities to pair the digits as predefined in the dataset without giving any labels in partially-observed setting.
166
+
167
+ Our proposed VSAE can also learn to generate mask. The objective ELBO has a mask conditional log-likelihood term. This allows the latent space to have information from mask variables and be able to reconstruct (or generate if sample the prior) the mask vector. In UCI repository experiments, the mask variable follows Bernoulli distribution. After training, we sample from the prior to generate the mask. We calculate the proportion of the unobserved dimensions in generated mask vectors (averaged over 100 samples of the output). Averaged on all datasets, this proportion is $0 . 3 1 2 3 { \scriptstyle \pm 0 . 0 2 6 }$ , $0 . 4 9 6 4 \pm 0 . 0 0 5$ , $0 . 6 9 2 7 \pm 0 . 0 1 3$ for missing ratio of 0.3, 0.5, 0.7. It indicates that our model can learn the mask distribution. We also observe that conditions on the reconstructed mask vector in the data decoders improve the performance. We believe this is because the mask vector can inform the data decoder about the missingness in the data space since the latent space is shared by both all modalities thereby allowing it to generate data from the selective proposal distribution.
168
+
169
+ # 5 CONCLUSION
170
+
171
+ In this paper, we propose a VAE framework to learn from partially-observed data. Learning from partially-observed data is important but previous deep latent variable models cannot work well on this problem. The proposed model differentiates the observed and unobserved information by selecting a proper proposal distribution. The experimental results show the model can consistently outperform other baselines on low-dimensional tabular data and high-dimensional multimodal data. The model can also generate data with mask directly from prior without any conditions.
172
+
173
+ # REFERENCES
174
+
175
+ Philip Bachman and Doina Precup. Data generation as sequential decision making. In Advances in Neural Information Processing Systems, pp. 3249–3257, 2015.
176
+
177
+ Yuri Burda, Roger Grosse, and Ruslan Salakhutdinov. Importance weighted autoencoders. International Conference on Learning Representations, 2016.
178
+
179
+ S van Buuren and Karin Groothuis-Oudshoorn. mice: Multivariate imputation by chained equations in r. Journal of statistical software, pp. 1–68, 2010.
180
+
181
+ Marc-André Carbonneau, Veronika Cheplygina, Eric Granger, and Ghyslain Gagnon. Multiple instance learning: A survey of problem characteristics and applications. Pattern Recognition, 2018.
182
+
183
+ Lluis Castrejon, Yusuf Aytar, Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Learning aligned cross-modal representations from weakly aligned data. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2016.
184
+
185
+ Hong-Min Chu, Chih-Kuan Yeh, and Yu-Chiang Frank Wang. Deep generative models for weaklysupervised multi-label classification. In The European Conference on Computer Vision (ECCV), September 2018.
186
+
187
+ Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, François Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. The Journal of Machine Learning Research, 2016.
188
+
189
+ Lovedeep Gondara and Ke Wang. Multiple imputation using deep denoising autoencoders. arXiv preprint arXiv:1705.02737, 2017.
190
+
191
+ Jiawei He, Yu Gong, Joseph Marino, Greg Mori, and Andreas Lehrmann. Variational autoencoders with jointly optimized latent dependency structure. In International Conference on Learning Representations, 2019.
192
+
193
+ Oleg Ivanov, Michael Figurnov, and Dmitry Vetrov. Variational autoencoder with arbitrary conditioning. In International Conference on Machine Learning, 2019.
194
+
195
+ Vikas Jain, Nirbhay Modhe, and Piyush Rai. Scalable generative models for multi-label learning with missing labels. In Proceedings of the 34th International Conference on Machine Learning, Proceedings of Machine Learning Research. PMLR, 2017.
196
+
197
+ Taeksoo Kim, Moonsu Cha, Hyunsoo Kim, Jung Kwon Lee, and Jiwon Kim. Learning to discover cross-domain relations with generative adversarial networks. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 1857–1865. JMLR. org, 2017.
198
+
199
+ Diederik P. Kingma and Max Welling. Auto-encoding variational bayes. CoRR, abs/1312.6114, 2013.
200
+
201
+ Diederik P. Kingma, Danilo Jimenez Rezende, Shakir Mohamed, and Max Welling. Semi-supervised learning with deep generative models. CoRR, abs/1406.5298, 2014.
202
+
203
+ Steven Cheng-Xian Li, Bo Jiang, and Benjamin Marlin. Misgan: Learning from incomplete data with generative adversarial networks. In International Conference on Learning Representations, 2019.
204
+
205
+ Roderick J A Little and Donald B Rubin. Statistical Analysis with Missing Data. John Wiley & Sons, Inc., New York, NY, USA, 1986. ISBN 0-471-80254-9.
206
+
207
+ Pierre-Alexandre Mattei and Jes Frellsen. Miwae: Deep generative modelling and imputation of incomplete data sets. In International Conference on Machine Learning, pp. 4413–4423, 2019.
208
+
209
+ Ishan Misra, Abhinav Shrivastava, Abhinav Gupta, and Martial Hebert. Cross-stitch networks for multi-task learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3994–4003, 2016.
210
+
211
+ Louis-Philippe Morency, Rada Mihalcea, and Payal Doshi. Towards multimodal sentiment analysis: Harvesting opinions from the web. In Proceedings of the 13th international conference on multimodal interfaces, pp. 169–176. ACM, 2011.
212
+
213
+ Alfredo Nazabal, Pablo M Olmos, Zoubin Ghahramani, and Isabel Valera. Handling incomplete heterogeneous data using vaes. arXiv preprint arXiv:1807.03653, 2018.
214
+
215
+ Jiquan Ngiam, Aditya Khosla, Mingyu Kim, Juhan Nam, Honglak Lee, and Andrew Y. Ng. Multimodal deep learning. In International Conference on Machine Learning, ICML’11, pp. 689–696, USA, 2011. Omnipress. ISBN 978-1-4503-0619-5.
216
+
217
+ Gaurav Pandey and Ambedkar Dukkipati. Variational methods for conditional multimodal deep learning. In 2017 International Joint Conference on Neural Networks (IJCNN), pp. 308–315. IEEE, 2017.
218
+
219
+ Amaia Salvador, Nicholas Hynes, Yusuf Aytar, Javier Marin, Ferda Ofli, Ingmar Weber, and Antonio Torralba. Learning cross-modal embeddings for cooking recipes and food images. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
220
+
221
+ Casper Kaae Sø nderby, Tapani Raiko, Lars Maalø e, Søren Kaae Sø nderby, and Ole Winther. Ladder variational autoencoders. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems 29, pp. 3738–3746. Curran Associates, Inc., 2016.
222
+
223
+ Kihyuk Sohn, Wenling Shang, and Honglak Lee. Improved multimodal deep learning with variation of information. In Advances in neural information processing systems, pp. 2141–2149, 2014.
224
+
225
+ Kihyuk Sohn, Honglak Lee, and Xinchen Yan. Learning structured output representation using deep conditional generative models. In Advances in Neural Information Processing Systems 28, pp. 3483–3491. 2015.
226
+
227
+ Yuhang Song, Chao Yang, Zhe Lin, Xiaofeng Liu, Qin Huang, Hao Li, and C.-C. Jay Kuo. Contextualbased image inpainting: Infer, match, and translate. In The European Conference on Computer Vision (ECCV), September 2018.
228
+
229
+ Nitish Srivastava and Ruslan R Salakhutdinov. Multimodal learning with deep boltzmann machines. In Advances in neural information processing systems, pp. 2222–2230, 2012.
230
+
231
+ Daniel J Stekhoven and Peter Bühlmann. Missforest—non-parametric missing value imputation for mixed-type data. Bioinformatics, 28(1):112–118, 2011.
232
+
233
+ Masahiro Suzuki, Kotaro Nakayama, and Yutaka Matsuo. Joint multimodal learning with deep generative models. arXiv preprint arXiv:1611.01891, 2016.
234
+
235
+ Yao-Hung Hubert Tsai, Paul Pu Liang, Amir Zadeh, Louis-Philippe Morency, and Ruslan Salakhutdinov. Learning factorized multimodal representations. In International Conference on Learning Representations, 2019.
236
+
237
+ Andreas Veit, Maximilian Nickel, Serge Belongie, and Laurens van der Maaten. Separating selfexpression and visual content in hashtag supervision. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
238
+
239
+ Pascal Vincent, Hugo Larochelle, Yoshua Bengio, and Pierre-Antoine Manzagol. Extracting and composing robust features with denoising autoencoders. In international conference on Machine learning, pp. 1096–1103. ACM, 2008.
240
+
241
+ Mike Wu and Noah Goodman. Multimodal generative models for scalable weakly-supervised learning. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, NIPS’18, 2018.
242
+
243
+ M. Wöllmer, F. Weninger, T. Knaup, B. Schuller, C. Sun, K. Sagae, and L. Morency. Youtube movie reviews: Sentiment analysis in an audio-visual context. IEEE Intelligent Systems, 2013.
244
+
245
+ Jinsung Yoon, James Jordon, and Mihaela Van Der Schaar. Gain: Missing data imputation using generative adversarial nets. In International Conference on Machine Learning, 2018.
246
+
247
+ Amir Zadeh, Rowan Zellers, Eli Pincus, and Louis-Philippe Morency. Multimodal sentiment intensity analysis in videos: Facial gestures and verbal messages. IEEE Intelligent Systems, 31(6), 2016.
248
+
249
+ Amir Zadeh, Minghai Chen, Soujanya Poria, Erik Cambria, and Louis-Philippe Morency. Tensor fusion network for multimodal sentiment analysis. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 1103–1114. Association for Computational Linguistics, 2017. doi: 10.18653/v1/D17-1115.
250
+
251
+ Amir Zadeh, Yao-Chong Lim, Paul Pu Liang, and Louis-Philippe Morency. Variational auto-decoder: Neural generative modeling from partial data. arXiv preprint arXiv:1903.00840, 2019.
252
+
253
+ Ying Zhang and Huchuan Lu. Deep cross-modal projection learning for image-text matching. In The European Conference on Computer Vision (ECCV), September 2018.
254
+
255
+ Yu Zhang, Ying Wei, and Qiang Yang. Learning to multitask. In Advances in Neural Information Processing Systems, pp. 5771–5782, 2018.
256
+
257
+ Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In Proceedings of the IEEE international conference on computer vision, 2017.
258
+
259
+ # A BACKGROUND
260
+
261
+ # A.1 IMPUTATION PROCESS AND MISSINGNESS MECHANISMS
262
+
263
+ Following (Little & Rubin, 1986), the imputation process is to learn a generative distribution for unobserved missing data. To be consistent with notations in Section ??, let $\mathbf { x } = [ \mathbf { x } _ { 1 } , \mathbf { x } _ { 2 } , . . . , \mathbf { x } _ { M } ]$ be the complete data of all modalities where $\mathbf { x } _ { i }$ denote the feature representation for the $i$ -th modality. We also define $\mathbf { m } \in \{ 0 , 1 \} ^ { M }$ as the binary mask vector, where $m _ { i } = 1$ indicates if the $i$ -th modality is observed, and $m _ { i } = 0$ indicates if it is unobsrved:
264
+
265
+ $$
266
+ \begin{array} { r l } & { \mathbf { x } \sim p _ { \mathrm { d a t a } } ( \mathbf { x } ) , } \\ & { \mathbf { m } \sim p ( \mathbf { m } | \mathbf { x } ) . } \end{array}
267
+ $$
268
+
269
+ Given this, the observed data $\mathbf { x _ { o } }$ and unobserved data $\mathbf { x _ { u } }$ are represented accordingly:
270
+
271
+ $$
272
+ \begin{array} { r } { \mathbf { x _ { o } } = [ \mathbf { x } _ { i } | m _ { i } = 1 ] , } \\ { \mathbf { x _ { u } } = [ \mathbf { x } _ { i } | m _ { i } = 0 ] . } \end{array}
273
+ $$
274
+
275
+ In the standard maximum likelihood setting, the unknown parameters are estimated by maximizing the following marginal likelihood, integrating over the unknown missing data values:
276
+
277
+ $$
278
+ p ( \mathbf { x _ { o } } , \mathbf { m } ) = \int p ( \mathbf { x _ { o } } , \mathbf { x _ { u } } , \mathbf { m } ) d \mathbf { x _ { u } } = \int p ( \mathbf { x _ { o } } , \mathbf { x _ { u } } ) p ( \mathbf { m } | \mathbf { x _ { o } } , \mathbf { x _ { u } } ) d \mathbf { x _ { u } }
279
+ $$
280
+
281
+ Little & Rubin (1986) characterizes the missingness mechanism $p ( \mathbf { m } | \mathbf { x _ { o } } , \mathbf { x _ { u } } )$ in terms of independence relations between the complete data $\mathbf { x } = [ \mathbf { x _ { o } } , \mathbf { x _ { u } } ]$ and the mask m:
282
+
283
+ • Missing completely at random (MCAR): $p ( \mathbf { m } | \mathbf { x _ { o } } , \mathbf { x _ { u } } ) = p ( \mathbf { m } ) .$ , • Missing at random (MAR): $p ( \mathbf { m } | \mathbf { x _ { o } } , \mathbf { x _ { u } } ) = p ( \mathbf { m } | \mathbf { x _ { o } } )$ , • Not missing at random (NMAR): $p ( \mathbf { m } | \mathbf { x _ { o } } , \mathbf { x _ { u } } ) = p ( \mathbf { m } | \mathbf { x _ { u } } )$ or p(m|xo, xu).
284
+
285
+ Most previous data imputation methods works under MCAR or MAR assumptions since $p ( \mathbf { x _ { o } } , \mathbf { m } )$ can be factorized into $p ( \mathbf { x _ { o } } ) p ( \mathbf { m } | \mathbf { x _ { o } } )$ or $p ( \mathbf { x _ { o } } ) p ( \mathbf { m } )$ . With such decoupling, we do not need missing information to marginalize the likelihood, and it provides a simple but approximate framework to learn from partially-observed data.
286
+
287
+ # A.2 VARIATIONAL AUTOENCODER
288
+
289
+ Variational Autoencoder (VAE) (Kingma & Welling, 2013) is a probabilistic generative model, where data is constructed from a latent variable $\mathbf { z }$ with a prior distribution $p ( \mathbf { z } )$ . It is composed of an inference network and a generation network to encode and decode data. To model the likelihood of data, the true intractable posterior $p ( \mathbf { z } | \mathbf { x } )$ is approximated by a proposal distribution $q _ { \phi } ( \mathbf { z } | \mathbf { x } )$ , and the whole model is trained until ideally the decoded reconstructions from the latent codes sampled from the approximate posterior match the training data. In the generation module, $p _ { \pmb { \theta } } ( \tilde { \mathbf { x } } | \mathbf { z } )$ , a decoder realized by a deep neural network parameterized by $\pmb { \theta }$ , maps a latent variable $\mathbf { z }$ to the reconstruction $\tilde { \mathbf { x } }$ of observation $\mathbf { x }$ . In the inference module, an encoder parameterized by $\phi$ produces the sufficient statistics of the approximation posterior $q _ { \phi } ( \mathbf { z } | \mathbf { x } )$ (a known density family where sampling can be readily done). In vanilla VAE setting, by simplifying approximate posterior as a parameterized diagonal normal distribution and prior as a standard diagonal normal distribution $\mathcal { N } ( \mathbf { 0 } , \bar { \mathbf { I } } )$ , the training criterion is to maximize the following evidence lower bound (ELBO) w.r.t. $\pmb \theta$ and $\phi$ .
290
+
291
+ $$
292
+ \log p ( \mathbf { x } ) \geq \mathcal { L } _ { \theta , \phi } ( \mathbf { x } ) = \mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } ) } [ \log p _ { \theta } ( \mathbf { x } | \mathbf { z } ) ] - D _ { \mathrm { K L } } [ q _ { \phi } ( \mathbf { z } | \mathbf { x } ) | | p ( \mathbf { z } ) ]
293
+ $$
294
+
295
+ where $D _ { \mathrm { K L } }$ denotes the Kullback-Leibler (KL) divergence. Usually the prior $p ( \mathbf { z } )$ and the approximate $q _ { \phi } ( \mathbf { z } | \mathbf { x } )$ are chosen to be in simple form, such as a Gaussian distribution with diagonal covariance, which allows for an analytic calculation of the KL divergence. While VAE approximates $p ( \mathbf { x } )$ , conditional VAE (Sohn et al., 2015) approximates the conditional distribution $p ( \mathbf { x } | \mathbf { y } )$ . By simply introducing a conditional input, CVAE is trained to maximize the following ELBO:
296
+
297
+ $$
298
+ \log p ( \mathbf { x } | \mathbf { y } ) \geq \mathcal { L } _ { \theta , \phi , \psi } ( \mathbf { x } , \mathbf { y } ) = \mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } ) } [ \log p _ { \theta } ( \mathbf { x } | \mathbf { z } , \mathbf { y } ) ] - D _ { \mathrm { K L } } [ q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } ) | | p _ { \psi } ( \mathbf { z } | \mathbf { y } ) ]
299
+ $$
300
+
301
+ # B IMPLEMENTATION DETAILS
302
+
303
+ # B.1 ARCHITECTURE
304
+
305
+ In all models, all the layers are modeled by MLP without any skip connections or resnet modules. Basically, the unimodal encoders take single modality data vector as input to infer the unimodal proposal distribution; the multimodal encoders take the observed data vectors and mask vector as as input to infer the multimodal proposal distributions. The input vector to multimodal encoders should have same length for the neural network. Here we just concatenate all modality vectors and replace the unobserved modality vectors with some noise. In UCI repository experiment, we replace the unobserved modality vectors as standard normal noise. In Bimodal experiment, we simply replace the pixels of unobserved modality as zero. Note that all the baselines has encoders/decoders with same or larger number of parameters than our method. We implement our model using PyTorch.
306
+
307
+ Unimodal Encoders In UCI repository experiment, the unimodal encoders for numerical data are modeled by 3-layer 64-dim MLPs and the unimodal encoders for categorical data are modeled by 3-layer 64-dim MLPs, all followed by Batch Normalization and Leaky ReLU nonlinear activations. In MNIST $^ +$ MNIST bimodal experiment, the unimodal encoders are modeled by 3-layer 128-dim MLPs followed by Leaky ReLU nonlinear activations; In MNIST $+ \varsigma$ SVHN bimodal experiment, the unimodal encoders are modeled by 3-layer 512-dim MLPs followed by Leaky ReLU nonlinear activations. We set the latent dimension as 20-dim for every modality in UCI repository experiments and 256-dim for every modality in Bimodal experiments.
308
+ UCI data unimodal encoder: Linear( $1 , 6 4 ) $ BatchNorm1 $1 ( 6 4 ) $ LeakyReLU Linear(64, 64)→ LeakyReLU Linear(64, 64) LeakyReLU Linear(64, 20);
309
+ MNIST $^ +$ MNIST synthetic unimodal encoder: Linear(data-dimension, $1 2 8 ) $ LeakyReLU Linear $( 1 2 8 , 1 2 8 ) $ LeakyReLU Linear(128, $1 2 8 ) $ LeakyReLU Linear(128, 256);
310
+ MNIST $^ +$ SVHN synthetic unimodal encoder: Linear(data-dimension, $5 1 2 ) $ LeakyReLU Linear $( 5 1 2 , 5 1 2 ) $ LeakyReLU Linear(512, 512) LeakyReLU Linear(512, 256);
311
+
312
+ Multimodal Encoders In general, any model capable of multimodal fusion (Zadeh et al., 2017; Morency et al., 2011) can be used here to map the observed data $\mathbf { x _ { o } }$ and the mask m to the latent variables $\mathbf { z }$ . However, in this paper we simply use an architecture similar to unimodal encoders. The difference is that the input to unimodal encoders are lower dimensional vectors of an individual modalities. But, the input to the multimodal encoders is the complete data vector with unobserved modalities replaced with noise or zeros. As the input to the multimodal encoders is the same for all modalities (i.e., $q ( \mathbf { z } _ { i } | \mathbf { x _ { o } } , \mathbf { m } ) \ \forall i )$ , we model the multimodal encoders as one single encoder to take advantage of the parallel matrix calculation speed. Thus the multimodal encoder for every experiment has the same structure as its unmidal encoder but with full-dimensional input.
313
+
314
+ Aggregator In our models, we simply use vector concatenation as the way of aggregating.
315
+
316
+ Mask Decoder UCI mask decoder: Linear $2 0 ^ { * }$ data-dimension, $6 4 ) $ BatchNorm1d(64) LeakyReLU Linear(64, 64) LeakyReLU Linear(64, 64) LeakyReLU Linear(64, maskdimension) Sigmoid; MNIST $+$ MNIST synthetic mask decoder: Linear(512, 16) BatchNorm1d(16) LeakyReLU Linear $^ { 1 6 , 1 6 ) }$ LeakyReLU Linear(16, 16) LeakyReL $U { } \mathrm { L i n e a r } ( 1 6$ , 2) Sigmoid; MNIST $^ +$ SVHN synthetic mask encoder: Linear(512, 16) BatchNorm1d(16) LeakyReLU Linear $^ { 1 6 , 1 6 ) }$ LeakyReLU Linear $^ { 1 6 , 1 6 ) }$ LeakyReLU Linear(16,2) Sigmoid;
317
+
318
+ Data Decoder As the output is factorized over modalities and for every decoder the input is shared as the latent codes sampled from the selective proposal distribution. We implement all the decoders of the data modalities as one single decoder for parallel speed. UCI data decoder: Linear( $2 0 ^ { * }$ data-dimension, $1 2 8 ) .$ BatchNorm1d(128) LeakyReLU Linear $( 1 2 8 ) $ Linear(128, $1 2 8 ) $ Linear(128, data-dimension);
319
+ MNIST $^ +$ MNIST synthetic data decoder: Linear(512, $1 2 8 ) $ BatchNorm1d(128) LeakyReLU Linear $( 1 2 8 , 1 2 8 ) $ Linear(128, 128) Linear(128, 784) Sigmoid;
320
+ MNIST $+ S \mathsf { V H N }$ synthetic mask encoder: Linear(512, 512) BatchNorm1d(512) LeakyReLU Linear $( 5 1 2 , 5 1 2 ) $ Linear(512,512) Linear(512,784/3072) Sigmoid;
321
+
322
+ # B.2 TRAINING
323
+
324
+ We use Adam optimizer for all models. For UCI numerical experiment, learning rate is 1e-3 and use validation set to find a best model in 1000 epochs. For UCI categorical experiment, learning rate is 1e-2 and use validation set to find a best model in 1000 epochs. For bimodal experiments, learning rate is 1e-4 and use validation set to find a best model in 1000 epochs. All modules in our models are trained jointly.
325
+
326
+ In our model, we calculate the conditional log-likelihood of unobserved modality by generating corresponding modalities from prior. We initially train the model for some (empirically we choose 20) epochs without calculating the conditional log-likelihood of $\mathbf { x _ { u } }$ . And then first feed the partiallyobserved data to the model and generate the unobserved modality $\tilde { \mathbf { x } } _ { \mathbf { u } }$ without calculating any loss; then feed the same batch for another pass, calculate the conditional log-likelihood using real $\mathbf { x _ { o } }$ and generated $\mathbf { x _ { u } }$ as ground truth.
327
+
328
+ # B.3 BASELINES
329
+
330
+ In our experiments, all the baselines use the same backbone architecture as our model, and the some of the layers are widened to make the total number of parameters same as our proposed model. All baselines for each experiment are trained with same Adam optimizer with same learning rate. All the deep latent variable model baselines have same size of latent variables.
331
+
332
+ In the setting of AE/VAE, the input is the whole data representation with all the modalties without any mask information; In CVAE w/ mask, the encoder and decoder are both conditioned on the mask vector, while in CVAE w/ data, the observed modalities are fed to encoder and the decoder is conditioned on the observed modalities. VAEAC (Ivanov et al., 2019) is slightly modified to remove all the skip-connections to provide a fair comparison (we do not claim we outperform VAEAC with fully-observed training) and MVAE (Wu & Goodman, 2018) is same as the proposed model architecture.
333
+
334
+ # C ADDITIONAL EXPERIMENTAL RESULTS
335
+
336
+ # C.1 UCI REPOSITORY DATASETS
337
+
338
+ Table 4: Imputation on Categorical datasets. Missing ratio is 0.5. Last two rows are trained with fully-observed data. Evaluated by PFC, lower is better.
339
+
340
+ <table><tr><td></td><td>Phishing</td><td>Zoo</td><td>Mushroom</td></tr><tr><td>AE</td><td>0.348 ± 0.002</td><td>0.295 ± 0.022</td><td>0.556 ± 0.009</td></tr><tr><td>VAE</td><td>0.293 ± 0.003</td><td>0.304 ± 0.009</td><td>0.470 ± 0.017</td></tr><tr><td>CVAE w/ mask</td><td>0.241 ± 0.003</td><td>0.270 ± 0.023</td><td>0.445 ± 0.004</td></tr><tr><td>MVAE</td><td>0.308 ± 0.015</td><td>0.233 ± 0.013</td><td>0.586 ± 0.019</td></tr><tr><td>VSAE</td><td>0.237 ± 0.001</td><td>0.213 ± 0.004</td><td>0.396 ± 0.008</td></tr><tr><td>CVAE w/ data</td><td>0.301 ± 0.005</td><td>0.323 ± 0.032</td><td>0.485 ± 0.034</td></tr><tr><td>VAEAC</td><td>0.240 ± 0.006</td><td>0.168 ± 0.006</td><td>0.403 ± 0.006</td></tr></table>
341
+
342
+ Table 5: Imputation on Numerical datasets. Missing ratio is 0.5. Last two rows are trained with fully-observed data. Evaluated by NRMSE, lower is better.
343
+
344
+ <table><tr><td></td><td>Yeast</td><td>White Wine</td><td>Glass</td></tr><tr><td>AE</td><td>0.737 ± 0.036</td><td>0.3772 ± 0.0008</td><td>1.651 ± 0.049</td></tr><tr><td>VAE</td><td>0.468 ± 0.003</td><td>0.3714 ± 0.0001</td><td>1.409 ± 0.011</td></tr><tr><td>CVAE w/ mask</td><td>0.470 ± 0.001</td><td>0.3716 ± 0.0001</td><td>1.498 ± 0.0013</td></tr><tr><td>MVAE</td><td>0.475 ± 0.014</td><td>0.3722 ± 0.0009</td><td>1.572 ± 0.035</td></tr><tr><td>VSAE</td><td>0.455 ± 0.003</td><td>0.3711 ± 0.0002</td><td>1.312 ± 0.021</td></tr><tr><td>CVAE w/ data</td><td>0.449 ± 0.0001</td><td>0.3567 ± 0.0016</td><td>1.380 ± 0.045</td></tr><tr><td>VAEAC</td><td>0.447 ± 0.0016</td><td>0.3647 ± 0.0039</td><td>1.432 ± 0.027</td></tr></table>
345
+
346
+ # C.2 MNIST $^ +$ MNIST BIMODAL DATASET
347
+
348
+ # C.2.1 SETUP
349
+
350
+ MNIST $^ +$ MNIST bimodal dataset. We randomly pair two digits in MNIST as [0, 9], [1, 8], [2, 7], [3, 6], [4, 5]. The training/test/validation sets respectively contain 23257/4832/5814 samples.
351
+
352
+ # C.2.2 ADDITIONAL RESULTS
353
+
354
+ <table><tr><td></td><td>0.3</td><td>0.5</td><td>0.7</td></tr><tr><td>AE</td><td>0.2124 ± 0.0012</td><td>0.2147 ± 0.0008</td><td>0.2180 ± 0.0008</td></tr><tr><td>VAE</td><td>0.1396 ± 0.0002</td><td>0.1416 ± 0.0001</td><td>0.1435 ± 0.0006</td></tr><tr><td>CVAE w/ mask</td><td>0.1393 ± 0.0002</td><td>0.1412 ± 0.0006</td><td>0.1425 ± 0.0012</td></tr><tr><td>MVAE</td><td>0.1547 ± 0.0012</td><td>0.1562 ± 0.0003</td><td>0.1579 ± 0.0006</td></tr><tr><td>VSAE</td><td>0.1371 ± 0.0001</td><td>0.1376 ± 0.0002</td><td>0.1379 ± 0.0001</td></tr><tr><td>CVAE w/ data</td><td>0.1336 ± 0.0003</td><td>0.1340 ± 0.0003</td><td>0.1343 ± 0.0002</td></tr><tr><td>VAEAC</td><td>0.1333 ± 0.0004</td><td>0.1338 ± 0.0003</td><td>0.1344 ± 0.0001</td></tr></table>
355
+
356
+ Table 6: Imputation on MNIST $^ +$ MNIST. Missing ratio is 0.3, 0.5 and 0.7. Last two rows are trained with fully-observed data. Evaluated by combined errors of two modalities, lower is better.
357
+
358
+ ![](images/f668d3e5c6598efaa993cb8c029addb23baaf3bce7730f25304f012bf8297c93.jpg)
359
+ Figure 5: Imputation on MNIST+MNIST. Top row visualizes observed modality, middle row unobserved modality, and bottom row shows the imputation of unobserved modality from VSAE.
360
+
361
+ ![](images/38ee3e39fd34f42378c477cb5862f6be2af662e8435082e2d26e9a0d3780cdf2.jpg)
362
+ Figure 6: Generation on MNIST $^ +$ MNIST. Generated Samples w/o conditional information. As shown, the correspondence between modalities (pre-defined pairs) are preserved while generation.
363
+
364
+ ![](images/b8b2d090d3fa21f5150f3dfa5eba480dc53f68987727e6e062cc984fc7ab8977.jpg)
365
+ Figure 7: Multiple independent sampling in selected latent space. The leftmost digits are observed images in ground truth, and the right 8 digits are imputations of corresponding unobserved digits.
366
+
367
+ # C.3 MNIST $^ +$ SVHN BIMODAL DATASET
368
+
369
+ # C.3.1 SETUP
370
+
371
+ MNIST $^ +$ SVHN bimodal dataset: We pair one digit in MNIST with the random same digit in SVHN. The training/test/validation sets respectively contain 44854/10000/11214 samples. For both datasets, we synthesize mask vectors over each modality by sampling from Bernoulli distribution. All mask are fixed after synthesis process. All original data points are only used once.
372
+
373
+ # C.3.2 ADDITIONAL RESULTS
374
+
375
+ Table 7: Imputation on MNIST $^ +$ SVHN. Missing ratio is 0.5. Last two rows are trained with fully-observed data. Evaluated by combined errors of two modalities, lower is better.
376
+
377
+ <table><tr><td></td><td>MNIST-MSE/784</td><td>SVHN-MSE/3072</td><td>Combined Bimodal Error</td></tr><tr><td>AE</td><td>0.0867 ± 0.0001</td><td>0.1475 ± 0.0006</td><td>0.2342 ± 0.0007</td></tr><tr><td>VAE</td><td>0.0714 ± 0.0001</td><td>0.0559 ± 0.0027</td><td>0.1273 ± 0.0003</td></tr><tr><td>CVAE w/ mask</td><td>0.0692 ± 0.0001</td><td>0.0558 ± 0.0003</td><td>0.1251 ± 0.0005</td></tr><tr><td>MVAE</td><td>0.0707 ± 0.0003</td><td>0.602 ± 0.0001</td><td>0.1309 ± 0.0005</td></tr><tr><td>VSAE</td><td>0.0682 ± 0.0001</td><td>0.0516 ± 0.0001</td><td>0.1198 ± 0.0001</td></tr><tr><td>CVAE w/ data</td><td>0.0716 ± 0.0002</td><td>0.0550 ± 0.0007</td><td>0.1266 ± 0.0005</td></tr><tr><td>VAEAC</td><td>0.0682 ± 0.0001</td><td>0.0523 ± 0.0001</td><td>0.1206 ± 0.0001</td></tr></table>
378
+
379
+ Table 8: Imputation on MNIST $^ +$ SVHN. Missing ratio is 0.3, 0.5 and 0.7. Last two rows are trained with fully-observed data. Evaluated by combined errors of two modalities, lower is better.
380
+
381
+ <table><tr><td></td><td>0.3</td><td>0.5</td><td>0.7</td></tr><tr><td>AE</td><td>0.1941 ± 0.0006</td><td>0.2342 ± 0.0007</td><td>0.2678 ± 0.0012</td></tr><tr><td>VAE</td><td>0.1264 ± 0.0001</td><td>0.1273 ± 0.0003</td><td>0.1322 ± 0.0005</td></tr><tr><td>CVAE w/ mask</td><td>0.1255 ± 0.0002</td><td>0.1251 ± 0.0005</td><td>0.1295 ± 0.0006</td></tr><tr><td>MVAE</td><td>0.1275 ± 0.0029</td><td>0.1309 ± 0.0005</td><td>0.1313 ± 0.0013</td></tr><tr><td>VSAE</td><td>0.1217 ± 0.0002</td><td>0.1198 ± 0.0001</td><td>0.1202 ±0.0002</td></tr><tr><td>CVAE w/ data</td><td>0.1288 ± 0.0011</td><td>0.1266 ± 0.0005</td><td>0.1248 ± 0.0003</td></tr><tr><td>VAEAC</td><td>0.1218 ± 0.0002</td><td>0.1206 ± 0.0001</td><td>0.1211 ± 0.0001</td></tr></table>
382
+
383
+ # C.4 IMPUTATION ON NON-MCAR MASKING MECHANISMS
384
+
385
+ VSAE can jointly model data and mask distribution without any assumption on mask distribution. See A.1 for masking mechanism definitions. Mattei & Frellsen (2019) synthesized the mask from a MAR manner. We similarly follow them to synthesize MAR/NMAR masking mechanism on UCI numerical dataset and compare to state-of-the-art non-MCAR model MIWAE (Mattei & Frellsen, 2019).
386
+
387
+ Missing At Random (MAR). The mask distribution depends on the observed data. We choose first $2 5 \%$ modalties as default observed data and generate the mask according to the probability that
388
+
389
+ $$
390
+ \pi ( { \bf m } ) = \mathrm { s i g m o i d } ( \frac { 1 } { M } \sum _ { k = 1 } ^ { K } { \bf x } _ { k } )
391
+ $$
392
+
393
+ $M$ is the number of the features and $K$ is the number of default observed features.
394
+
395
+ Not Missing At Random (NMAR). The mask distribution depends on both observed and unobserved data. We generate the element-wise mask according to the probabilty that
396
+
397
+ $\pi ( m _ { i } ) = \mathrm { s i g m o i d } ( { \bf x } _ { i } )$ $m _ { i }$ is $i$ -th element in mask vector $\mathbf { m }$ of size $M$ .
398
+
399
+ <table><tr><td></td><td>MCAR</td><td>MAR</td><td>NMAR</td></tr><tr><td>MIWAE(Mattei &amp; Frellsen, 2019)</td><td>0.467± 0.0067</td><td>0.493 ± 0.029</td><td>0.513 ± 0.035</td></tr><tr><td>VSAE(ours)</td><td>0.455 ± 0.0003</td><td>0.472 ± 0.024</td><td>0.455 ± 0.0001</td></tr></table>
400
+
401
+ Table 9: Imputation on MAR/NMAR masking. Missing ratio is based on the values of data following the defined rules above. We show mean and standard deviation over 3 independent runs (lower is better) on Yeast dataset.
402
+
403
+ # C.5 MULTIMODAL EXPERIMENT
404
+
405
+ In this section, we include additional experiments on multimodal datasets to demonstrate the general effectiveness of our model. We choose the datasets following MVAE (Wu & Goodman, 2018) and MFM Tsai et al. (2019).
406
+
407
+ Table 10: Imputation on Image+Text datasets.. Missing ratio is 0.5. Image and text modality are evaluated by MSE and PFC respectively. Last two rows are trained with fully-observed data. We show mean and standard deviation over 3 independent runs (lower is better). $\Delta < 0 . 0 1$ .
408
+
409
+ <table><tr><td rowspan="2"></td><td colspan="2">FashionMNIST</td><td colspan="2">MNIST</td></tr><tr><td>image (MSE)</td><td>text (PFC)</td><td>image (MSE)</td><td>text (PFC)</td></tr><tr><td>AE</td><td>86.63 ± 1.09</td><td>0.366±△</td><td>54.90 ± 0.01</td><td>0.406±△</td></tr><tr><td>VAE</td><td>69.38 ± 0.10</td><td>0.411±△</td><td>53.82 ± 0.12</td><td>0.406 ± 0.01</td></tr><tr><td>CVAE w/ mask</td><td>69.53 ± 0.65</td><td>0.412±△</td><td>53.82±△</td><td>0.419±△</td></tr><tr><td>MVAE</td><td>109.95 ± 20.78</td><td>0.374 ± 0.07</td><td>178.40 ± 14.29</td><td>0.448±△</td></tr><tr><td>VSAE (ours)</td><td>68.49 ±0.19</td><td>0.356±△</td><td>53.42 ± 0.05</td><td>0.397 ± 0.01</td></tr><tr><td>CVAE w/ data</td><td>54.15 ± 0.03</td><td>0.259±△</td><td>47.38±△</td><td>0.237±△</td></tr><tr><td>VAEAC</td><td>61.59 ± 0.03</td><td>0.283±△</td><td>51.49 ± 0.06</td><td>0.250±△</td></tr></table>
410
+
411
+ We choose CMU-MOSI (Zadeh et al., 2016) and ICT-MMMO (Wöllmer et al., 2013) following Tsai et al. (2019). The author released the features of each modality, and all the numbers are calculated on the feature level. CMU-MOSI (Zadeh et al., 2016) is a collection of 2199 monologue opinion video clips annotated with sentiment. ICT-MMMO (Wöllmer et al., 2013) consists of 340 online social review videos annotated for sentiment. We train all the models using Adam optimizer with learning rate of 1e-3.
412
+
413
+ <table><tr><td></td><td>Textual-MSE</td><td>Acoustic-MSE</td><td>Visual-MSE</td></tr><tr><td>AE</td><td>0.035 ± 0.003</td><td>0.224 ± 0.025</td><td>0.019 ± 0.003</td></tr><tr><td>VAE</td><td>0.034±△</td><td>0.202±△</td><td>0.1273±△</td></tr><tr><td>CVAE w/ mask</td><td>0.43±△</td><td>0.257 ± 0.002</td><td>0.020±△</td></tr><tr><td>MVAE</td><td>0.44±△</td><td>0.213 ± 0.001</td><td>0.025±△</td></tr><tr><td>VSAE</td><td>0.033±△</td><td>0.200±△</td><td>0.017±△</td></tr><tr><td>CVAE w/ data</td><td>0.036±△</td><td>0.186±△</td><td>0.018±△</td></tr><tr><td>VAEAC</td><td>0.042±△</td><td>0.257±△</td><td>0.019±△</td></tr></table>
414
+
415
+ Table 11: Imputation on CMU-MOSI. Missing ratio is 0.5. Last two rows are trained with fullyobserved data. Evaluated by MSE of each modality. We show mean and standard deviation over 3 independent runs (lower is better). $\Delta < 0 . 0 0 0 5$
416
+ Table 12: Imputation on ICT-MMMO. Missing ratio is 0.5. Last two rows are trained with fullyobserved data. Evaluated by MSE of each modality. We show mean and standard deviation over 3 independent runs (lower is better).
417
+
418
+ <table><tr><td></td><td>Acoustic-MSE</td><td>Visual-MSE</td><td>Textual-MSE</td></tr><tr><td>AE</td><td>188.19 ± 2.083</td><td>3.695 ± 0.004</td><td>7.688 ± 0.243</td></tr><tr><td>VAE</td><td>63.26 ± 0.757</td><td>3.676 ± 0.103</td><td>6.153 ± 0.232</td></tr><tr><td>CVAE w/ mask</td><td>61.56 ± 6.584</td><td>3.614 ± 0.015</td><td>6.203 ± 0.423</td></tr><tr><td>MVAE</td><td>174.95 ± 117.64</td><td>3.569 ± 0.014</td><td>8.501 ± 3.561</td></tr><tr><td>VSAE</td><td>59.17 ± 4.120</td><td>3.569 ± 0.011</td><td>5.108 ±0.003</td></tr><tr><td>CVAE w/ data</td><td>59.22 ± 11.59</td><td>3.367 ± 0.046</td><td>6.398 ± 0.275</td></tr><tr><td>VAEAC</td><td>78.43 ± 8.774</td><td>3.111 ± 0.300</td><td>18.65 ± 0.452</td></tr></table>
md/train/rywHCPkAW/rywHCPkAW.md ADDED
@@ -0,0 +1,407 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NOISY NETWORKS FOR EXPLORATION
2
+
3
+ Meire Fortunato∗ Mohammad Gheshlaghi Azar∗ Bilal Piot ∗
4
+
5
+ Jacob Menick Matteo Hessel Ian Osband Alex Graves Vlad Mnih
6
+
7
+ Remi Munos Demis Hassabis Olivier Pietquin Charles Blundell Shane Legg
8
+
9
+ DeepMind {meirefortunato,mazar,piot,
10
+ jmenick,mtthss,iosband,gravesa,vmnih,
11
+ munos,dhcontact,pietquin,cblundell,legg}@google.com
12
+
13
+ # ABSTRACT
14
+
15
+ We introduce NoisyNet, a deep reinforcement learning agent with parametric noise added to its weights, and show that the induced stochasticity of the agent’s policy can be used to aid efficient exploration. The parameters of the noise are learned with gradient descent along with the remaining network weights. NoisyNet is straightforward to implement and adds little computational overhead. We find that replacing the conventional exploration heuristics for A3C, DQN and Dueling agents (entropy reward and $\epsilon$ -greedy respectively) with NoisyNet yields substantially higher scores for a wide range of Atari games, in some cases advancing the agent from sub to super-human performance.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Despite the wealth of research into efficient methods for exploration in Reinforcement Learning (RL) (Kearns & Singh, 2002; Jaksch et al., 2010), most exploration heuristics rely on random perturbations of the agent’s policy, such as $\epsilon$ -greedy (Sutton & Barto, 1998) or entropy regularisation (Williams, 1992), to induce novel behaviours. However such local ‘dithering’ perturbations are unlikely to lead to the large-scale behavioural patterns needed for efficient exploration in many environments (Osband et al., 2017).
20
+
21
+ Optimism in the face of uncertainty is a common exploration heuristic in reinforcement learning. Various forms of this heuristic often come with theoretical guarantees on agent performance (Azar et al., 2017; Lattimore et al., 2013; Jaksch et al., 2010; Auer & Ortner, 2007; Kearns & Singh, 2002). However, these methods are often limited to small state-action spaces or to linear function approximations and are not easily applied with more complicated function approximators such as neural networks (except from work by (Geist & Pietquin, 2010a;b) but it doesn’t come with convergence guarantees). A more structured approach to exploration is to augment the environment’s reward signal with an additional intrinsic motivation term (Singh et al., 2004) that explicitly rewards novel discoveries. Many such terms have been proposed, including learning progress (Oudeyer & Kaplan, 2007), compression progress (Schmidhuber, 2010), variational information maximisation (Houthooft et al., 2016) and prediction gain (Bellemare et al., 2016). One problem is that these methods separate the mechanism of generalisation from that of exploration; the metric for intrinsic reward, and–importantly–its weighting relative to the environment reward, must be chosen by the experimenter, rather than learned from interaction with the environment. Without due care, the optimal policy can be altered or even completely obscured by the intrinsic rewards; furthermore, dithering perturbations are usually needed as well as intrinsic reward to ensure robust exploration (Ostrovski et al., 2017). Exploration in the policy space itself, for example, with evolutionary or black box algorithms (Moriarty et al., 1999; Fix & Geist, 2012; Salimans et al., 2017), usually requires many prolonged interactions with the environment. Although these algorithms are quite generic and can apply to any type of parametric policies (including neural networks), they are usually not data efficient and require a simulator to allow many policy evaluations.
22
+
23
+ We propose a simple alternative approach, called NoisyNet, where learned perturbations of the network weights are used to drive exploration. The key insight is that a single change to the weight vector can induce a consistent, and potentially very complex, state-dependent change in policy over multiple time steps – unlike dithering approaches where decorrelated (and, in the case of -greedy, state-independent) noise is added to the policy at every step. The perturbations are sampled from a noise distribution. The variance of the perturbation is a parameter that can be considered as the energy of the injected noise. These variance parameters are learned using gradients from the reinforcement learning loss function, along side the other parameters of the agent. The approach differs from parameter compression schemes such as variational inference (Hinton & Van Camp, 1993; Bishop, 1995; Graves, 2011; Blundell et al., 2015; Gal & Ghahramani, 2016) and flat minima search (Hochreiter & Schmidhuber, 1997) since we do not maintain an explicit distribution over weights during training but simply inject noise in the parameters and tune its intensity automatically. Consequently, it also differs from Thompson sampling (Thompson, 1933; Lipton et al., 2016) as the distribution on the parameters of our agents does not necessarily converge to an approximation of a posterior distribution.
24
+
25
+ At a high level our algorithm is a randomised value function, where the functional form is a neural network. Randomised value functions provide a provably efficient means of exploration (Osband et al., 2014). Previous attempts to extend this approach to deep neural networks required many duplicates of sections of the network (Osband et al., 2016). By contrast in our NoisyNet approach while the number of parameters in the linear layers of the network is doubled, as the weights are a simple affine transform of the noise, the computational complexity is typically still dominated by the weight by activation multiplications, rather than the cost of generating the weights. Additionally, it also applies to policy gradient methods such as A3C out of the box (Mnih et al., 2016). Most recently (and independently of our work) Plappert et al. (2017) presented a similar technique where constant Gaussian noise is added to the parameters of the network. Our method thus differs by the ability of the network to adapt the noise injection with time and it is not restricted to Gaussian noise distributions. We need to emphasise that the idea of injecting noise to improve the optimisation process has been thoroughly studied in the literature of supervised learning and optimisation under different names (e.g., Neural diffusion process (Mobahi, 2016) and graduated optimisation (Hazan et al., 2016)). These methods often rely on a noise of vanishing size that is non-trainable, as opposed to NoisyNet which tunes the amount of noise by gradient descent.
26
+
27
+ NoisyNet can also be adapted to any deep RL algorithm and we demonstrate this versatility by providing NoisyNet versions of DQN (Mnih et al., 2015), Dueling (Wang et al., 2016) and A3C (Mnih et al., 2016) algorithms. Experiments on 57 Atari games show that NoisyNet-DQN and NoisyNetDueling achieve striking gains when compared to the baseline algorithms without significant extra computational cost, and with less hyper parameters to tune. Also the noisy version of A3C provides some improvement over the baseline.
28
+
29
+ # 2 BACKGROUND
30
+
31
+ This section provides mathematical background for Markov Decision Processes (MDPs) and deep RL with Q-learning, dueling and actor-critic methods.
32
+
33
+ 2.1 MARKOV DECISION PROCESSES AND REINFORCEMENT LEARNING
34
+
35
+ MDPs model stochastic, discrete-time and finite action space control problems (Bellman & Kalaba, 1965; Bertsekas, 1995; Puterman, 1994). An MDP is a tuple $M = ( \mathcal { X } , \mathcal { A } , R , P , \gamma )$ where $\mathcal { X }$ is the state space, $\mathcal { A }$ the action space, $R$ the reward function, $\gamma \in ] 0 , 1 [$ [ the discount factor and $P$ a stochastic kernel modelling the one-step Markovian dynamics $( P ( \boldsymbol { y } | \boldsymbol { x } , a )$ is the probability of transitioning to state $y$ by choosing action $a$ in state $x$ ). A stochastic policy $\pi$ maps each state to a distribution over actions $\pi ( \cdot | x )$ and gives the probability $\pi ( a | x )$ of choosing action $a$ in state $x$ . The quality of a policy $\pi$ is assessed by the action-value function $Q ^ { \pi }$ defined as:
36
+
37
+ $$
38
+ Q ^ { \pi } ( x , a ) = \mathbb { E } ^ { \pi } \left[ \sum _ { t = 0 } ^ { + \infty } \gamma ^ { t } R ( x _ { t } , a _ { t } ) \right] ,
39
+ $$
40
+
41
+ where $\mathbb { E } ^ { \pi }$ is the expectation over the distribution of the admissible trajectories $( x _ { 0 } , a _ { 0 } , x _ { 1 } , a _ { 1 } , \dots )$ obtained by executing the policy $\pi$ starting from $x _ { 0 } = x$ and $a _ { 0 } = a$ . Therefore, the quantity $Q ^ { \pi } ( x , a )$ represents the expected $\gamma$ -discounted cumulative reward collected by executing the policy $\pi$ starting from $x$ and $a$ . A policy is optimal if no other policy yields a higher return. The action-value function of the optimal policy is $Q ^ { \star } ( x , a ) = \arg \operatorname* { m a x } _ { \pi } Q ^ { \pi } ( x , a )$ .
42
+
43
+ The value function $V ^ { \pi }$ for a policy is defined as $V ^ { \pi } ( x ) = \mathbb { E } _ { a \sim \pi ( \cdot | x ) } [ Q ^ { \pi } ( x , a ) ]$ , and represents the expected $\gamma$ -discounted return collected by executing the policy $\pi$ starting from state $x$ .
44
+
45
+ # 2.2 DEEP REINFORCEMENT LEARNING
46
+
47
+ Deep Reinforcement Learning uses deep neural networks as function approximators for RL methods. Deep Q-Networks (DQN) (Mnih et al., 2015), Dueling architecture (Wang et al., 2016), Asynchronous Advantage Actor-Critic (A3C) (Mnih et al., 2016), Trust Region Policy Optimisation (Schulman et al., 2015), Deep Deterministic Policy Gradient (Lillicrap et al., 2015) and distributional RL (C51) (Bellemare et al., 2017) are examples of such algorithms. They frame the RL problem as the minimisation of a loss function $L ( \theta )$ , where $\theta$ represents the parameters of the network. In our experiments we shall consider the DQN, Dueling and A3C algorithms.
48
+
49
+ DQN (Mnih et al., 2015) uses a neural network as an approximator for the action-value function of the optimal policy $Q ^ { \star } ( x , a )$ . DQN’s estimate of the optimal action-value function, $Q ( x , a )$ , is found by minimising the following loss with respect to the neural network parameters $\theta$ :
50
+
51
+ $$
52
+ L ( \theta ) = \mathbb { E } _ { ( x , a , r , y ) \sim D } \left[ \left( r + \gamma \operatorname* { m a x } _ { b \in A } Q ( y , b ; \theta ^ { - } ) - Q ( x , a ; \theta ) \right) ^ { 2 } \right] ,
53
+ $$
54
+
55
+ where $D$ is a distribution over transitions $e = ( x , a , r = R ( x , a ) , y \sim P ( \cdot | x , a ) )$ drawn from a replay buffer of previously observed transitions. Here $\theta ^ { - }$ represents the parameters of a fixed and separate target network which is updated $\theta ^ { - } \theta$ ) regularly to stabilise the learning. An $\epsilon$ -greedy policy is used to pick actions greedily according to the action-value function $Q$ or, with probability $\epsilon$ , a random action is taken.
56
+
57
+ The Dueling DQN (Wang et al., 2016) is an extension of the DQN architecture. The main difference is in using Dueling network architecture as opposed to the $\mathrm { \bf Q }$ network in DQN. Dueling network estimates the action-value function using two parallel sub-networks, the value and advantage subnetwork, sharing a convolutional layer. Let $\theta _ { \mathrm { c o n v } }$ , $\theta _ { V }$ , and $\theta _ { A }$ be, respectively, the parameters of the convolutional encoder $f$ , of the value network $V$ , and of the advantage network $A$ ; and $\theta = \{ \theta _ { \mathrm { c o n v } } , \theta _ { V } , \theta _ { A } \}$ is their concatenation. The output of these two networks are combined as follows for every $( x , a ) \in \mathcal { X } \times \mathcal { A }$ :
58
+
59
+ $$
60
+ Q ( x , a ; \theta ) = V ( f ( x ; \theta _ { \mathrm { c o n v } } ) , \theta _ { V } ) + A ( f ( x ; \theta _ { \mathrm { c o n v } } ) , a ; \theta _ { A } ) - \frac { \sum _ { b } A ( f ( x ; \theta _ { \mathrm { c o n v } } ) , b ; \theta _ { A } ) } { N _ { \mathrm { a c t o n s } } } .
61
+ $$
62
+
63
+ The Dueling algorithm then makes use of the double-DQN update rule (van Hasselt et al., 2016) to optimise $\theta$ :
64
+
65
+ $$
66
+ \begin{array} { r l } & { L ( \theta ) = \mathbb { E } _ { ( x , a , r , y ) \sim D } \left[ \left( r + \gamma Q ( y , b ^ { \ast } ( y ) ; \theta ^ { - } ) - Q ( x , a ; \theta ) \right) ^ { 2 } \right] , } \\ { \mathrm { s . t . } \quad } & { b ^ { \ast } ( y ) = \arg \operatorname* { m a x } _ { b \in \mathcal { A } } Q ( y , b ; \theta ) , } \end{array}
67
+ $$
68
+
69
+ where the definition distribution $D$ and the target network parameter set $\theta ^ { - }$ is identical to DQN.
70
+
71
+ In contrast to DQN and Dueling, A3C (Mnih et al., 2016) is a policy gradient algorithm. A3C’s network directly learns a policy $\pi$ and a value function $V$ of its policy. The gradient of the loss on the
72
+
73
+ A3C policy at step $t$ for the roll-out $( x _ { t + i } , a _ { t + i } \sim \pi ( \cdot | x _ { t + i } ; \theta ) , r _ { t + i } ) _ { i = 0 } ^ { k }$ is:
74
+
75
+ $$
76
+ \nabla _ { \theta } L ^ { \pi } ( \theta ) = - \mathbb { E } ^ { \pi } \left[ \sum _ { i = 0 } ^ { k } \nabla _ { \theta } \log ( \pi ( a _ { t + i } | x _ { t + i } ; \theta ) ) A ( x _ { t + i } , a _ { t + i } ; \theta ) + \beta \sum _ { i = 0 } ^ { k } \nabla _ { \theta } H ( \pi ( \cdot | x _ { t + i } ; \theta ) ) \right] .
77
+ $$
78
+
79
+ $H [ \pi ( \cdot | x _ { t } ; \theta ) ]$ denotes the entropy of the policy $\pi$ and $\beta$ is a hyper parameter that trades off between optimising the advantage function and the entropy of the policy. The advantage function $A ( x _ { t + i } , a _ { t + i } ; \theta )$ is the dnetwork: $\begin{array} { r } { A ( x _ { t + i } , a _ { t + i } ; \theta ) = \sum _ { j = i } ^ { k - 1 } \gamma ^ { j - i } r _ { t + j } + \gamma ^ { k - i } V ( x _ { t + k } ; \theta ) - V ( x _ { t + i } ; \theta ) , } \end{array}$ $r _ { t + j }$ $t + j$ $V ( x ; \theta )$ $x$
80
+
81
+ The parameters of the value function are found to match on-policy returns; namely we have
82
+
83
+ $$
84
+ L ^ { V } ( \theta ) = \sum _ { i = 0 } ^ { k } \mathbb { E } ^ { \pi } \left[ ( Q _ { i } - V ( x _ { t + i } ; \theta ) ) ^ { 2 } \mid x _ { t + i } \right]
85
+ $$
86
+
87
+ where $\mathbb { Q } _ { i }$ is the return obtained by executing policy $\pi$ starting in state $x _ { t + i }$ . In practice, and as in Mnih et al. (2016), we estimate $Q _ { i }$ as $\begin{array} { r } { \hat { Q } _ { i } = \sum _ { j = i } ^ { k - 1 } \gamma ^ { j - i } r _ { t + j } + \gamma ^ { k - i } V ( x _ { t + k } ; \theta ) } \end{array}$ where $\{ r _ { t + j } \} _ { j = i } ^ { k - 1 }$ are rewards observed by the agent, and $x _ { t + k }$ is the $k$ th state observed when starting from observed state $x _ { t }$ . The overall A3C loss is then $L ( { \dot { \theta } } ) = L ^ { \pi } ( \theta ) + \lambda L ^ { V } ( \theta )$ where $\lambda$ balances optimising the policy loss relative to the baseline value function loss.
88
+
89
+ # 3 NOISYNETS FOR REINFORCEMENT LEARNING
90
+
91
+ NoisyNets are neural networks whose weights and biases are perturbed by a parametric function of the noise. These parameters are adapted with gradient descent. More precisely, let $y = f _ { \boldsymbol { \theta } } ( \boldsymbol { x } )$ be a neural network parameterised by the vector of noisy parameters $\theta$ which takes the input $x$ and outputs $y$ . We represent the noisy parameters $\theta$ as $\boldsymbol { \theta } \stackrel { \mathrm { d e f } } { = } \boldsymbol { \mu } + \boldsymbol { \Sigma } \odot \boldsymbol { \varepsilon }$ , where $\zeta \ { \stackrel { \mathrm { d e f } } { = } } \ ( \mu , \Sigma )$ is a set of vectors of learnable parameters, $\varepsilon$ is a vector of zero-mean noise with fixed statistics and $\odot$ represents element-wise multiplication. The usual loss of the neural network is wrapped by expectation over the noise $\varepsilon \colon \bar { L } ( \zeta ) \ { \stackrel { \mathrm { d e f } } { = } } \ \mathbb { E } \left[ L ( \theta ) \right]$ . Optimisation now occurs with respect to the set of parameters $\zeta$ .
92
+
93
+ Consider a linear layer of a neural network with $p$ inputs and $q$ outputs, represented by
94
+
95
+ $$
96
+ y = w x + b ,
97
+ $$
98
+
99
+ where $x \in \mathbb { R } ^ { p }$ is the layer input, $w \in \mathbb { R } ^ { q \times p }$ the weight matrix, and $b \in \mathbb { R } ^ { q }$ the bias. The corresponding noisy linear layer is defined as:
100
+
101
+ $$
102
+ \begin{array} { r l r } { y } & { \stackrel { \mathrm { d e f } } { = } } & { \big ( \mu ^ { w } + \sigma ^ { w } \odot \varepsilon ^ { w } \big ) x + \mu ^ { b } + \sigma ^ { b } \odot \varepsilon ^ { b } , } \end{array}
103
+ $$
104
+
105
+ where $\mu ^ { w } + \sigma ^ { w } \odot \varepsilon ^ { w }$ and $\mu ^ { b } + \sigma ^ { b } \odot \varepsilon ^ { b }$ replace $w$ and $b$ in Eq. (8), respectively. The parameters $\boldsymbol { \mu } ^ { w } \in \mathbb { R } ^ { q \times p }$ , $\boldsymbol { \mu } ^ { b } \in \mathbb { R } ^ { q }$ , $\sigma ^ { w } \in \mathbb { R } ^ { q \times p }$ and $\sigma ^ { b } \in \mathbb { R } ^ { q }$ are learnable whereas $\varepsilon ^ { \bar { w } } \in \mathbb { R } ^ { q \times p }$ and $\hat { \boldsymbol { \varepsilon } } ^ { b } \in \mathbb { R } ^ { q }$ are noise random variables (the specific choices of this distribution are described below). We provide a graphical representation of a noisy linear layer in Fig. 4 (see Appendix B).
106
+
107
+ We now turn to explicit instances of the noise distributions for linear layers in a noisy network. We explore two options: Independent Gaussian noise, which uses an independent Gaussian noise entry per weight and Factorised Gaussian noise, which uses an independent noise per each output and another independent noise per each input. The main reason to use factorised Gaussian noise is to reduce the compute time of random number generation in our algorithms. This computational overhead is especially prohibitive in the case of single-thread agents such as DQN and Duelling. For this reason we use factorised noise for DQN and Duelling and independent noise for the distributed A3C, for which the compute time is not a major concern.
108
+
109
+ (a) Independent Gaussian noise: the noise applied to each weight and bias is independent, where each entry $\varepsilon _ { i , j } ^ { w }$ (respectively each entry $\varepsilon _ { j } ^ { b }$ ) of the random matrix $\varepsilon ^ { w }$ (respectively of the random vector $\varepsilon ^ { b }$ ) is drawn from a unit Gaussian distribution. This means that for each noisy linear layer, there are $p q + q$ noise variables (for $p$ inputs to the layer and $q$ outputs).
110
+
111
+ (b) Factorised Gaussian noof the inputs and and e: by factorising unit Gaussian v $\varepsilon _ { i , j } ^ { w }$ , webles n use for $p$ unit Gaussian variables ise of the outputs (thus $\varepsilon _ { i }$ noiseunit $q$ $\varepsilon _ { j }$ $p + q$ Gaussian variables in total). Each $\varepsilon _ { i , j } ^ { w }$ and $\varepsilon _ { j } ^ { b }$ can then be written as:
112
+
113
+ $$
114
+ \begin{array} { c } { { \varepsilon _ { i , j } ^ { w } = f ( \varepsilon _ { i } ) f ( \varepsilon _ { j } ) , } } \\ { { \varepsilon _ { j } ^ { b } = f ( \varepsilon _ { j } ) , } } \end{array}
115
+ $$
116
+
117
+ where $f$ is a real-valued function. In our experiments we used $f ( x ) = \operatorname { s g n } ( x ) { \sqrt { | x | } }$ . Note that for the bias Eq. (11) we could have set $f ( x ) = x$ , but we decided to keep the same output noise for weights and biases.
118
+
119
+ Since the loss of a noisy network, $\bar { L } ( \zeta ) = \mathbb { E } \left[ L ( \theta ) \right]$ , is an expectation over the noise, the gradients are straightforward to obtain:
120
+
121
+ $$
122
+ \nabla \bar { L } ( \zeta ) = \nabla \mathbb { E } \left[ L ( \theta ) \right] = \mathbb { E } \left[ \nabla _ { \mu , \Sigma } L ( \mu + \Sigma \odot \varepsilon ) \right] .
123
+ $$
124
+
125
+ We use a Monte Carlo approximation to the above gradients, taking a single sample $\xi$ at each step of optimisation:
126
+
127
+ $$
128
+ \nabla \bar { L } ( \zeta ) \approx \nabla _ { \mu , \Sigma } L ( \mu + \Sigma \odot \xi ) .
129
+ $$
130
+
131
+ # 3.1 DEEP REINFORCEMENT LEARNING WITH NOISYNETS
132
+
133
+ We now turn to our application of noisy networks to exploration in deep reinforcement learning. Noise drives exploration in many methods for reinforcement learning, providing a source of stochasticity external to the agent and the RL task at hand. Either the scale of this noise is manually tuned across a wide range of tasks (as is the practice in general purpose agents such as DQN or A3C) or it can be manually scaled per task. Here we propose automatically tuning the level of noise added to an agent for exploration, using the noisy networks training to drive down (or up) the level of noise injected into the parameters of a neural network, as needed.
134
+
135
+ A noisy network agent samples a new set of parameters after every step of optimisation. Between optimisation steps, the agent acts according to a fixed set of parameters (weights and biases). This ensures that the agent always acts according to parameters that are drawn from the current noise distribution.
136
+
137
+ Deep Q-Networks (DQN) and Dueling. We apply the following modifications to both DQN and Dueling: first, $\varepsilon$ -greedy is no longer used, but instead the policy greedily optimises the (randomised) action-value function. Secondly, the fully connected layers of the value network are parameterised as a noisy network, where the parameters are drawn from the noisy network parameter distribution after every replay step. We used factorised Gaussian noise as explained in (b) from Sec. 3. For replay, the current noisy network parameter sample is held fixed across the batch. Since DQN and Dueling take one step of optimisation for every action step, the noisy network parameters are re-sampled before every action. We call the new adaptations of DQN and Dueling, NoisyNet-DQN and NoisyNet-Dueling, respectively.
138
+
139
+ We now provide the details of the loss function that our variant of DQN is minimising. When replacing the linear layers by noisy layers in the network (respectively in the target network), the parameterised action-value function $Q ( x , a , \varepsilon ; \zeta )$ (respectively $Q ( x , a , \varepsilon ^ { \prime } ; \zeta ^ { - } ) )$ can be seen as a random variable and the DQN loss becomes the NoisyNet-DQN loss:
140
+
141
+ $$
142
+ \bar { L } ( \zeta ) = \mathbb { E } \left[ \mathbb { E } _ { ( x , a , r , y ) \sim D } [ r + \gamma \operatorname* { m a x } _ { b \in A } Q ( y , b , \varepsilon ^ { \prime } ; \zeta ^ { - } ) - Q ( x , a , \varepsilon ; \zeta ) ] ^ { 2 } \right] ,
143
+ $$
144
+
145
+ where the outer expectation is with respect to distribution of the noise variables $\varepsilon$ for the noisy value function $Q ( x , a , \varepsilon ; \zeta )$ and the noise variable $\varepsilon ^ { \prime }$ for the noisy target value function $Q ( y , b , \varepsilon ^ { \prime } ; \zeta ^ { - } )$ . Computing an unbiased estimate of the loss is straightforward as we only need to compute, for each transition in the replay buffer, one instance of the target network and one instance of the online network. We generate these independent noises to avoid bias due to the correlation between the noise in the target network and the online network. Concerning the action choice, we generate another independent sample $\varepsilon ^ { \prime \prime }$ for the online network and we act greedily with respect to the corresponding output action-value function.
146
+
147
+ Similarly the loss function for NoisyNet-Dueling is defined as:
148
+
149
+ $$
150
+ \begin{array} { r l } & { \bar { L } ( \zeta ) = \mathbb { E } \left[ \mathbb { E } _ { ( x , a , r , y ) \sim D } [ r + \gamma Q ( y , b ^ { * } ( y ) , \varepsilon ^ { \prime } ; \zeta ^ { - } ) - Q ( x , a , \varepsilon ; \zeta ) ] ^ { 2 } \right] } \\ & { b ^ { * } ( y ) = \arg \operatorname* { m a x } _ { b \in \mathcal { A } } Q ( y , b ( y ) , \varepsilon ^ { \prime \prime } ; \zeta ) . } \end{array}
151
+ $$
152
+
153
+ Both algorithms are provided in Appendix C.1.
154
+
155
+ Asynchronous Advantage Actor Critic (A3C). A3C is modified in a similar fashion to DQN: firstly, the entropy bonus of the policy loss is removed. Secondly, the fully connected layers of the policy network are parameterised as a noisy network. We used independent Gaussian noise as explained in (a) from Sec. 3. In A3C, there is no explicit exploratory action selection scheme (such as $\epsilon$ -greedy); and the chosen action is always drawn from the current policy. For this reason, an entropy bonus of the policy loss is often added to discourage updates leading to deterministic policies. However, when adding noisy weights to the network, sampling these parameters corresponds to choosing a different current policy which naturally favours exploration. As a consequence of direct exploration in the policy space, the artificial entropy loss on the policy can thus be omitted. New parameters of the policy network are sampled after each step of optimisation, and since A3C uses $n$ step returns, optimisation occurs every $n$ steps. We call this modification of A3C, NoisyNet-A3C.
156
+
157
+ Indeed, when replacing the linear layers by noisy linear layers (the parameters of the noisy network are now noted $\zeta ,$ ), we obtain the following estimation of the return via a roll-out of size $k$ :
158
+
159
+ $$
160
+ \hat { Q } _ { i } = \sum _ { j = i } ^ { k - 1 } \gamma ^ { j - i } r _ { t + j } + \gamma ^ { k - i } V ( x _ { t + k } ; \zeta , \varepsilon _ { i } ) .
161
+ $$
162
+
163
+ As A3C is an on-policy algorithm the gradients are unbiased when noise of the network is consistent for the whole roll-out. Consistency among action value functions $\hat { Q } _ { i }$ is ensured by letting letting the noise be the same throughout each rollout, i.e., $\forall i , \varepsilon _ { i } = \varepsilon$ . Additional details are provided in the Appendix A and the algorithm is given in Appendix C.2.
164
+
165
+ # 3.2 INITIALISATION OF NOISY NETWORKS
166
+
167
+ In the case of an unfactorised noisy networks, the parameters $\mu$ and $\sigma$ are initialised as follows. Each element $\mu _ { i , j }$ is sampled from independent uniform distributions $\mathcal { U } [ - \sqrt { \frac { 3 } { p } } , + \sqrt { \frac { 3 } { p } } ]$ , where $p$ is the number of inputs to the corresponding linear layer, and each element $\sigma _ { i , j }$ is simply set to 0.017 for all parameters. This particular initialisation was chosen because similar values worked well for the supervised learning tasks described in Fortunato et al. (2017), where the initialisation of the variances of the posteriors and the variances of the prior are related. We have not tuned for this parameter, but we believe different values on the same scale should provide similar results.
168
+
169
+ For factorised noisy networks, each element $\mu _ { i , j }$ was initialised by a sample from an independent uniform distributions $\mathcal { U } [ - \frac { 1 } { \sqrt { p } } , + \frac { 1 } { \sqrt { p } } ]$ and each element $\sigma _ { i , j }$ was initialised to a constant $\textstyle { \frac { \sigma _ { 0 } } { \sqrt { p } } }$ The hyperparameter $\sigma _ { 0 }$ is set to 0.5.
170
+
171
+ # 4 RESULTS
172
+
173
+ We evaluated the performance of noisy network agents on 57 Atari games (Bellemare et al., 2015) and compared to baselines that, without noisy networks, rely upon the original exploration methods $\dot { \varepsilon }$ -greedy and entropy bonus).
174
+
175
+ # 4.1 TRAINING DETAILS AND PERFORMANCE
176
+
177
+ We used the random start no-ops scheme for training and evaluation as described the original DQN paper (Mnih et al., 2015). The mode of evaluation is identical to those of Mnih et al. (2016) where randomised restarts of the games are used for evaluation after training has happened. The raw average scores of the agents are evaluated during training, every 1M frames in the environment, by suspending learning and evaluating the latest agent for 500K frames. Episodes are truncated at 108K frames (or 30 minutes of simulated play) (van Hasselt et al., 2016).
178
+
179
+ ![](images/eeded447d8312644d3982e75d676773955b151dd915500a7e342fde559e0efa7.jpg)
180
+ (a) Improvement in percentage of NoisyNet-DQN over DQN (Mnih et al., 2015)
181
+
182
+ ![](images/917e01b1bc2ad5edeaa8bae15c927a06c2c30237e0db6f89675c6872d4960ee8.jpg)
183
+ (b) Improvement in percentage of NoisyNet-Dueling over Dueling (Wang et al., 2016)
184
+
185
+ ![](images/36fe170c45d35d080ac281feb91097f4b81424a3d03b0cb550b98ed0dc817432.jpg)
186
+ Figure 1: Comparison of NoisyNet agent versus the baseline according to Eq. (19). The maximum score is truncated at $2 5 0 \%$ .
187
+
188
+ We consider three baseline agents: DQN (Mnih et al., 2015), duel clip variant of Dueling algorithm (Wang et al., 2016) and A3C (Mnih et al., 2016). The DQN and A3C agents were training for 200M and 320M frames, respectively. In each case, we used the neural network architecture from the corresponding original papers for both the baseline and NoisyNet variant. For the NoisyNet variants we used the same hyper parameters as in the respective original paper for the baseline.
189
+
190
+ We compared absolute performance of agents using the human normalised score:
191
+
192
+ $$
193
+ 1 0 0 \times \frac { \mathrm { S c o r e } _ { \mathrm { a g e n t } } - \mathrm { S c o r e } _ { \mathrm { R a n d o m } } } { \mathrm { S c o r e } _ { \mathrm { H u m a n } } - \mathrm { S c o r e } _ { \mathrm { R a n d o m } } } ,
194
+ $$
195
+
196
+ where human and random scores are the same as those in Wang et al. (2016). Note that the human normalised score is zero for a random agent and 100 for human level performance. Per-game maximum scores are computed by taking the maximum raw scores of the agent and then averaging over three seeds. However, for computing the human normalised scores in Figure 2, the raw scores are evaluated every 1M frames and averaged over three seeds. The overall agent performance is measured by both mean and median of the human normalised score across all 57 Atari games.
197
+
198
+ The aggregated results across all 57 Atari games are reported in Table 1, while the individual scores for each game are in Table 3 from the Appendix E. The median human normalised score is improved in all agents by using NoisyNet, adding at least 18 (in the case of A3C) and at most 48 (in the case of DQN) percentage points to the median human normalised score. The mean human normalised score is also significantly improved for all agents. Interestingly the Dueling case, which relies on multiple modifications of DQN, demonstrates that NoisyNet is orthogonal to several other improvements made to DQN. We also compared relative performance of NoisyNet agents to the respective baseline agent
199
+
200
+ <table><tr><td rowspan="2"></td><td colspan="2">Baseline</td><td colspan="2">NoisyNet</td><td rowspan="2">Improvement (On median)</td></tr><tr><td>Mean</td><td>Median</td><td>Mean</td><td>Median</td></tr><tr><td>DQN</td><td>319</td><td>83</td><td>379</td><td>123</td><td>48%</td></tr><tr><td>Dueling</td><td>524</td><td>132</td><td>633</td><td>172</td><td>30%</td></tr><tr><td>A3C</td><td>293</td><td>80</td><td>347</td><td>94</td><td>18%</td></tr></table>
201
+
202
+ Table 1: Comparison between the baseline DQN, Dueling and A3C and their NoisyNet version in terms of median and mean human-normalised scores defined in Eq. (18). We report on the last column the percentage improvement on the baseline in terms of median human-normalised score.
203
+
204
+ without noisy networks:
205
+
206
+ $$
207
+ 1 0 0 \times \frac { \mathrm { S c o r e } _ { \mathrm { N o i s y N e t } } - \mathrm { S c o r e } _ { \mathrm { B a s e l i n e } } } { \mathrm { m a x } ( \mathrm { S c o r e } _ { \mathrm { H u m a n } } , \mathrm { S c o r e } _ { \mathrm { B a s e l i n e } } ) - \mathrm { S c o r e } _ { \mathrm { R a n d o m } } } .
208
+ $$
209
+
210
+ As before, the per-game score is computed by taking the maximum performance for each game and then averaging over three seeds. The relative human normalised scores are shown in Figure 1. As can be seen, the performance of NoisyNet agents (DQN, Dueling and A3C) is better for the majority of games relative to the corresponding baseline, and in some cases by a considerable margin. Also as it is evident from the learning curves of Fig. 2 NoisyNet agents produce superior performance compared to their corresponding baselines throughout the learning process. This improvement is especially significant in the case of NoisyNet-DQN and NoisyNet-Dueling. Also in some games, NoisyNet agents provide an order of magnitude improvement on the performance of the vanilla agent; as can be seen in Table 3 in the Appendix E with detailed breakdown of individual game scores and the learning curves plots from Figs 6, 7 and 8, for DQN, Dueling and A3C, respectively. We also ran some experiments evaluating the performance of NoisyNet-A3C with factorised noise. We report the corresponding learning curves and the scores in Fig. 5 and Table 2, respectively (see Appendix D). This result shows that using factorised noise does not lead to any significant decrease in the performance of A3C. On the contrary it seems that it has positive effects in terms of improving the median score as well as speeding up the learning process.
211
+
212
+ ![](images/f8b3e1a03cf45fff09d05d34bab186ac97fba302c9e577c3e086461de7c4120b.jpg)
213
+ Figure 2: Comparison of the learning curves of NoisyNet agent versus the baseline according to the median human normalised score.
214
+
215
+ # 4.2 ANALYSIS OF LEARNING IN NOISY LAYERS
216
+
217
+ In this subsection, we try to provide some insight on how noisy networks affect the learning process and the exploratory behaviour of the agent. In particular, we focus on analysing the evolution of the noise weights $\sigma ^ { w }$ and $\sigma ^ { b }$ throughout the learning process. We first note that, as $\bar { L } ( \zeta )$ is a positive and continuous function of $\zeta$ , there always exists a deterministic optimiser for the loss $L ( \zeta )$ (defined in
218
+
219
+ Eq. (14)). Therefore, one may expect that, to obtain the deterministic optimal solution, the neural network may learn to discard the noise entries by eventually pushing $\sigma ^ { w } \mathrm { s }$ and $\sigma ^ { b }$ towards 0.
220
+
221
+ To test this hypothesis we track the changes in $\sigma ^ { w } \mathbf { s }$ throughout the learning process. Let ${ \boldsymbol { \sigma } } _ { i } ^ { w }$ denote the $i ^ { \mathrm { { t h } } }$ weight of a noisy layer. We then define $\bar { \Sigma }$ , the mean-absolute of the $\sigma _ { i } ^ { w } \mathbf { s }$ of a noisy layer, as
222
+
223
+ $$
224
+ \bar { \Sigma } = \frac { 1 } { \mathrm { N } _ { \mathrm { w e i g h t s } } } \sum _ { i } | \sigma _ { i } ^ { w } | .
225
+ $$
226
+
227
+ Intuitively speaking $\bar { \Sigma }$ provides some measure of the stochasticity of the Noisy layers. We report the learning curves of the average of $\bar { \Sigma }$ across 3 seeds in Fig. 3 for a selection of Atari games in NoisyNet-DQN agent. We observe that $\bar { \Sigma }$ of the last layer of the network decreases as the learning proceeds in all cases, whereas in the case of the penultimate layer this only happens for 2 games out of 5 (Pong and Beam rider) and in the remaining 3 games $\bar { \Sigma }$ in fact increases. This shows that in the case of NoisyNet-DQN the agent does not necessarily evolve towards a deterministic solution as one might have expected. Another interesting observation is that the way $\bar { \Sigma }$ evolves significantly differs from one game to another and in some cases from one seed to another seed, as it is evident from the error bars. This suggests that NoisyNet produces a problem-specific exploration strategy as opposed to fixed exploration strategy used in standard DQN.
228
+
229
+ ![](images/01a19dddcbd8dd4681c12cfc247c4d3c15eeac77a5655fdd5b2f945cbccd6d13.jpg)
230
+ Figure 3: Comparison of the learning curves of the average noise parameter $\bar { \Sigma }$ across five Atari games in NoisyNet-DQN. The results are averaged across 3 seeds and error bars $+ / -$ standard deviation) are plotted.
231
+
232
+ # 5 CONCLUSION
233
+
234
+ We have presented a general method for exploration in deep reinforcement learning that shows significant performance improvements across many Atari games in three different agent architectures. In particular, we observe that in games such as Beam rider, Asteroids and Freeway that the standard DQN, Dueling and A3C perform poorly compared with the human player, NoisyNet-DQN, NoisyNet-Dueling and NoisyNet-A3C achieve super human performance, respectively. Although the improvements in performance might also come from the optimisation aspect since the cost functions are modified, the uncertainty in the parameters of the networks introduced by NoisyNet is the only exploration mechanism of the method. Having weights with greater uncertainty introduces more variability into the decisions made by the policy, which has potential for exploratory actions, but further analysis needs to be done in order to disentangle the exploration and optimisation effects.
235
+
236
+ Another advantage of NoisyNet is that the amount of noise injected in the network is tuned automatically by the RL algorithm. This alleviates the need for any hyper parameter tuning (required with standard entropy bonus and $\epsilon$ -greedy types of exploration). This is also in contrast to many other methods that add intrinsic motivation signals that may destabilise learning or change the optimal policy. Another interesting feature of the NoisyNet approach is that the degree of exploration is contextual and varies from state to state based upon per-weight variances. While more gradients are needed, the gradients on the mean and variance parameters are related to one another by a computationally efficient affine function, thus the computational overhead is marginal. Automatic differentiation makes implementation of our method a straightforward adaptation of many existing methods. A similar randomisation technique can also be applied to LSTM units (Fortunato et al., 2017) and is easily extended to reinforcement learning, we leave this as future work.
237
+
238
+ Note NoisyNet exploration strategy is not restricted to the baselines considered in this paper. In fact, this idea can be applied to any deep RL algorithms that can be trained with gradient descent, including DDPG (Lillicrap et al., 2015), TRPO (Schulman et al., 2015) or distributional RL (C51) (Bellemare et al., 2017). As such we believe this work is a step towards the goal of developing a universal exploration strategy.
239
+
240
+ # REFERENCES
241
+
242
+ Peter Auer and Ronald Ortner. Logarithmic online regret bounds for undiscounted reinforcement learning. Advances in Neural Information Processing Systems, 19:49, 2007.
243
+
244
+ Mohammad Gheshlaghi Azar, Ian Osband, and Rémi Munos. Minimax regret bounds for reinforcement learning. arXiv preprint arXiv:1703.05449, 2017.
245
+
246
+ Marc Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. In Twenty-Fourth International Joint Conference on Artificial Intelligence, 2015.
247
+
248
+ 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.
249
+
250
+ Marc G Bellemare, Will Dabney, and Rémi Munos. A distributional perspective on reinforcement learning. In International Conference on Machine Learning, pp. 449–458, 2017.
251
+
252
+ Richard Bellman and Robert Kalaba. Dynamic programming and modern control theory. Academic Press New York, 1965.
253
+
254
+ Dimitri Bertsekas. Dynamic programming and optimal control, volume 1. Athena Scientific, Belmont, MA, 1995.
255
+
256
+ Chris M Bishop. Training with noise is equivalent to Tikhonov regularization. Neural computation, 7 (1):108–116, 1995.
257
+
258
+ Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight uncertainty in neural networks. In Proceedings of The 32nd International Conference on Machine Learning, pp. 1613–1622, 2015.
259
+
260
+ Jeremy Fix and Matthieu Geist. Monte-Carlo swarm policy search. In Swarm and Evolutionary Computation, pp. 75–83. Springer, 2012.
261
+
262
+ Meire Fortunato, Charles Blundell, and Oriol Vinyals. Bayesian recurrent neural networks. arXiv preprint arXiv:1704.02798, 2017.
263
+
264
+ Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In Maria Florina Balcan and Kilian Q. Weinberger (eds.), Proceedings of The 33rd International Conference on Machine Learning, volume 48 of Proceedings of Machine Learning Research, pp. 1050–1059, New York, New York, USA, 20–22 Jun 2016. PMLR. URL http://proceedings.mlr.press/v48/gal16.html.
265
+
266
+ Matthieu Geist and Olivier Pietquin. Kalman temporal differences. Journal of artificial intelligence research, 39:483–532, 2010a.
267
+
268
+ Matthieu Geist and Olivier Pietquin. Managing uncertainty within value function approximation in reinforcement learning. In Active Learning and Experimental Design workshop (collocated with AISTATS 2010), Sardinia, Italy, volume 92, 2010b.
269
+
270
+ Alex Graves. Practical variational inference for neural networks. In Advances in Neural Information Processing Systems, pp. 2348–2356, 2011.
271
+
272
+ Elad Hazan, Kfir Yehuda Levy, and Shai Shalev-Shwartz. On graduated optimization for stochastic non-convex problems. In International Conference on Machine Learning, pp. 1833–1841, 2016.
273
+
274
+ Geoffrey E Hinton and Drew Van Camp. Keeping the neural networks simple by minimizing the description length of the weights. In Proceedings of the sixth annual conference on Computational learning theory, pp. 5–13. ACM, 1993.
275
+
276
+ Sepp Hochreiter and Jürgen Schmidhuber. Flat minima. Neural Computation, 9(1):1–42, 1997.
277
+
278
+ 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.
279
+
280
+ Thomas Jaksch, Ronald Ortner, and Peter Auer. Near-optimal regret bounds for reinforcement learning. Journal of Machine Learning Research, 11(Apr):1563–1600, 2010.
281
+
282
+ Michael Kearns and Satinder Singh. Near-optimal reinforcement learning in polynomial time. Machine Learning, 49(2-3):209–232, 2002.
283
+
284
+ Tor Lattimore, Marcus Hutter, and Peter Sunehag. The sample-complexity of general reinforcement learning. In Proceedings of The 30th International Conference on Machine Learning, pp. 28–36, 2013.
285
+
286
+ 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.
287
+
288
+ Zachary C Lipton, Jianfeng Gao, Lihong Li, Xiujun Li, Faisal Ahmed, and Li Deng. Efficient exploration for dialogue policy learning with BBQ networks & replay buffer spiking. arXiv preprint arXiv:1608.05081, 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
+ Hossein Mobahi. Training recurrent neural networks by diffusion. arXiv preprint arXiv:1601.04114, 2016.
295
+
296
+ David E Moriarty, Alan C Schultz, and John J Grefenstette. Evolutionary algorithms for reinforcement learning. Journal of Artificial Intelligence Research, 11:241–276, 1999.
297
+
298
+ Ian Osband, Benjamin Van Roy, and Zheng Wen. Generalization and exploration via randomized value functions. arXiv preprint arXiv:1402.0635, 2014.
299
+
300
+ Ian Osband, Charles Blundell, Alexander Pritzel, and Benjamin Van Roy. Deep exploration via bootstrapped DQN. In Advances In Neural Information Processing Systems, pp. 4026–4034, 2016.
301
+
302
+ Ian Osband, Daniel Russo, Zheng Wen, and Benjamin Van Roy. Deep exploration via randomized value functions. arXiv preprint arXiv:1703.07608, 2017.
303
+
304
+ Georg Ostrovski, Marc G Bellemare, Aaron van den Oord, and Remi Munos. Count-based exploration with neural density models. arXiv preprint arXiv:1703.01310, 2017.
305
+
306
+ Pierre-Yves Oudeyer and Frederic Kaplan. What is intrinsic motivation? A typology of computational approaches. Frontiers in neurorobotics, 1, 2007.
307
+
308
+ Matthias Plappert, Rein Houthooft, Prafulla Dhariwal, Szymon Sidor, Richard Y Chen, Xi Chen, Tamim Asfour, Pieter Abbeel, and Marcin Andrychowicz. Parameter space noise for exploration. arXiv preprint arXiv:1706.01905, 2017.
309
+
310
+ Martin Puterman. Markov decision processes: discrete stochastic dynamic programming. John Wiley & Sons, 1994.
311
+
312
+ Tim Salimans, J. Ho, X. Chen, and I. Sutskever. Evolution Strategies as a Scalable Alternative to Reinforcement Learning. ArXiv e-prints, 2017.
313
+ Jürgen Schmidhuber. Formal theory of creativity, fun, and intrinsic motivation (1990–2010). IEEE Transactions on Autonomous Mental Development, 2(3):230–247, 2010.
314
+ J. Schulman, S. Levine, P. Abbeel, M. Jordan, and P. Moritz. Trust region policy optimization. In Proc. of ICML, pp. 1889–1897, 2015.
315
+ Satinder P Singh, Andrew G Barto, and Nuttapong Chentanez. Intrinsically motivated reinforcement learning. In NIPS, volume 17, pp. 1281–1288, 2004.
316
+ Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. Cambridge Univ Press, 1998.
317
+ Richard S. Sutton, David A. McAllester, Satinder P. Singh, and Yishay Mansour. Policy gradient methods for reinforcement learning with function approximation. In Proc. of NIPS, volume 99, pp. 1057–1063, 1999.
318
+ William R Thompson. On the likelihood that one unknown probability exceeds another in view of the evidence of two samples. Biometrika, 25(3/4):285–294, 1933.
319
+ Hado van Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double qlearning. In Proc. of AAAI, pp. 2094–2100, 2016.
320
+ Ziyu Wang, Tom Schaul, Matteo Hessel, Hado van Hasselt, Marc Lanctot, and Nando de Freitas. Dueling network architectures for deep reinforcement learning. In Proceedings of The 33rd International Conference on Machine Learning, pp. 1995–2003, 2016.
321
+ Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
322
+
323
+ # A NOISYNET-A3C IMPLEMENTATION DETAILS
324
+
325
+ In contrast with value-based algorithms, policy-based methods such as A3C (Mnih et al., 2016) parameterise the policy $\pi ( a | x ; \bar { \theta _ { \pi } } )$ directly and update the parameters $\theta _ { \pi }$ by performing a gradient ascent on the mean value-function $\mathbb { E } _ { x \sim D } [ V ^ { \pi ( \cdot | \cdot ; \theta _ { \pi } ) } ( x ) ]$ (also called the expected return) (Sutton et al., 1999). A3C uses a deep neural network with weights $\theta = \theta _ { \pi } \cup \theta _ { V }$ to parameterise the policy $\pi$ and the value $V$ . The network has one softmax output for the policy-head $\pi ( \cdot | \cdot ; \theta _ { \pi } )$ and one linear output for the value-head $V ( \cdot ; \theta _ { V } )$ , with all non-output layers shared. The parameters $\theta _ { \pi }$ (resp. $\theta _ { V }$ ) are relative to the shared layers and the policy head (resp. the value head). A3C is an asynchronous and online algorithm that uses roll-outs of size $k + 1$ of the current policy to perform a policy improvement step.
326
+
327
+ For simplicity, here we present the A3C version with only one thread. For a multi-thread implementation, refer to the pseudo-code C.2 or to the original A3C paper (Mnih et al., 2016). In order to train the policy-head, an approximation of the policy-gradient is computed for each state of the roll-out $( x _ { t + i } , a _ { t + i } \sim \pi ( \cdot | x _ { t + i } ; \theta _ { \pi } ) , r _ { t + i } ) _ { i = 0 } ^ { k }$ :
328
+
329
+ $$
330
+ \nabla _ { \boldsymbol { \theta } _ { \pi } } \log ( \pi ( a _ { t + i } | \boldsymbol { x } _ { t + i } ; \boldsymbol { \theta } _ { \pi } ) ) [ \hat { Q } _ { i } - V ( \boldsymbol { x } _ { t + i } ; \boldsymbol { \theta } _ { V } ) ] ,
331
+ $$
332
+
333
+ where $\hat { Q } _ { i }$ is an estimation of the return $\begin{array} { r } { \hat { Q } _ { i } = \sum _ { j = i } ^ { k - 1 } \gamma ^ { j - i } r _ { t + j } + \gamma ^ { k - i } V ( x _ { t + k } ; \theta _ { V } ) } \end{array}$ . The gradients
334
+
335
+ $$
336
+ \sum _ { i = 0 } ^ { k } \nabla _ { \theta _ { \pi } } \log ( \pi ( a _ { t + i } | x _ { t + i } ; \theta _ { \pi } ) ) [ \hat { Q } _ { i } - V ( x _ { t + i } ; \theta _ { V } ) ] .
337
+ $$
338
+
339
+ A3C trains the value-head by minimising the error between the estimated return and the value $\textstyle \sum _ { i = 0 } ^ { k } ( \hat { Q } _ { i } - V ( x _ { t + i } ; \theta _ { V } ) ) ^ { 2 }$ . Therefore, the network parameters $( \theta _ { \pi } , \theta _ { V } )$ are updated after each
340
+
341
+ $$
342
+ \begin{array} { l } { { \displaystyle \theta _ { \pi } \theta _ { \pi } + \alpha _ { \pi } \sum _ { i = 0 } ^ { k } \nabla _ { \theta _ { \pi } } \log ( \pi ( a _ { t + i } | x _ { t + i } ; \theta _ { \pi } ) ) [ \hat { Q } _ { i } - V ( x _ { t + i } ; \theta _ { V } ) ] } , } \\ { { \displaystyle \theta _ { V } \theta _ { V } - \alpha _ { V } \sum _ { i = 0 } ^ { k } \nabla _ { \theta _ { V } } [ \hat { Q } _ { i } - V ( x _ { t + i } ; \theta _ { V } ) ] ^ { 2 } , } } \end{array}
343
+ $$
344
+
345
+ where $( \alpha _ { \pi } , \alpha _ { V } )$ are hyper-parameters. As mentioned previously, in the original A3C algorithm, it is recommended to add an entropy term $\begin{array} { r } { \beta \sum _ { i = 0 } ^ { k } \nabla _ { \theta _ { \pi } } H ( \pi ( \cdot | x _ { t + i } ; \theta _ { \pi } ) ) } \end{array}$ to the policy update, where $\begin{array} { r } { H ( \pi ( \cdot | x _ { t + i } ; \theta _ { \pi } ) ) = - \beta \sum _ { a \in A } \pi ( a | x _ { t + i } ; \theta _ { \pi } ) \overset { \longleftrightarrow } { \log } ( \pi ( a | x _ { t + i } ; \theta _ { \pi } ) ) } \end{array}$ . Indeed, this term encourages exploration as it favours policies which are uniform over actions. When replacing the linear layers in the value and policy heads by noisy layers (the parameters of the noisy network are now $\zeta _ { \pi }$ and $\zeta _ { V }$ ), we obtain the following estimation of the return via a roll-out of size $k$ :
346
+
347
+ $$
348
+ \hat { Q } _ { i } = \sum _ { j = i } ^ { k - 1 } \gamma ^ { j - i } r _ { t + j } + \gamma ^ { k - i } V ( x _ { t + k } ; \zeta _ { V } , \varepsilon _ { i } ) .
349
+ $$
350
+
351
+ We would like $\hat { Q } _ { i }$ to be a consistent estimate of the return of the current policy. To do so, we should force $\forall i , \varepsilon _ { i } = \varepsilon$ . As A3C is an on-policy algorithm, this involves fixing the noise of the network for the whole roll-out so that the policy produced by the network is also fixed. Hence, each update of the parameters $( \zeta _ { \pi } , \zeta _ { V } )$ is done after each roll-out with the noise of the whole network held fixed for the duration of the roll-out:
352
+
353
+ $$
354
+ \begin{array} { l } { { \zeta _ { \pi } \zeta _ { \pi } + \alpha _ { \pi } \displaystyle \sum _ { i = 0 } ^ { k } \nabla _ { \zeta _ { \pi } } \log ( \pi ( a _ { t + i } | x _ { t + i } ; \zeta _ { \pi } , \varepsilon ) ) [ \hat { Q } _ { i } - V ( x _ { t + i } ; \zeta _ { V } , \varepsilon ) ] , } } \\ { { \zeta _ { V } \zeta _ { V } - \alpha _ { V } \displaystyle \sum _ { i = 0 } ^ { k } \nabla _ { \zeta _ { V } } [ \hat { Q } _ { i } - V ( x _ { t + i } ; \zeta _ { V } , \varepsilon ) ] ^ { 2 } . } } \end{array}
355
+ $$
356
+
357
+ # B NOISY LINEAR LAYER
358
+
359
+ In this Appendix we provide a graphical representation of noisy layer.
360
+
361
+ ![](images/b70a3d226cd97ad825e8a231ab55d9475756027b821c58c9416e952334960955.jpg)
362
+ Figure 4: Graphical representation of a noisy linear layer. The parameters $\mu ^ { w }$ , $\mu ^ { b }$ , $\sigma ^ { w }$ and $\sigma ^ { b }$ are the learnables of the network whereas $\varepsilon ^ { w }$ and $\dot { \varepsilon } ^ { b }$ are noise variables which can be chosen in factorised or non-factorised fashion. The noisy layer functions similarly to the standard fully connected linear layer. The main difference is that in the noisy layer both the weights vector and the bias is perturbed by some parametric zero-mean noise, that is, the noisy weights and the noisy bias can be expressed as $w = \mu ^ { w } + \sigma ^ { w } \odot \varepsilon ^ { w }$ and $b = \mu ^ { b } + \sigma ^ { b } \odot \varepsilon ^ { b }$ , respectively. The output of the noisy layer is then simply obtained as $y = w x + b$ .
363
+
364
+ # C ALGORITHMS
365
+
366
+ C.1 NOISYNET-DQN AND NOISYNET-DUELING
367
+
368
+ # Algorithm 1: NoisyNet-DQN / NoisyNet-Dueling
369
+
370
+ Input :Env Environment; $\varepsilon$ set of random variables of the network
371
+ Input :DUELING Boolean; "true" for NoisyNet-Dueling and "false" for NoisyNet-DQN
372
+ Input : $B$ empty replay buffer; $\zeta$ initial network parameters; $\zeta ^ { - }$ initial target network parameters
373
+ Input : $N _ { B }$ replay buffer size; $N _ { T }$ training batch size; $N ^ { - }$ target network replacement frequency
374
+ Output : $Q ( \cdot , \varepsilon ; \zeta )$ action-value function
375
+
376
+ 1 for episode $e \in \{ 1 , \ldots , M \}$ do
377
+
378
+ 2 Initialise state sequence $x _ { 0 } \sim E n v$ 3 for $t \in \{ 1 , \ldots \}$ do $/ \star l [ - 1 ]$ is the last element of the list l \*/ 4 Set $x x _ { 0 }$ 5 Sample a noisy network $\xi \sim \varepsilon$ 6 Select an action $a \gets \operatorname { a r g m a x } _ { b \in A } Q ( x , b , \xi ; \zeta )$ 7 Sample next state $y \sim P ( \cdot | x , a )$ , receive reward $r \gets R ( x , a )$ and set $x _ { 0 } \gets y$ 8 Add transition $( x , a , r , y )$ to the replay buffer $B [ - 1 ] ( x , a , r , y )$ 9 if $| B | > N _ { B }$ then 10 Delete oldest transition from $B$ 11 end $/ \star \_ D$ is a distribution over the replay, it can be uniform or implementing prioritised replay \*/ 12 Sample a minibatch of $N _ { T }$ transitions $( ( x _ { j } , a _ { j } , r _ { j } , y _ { j } ) \sim D ) _ { j = 1 } ^ { N _ { T } }$ Construction of the target values. \*/ 13 Sample the noisy variable for the online network $\xi \sim \varepsilon$ 14 Sample the noisy variables for the target network $\xi ^ { \prime } \sim \varepsilon$ 15 if DUELING then 16 Sample the noisy variables for the action selection network $\xi ^ { \prime \prime } \sim \varepsilon$ 17 for $j \in \bar { \left\{ 1 , \dots , N _ { T } \right\} }$ do 18 if $y _ { j }$ is a terminal state then 19 ${ \widehat { Q } } \gets r _ { j }$ 20 if DUELING then 21 $\begin{array} { l } { { b ^ { * } ( y _ { j } ) = \arg \operatorname* { m a x } _ { b \in \cal { A } } Q ( y _ { j } , b , \xi ^ { \prime \prime } ; \zeta ) } } \\ { { \widehat { Q } r _ { j } + \gamma Q ( y _ { j } , b ^ { * } ( y _ { j } ) , \xi ^ { \prime } ; \zeta ^ { - } ) } } \end{array}$ 22 23 else 24 $\begin{array} { r } { \widehat { Q } r _ { j } + \gamma \operatorname* { m a x } _ { b \in A } Q ( y _ { j } , b , \xi ^ { \prime } ; \zeta ^ { - } ) } \end{array}$ 25 Do a gradient step with loss $( \widehat { Q } - Q ( x _ { j } , a _ { j } , \xi ; \zeta ) ) ^ { 2 }$ 26 end 27 if $t \equiv 0$ (mod $N ^ { - }$ ) then 28 Update the target network: $\zeta ^ { - } \zeta$ 29 end 30 end 31 end
379
+
380
+ # C.2 NOISYNET-A3C
381
+
382
+ Input :Environment $E n v$ , Global shared parameters $( \zeta _ { \pi } , \zeta _ { V } )$ , global shared counter $T$ and maximal time Tmax. Input :Thread-specific parameters $\left( \zeta _ { \pi } ^ { \prime } , \zeta _ { V } ^ { \prime } \right)$ , Set of random variables $\varepsilon$ , thread-specific counter $t$ and roll-out size $t _ { m a x }$ . Output : $\pi ( \cdot ; \zeta _ { \pi } , \varepsilon )$ the policy and $V ( \cdot ; \zeta _ { V } , \varepsilon )$ the value. 1 Initial thread counter $t \gets 1$ 2 repeat 3 Reset cumulative gradients: $d \zeta _ { \pi } \gets 0$ and $d \zeta _ { V } \gets 0$ . 4 Synchronise thread-specific parameters: $\zeta _ { \pi } ^ { \prime } \gets \zeta _ { \pi }$ and $\zeta _ { V } ^ { \prime } \zeta _ { V }$ . 5 counter $\gets 0$ . 6 Get state $x _ { t }$ from $E n v$ 7 Choice of the noise: $\xi \sim \varepsilon$ $\mathbf { \nabla } / \star \mathbf { \nabla } r$ is a list of rewards \*/ 8 $r \gets [ ]$ $\mathbf { \nabla } / \star \mathbf { \nabla } a$ is a list of actions \*/ 9 $a \gets [ ]$ $/ \star x$ is a list of states \*/ 10 $x \gets [ ]$ and $x [ 0 ] x _ { t }$ 11 repeat 12 Policy choice: $a _ { t } \sim \pi ( \cdot | x _ { t } ; \zeta _ { \pi } ^ { \prime } ; \xi )$ 13 $a [ - 1 ] a _ { t }$ 14 Receive reward $r _ { t }$ and new state $x _ { t + 1 }$ 15 $r [ - 1 ] r _ { t }$ and $x [ - 1 ] x _ { t + 1 }$ 16 $t \gets t + 1$ and $T \gets T + 1$ 17 $c o u n t e r = c o u n t e r + 1$ 18 until $x _ { t }$ terminal or counter $= = t _ { m a x } + 1$ 19 if $x _ { t }$ is a terminal state then 20 $\mid \mathrm { ~ \boldsymbol ~ Q ~ } = 0$ 21 else 22 $Q = V ( x _ { t } ; \zeta _ { V } ^ { \prime } , \xi )$ 23 for $i \in \{ c o u n t e r - 1 , \ldots , 0 \}$ do 24 Update $Q$ : $Q r [ i ] + \gamma Q$ . 25 Accumulate policy-gradient: $d \zeta _ { \pi } \gets d \zeta _ { \pi } + \nabla _ { \zeta _ { \pi } ^ { \prime } } \log ( \pi ( a [ i ] | x [ i ] ; \zeta _ { \pi } ^ { \prime } , \xi ) ) [ Q - V ( x [ i ] ; \zeta _ { V } ^ { \prime } , \xi ) ] .$ 26 Accumulate value-gradient: $d \zeta _ { V } \gets d \zeta _ { V } + \nabla _ { \zeta _ { V } ^ { \prime } } [ Q - V ( x [ i ] ; \zeta _ { V } ^ { \prime } , \xi ) ] ^ { 2 }$ . 27 end 28 Perform asynchronous update of $\zeta _ { \pi } \colon \zeta _ { \pi } \gets \zeta _ { \pi } + \alpha _ { \pi } d \zeta _ { \pi }$ 29 Perform asynchronous update of $\zeta _ { V }$ : $\zeta _ { V } \gets \zeta _ { V } - \alpha _ { V } d \zeta _ { V }$ 30 until $T > T _ { m a x }$
383
+
384
+ # D COMPARISON BETWEEN NOISYNET-A3C (FACTORISED AND NON-FACTORISED NOISE) AND A3C
385
+
386
+ ![](images/c1f0a81c99291ae78a48479af58b8e667b7a761d1edbd74439a066d0e221ddbb.jpg)
387
+ Figure 5: Comparison of the learning curves of factorised and non-factorised NoisyNet-A3C versus the baseline according to the median human normalised score.
388
+
389
+ <table><tr><td></td><td colspan="2">Baseline</td><td colspan="2">NoisyNet</td><td rowspan="2">Improvement (On median)</td></tr><tr><td></td><td>Mean</td><td>Median</td><td>Mean</td><td>Median</td></tr><tr><td>DQN</td><td>319</td><td>83</td><td>379</td><td>123</td><td>48%</td></tr><tr><td>Dueling</td><td>524</td><td>132</td><td>633</td><td>172</td><td>30%</td></tr><tr><td>A3C</td><td>293</td><td>80</td><td>347</td><td>94</td><td>18%</td></tr><tr><td>A3C (factorised)</td><td>293</td><td>80</td><td>276</td><td>99</td><td>24 %</td></tr></table>
390
+
391
+ Table 2: Comparison between the baseline DQN, Dueling and A3C and their NoisyNet version in terms of median and mean human-normalised scores defined in Eq. (18). In the case of A3C we inculde both factorised and non-factorised variant of the algorithm. We report on the last column the percentage improvement on the baseline in terms of median human-normalised score.
392
+
393
+ # E LEARNING CURVES AND RAW SCORES
394
+
395
+ Here we directly compare the performance of DQN, Dueling DQN and A3C and their NoisyNet counterpart by presenting the maximal score in each of the 57 Atari games (Table 3), averaged over three seeds. In Figures 6-8 we show the respective learning curves.
396
+ Table 3: Raw scores across all games with random starts.
397
+
398
+ <table><tr><td>Games</td><td>Human</td><td>Random</td><td>DQN</td><td>NoisyNet-DQN</td><td>A3C</td><td>NoisyNet-A3C</td><td>Dueling</td><td>NoisyNet-Dueling</td></tr><tr><td>alien</td><td>7128</td><td>228</td><td>2404±242</td><td>2403±78</td><td>2027±92</td><td>1899±111</td><td>6163±1077</td><td>5778±2189</td></tr><tr><td>amidar</td><td>1720</td><td>6</td><td>924±159</td><td>1610 ± 228</td><td>904±125</td><td>491±485</td><td>2296±154</td><td>3537±521</td></tr><tr><td>assault</td><td>742</td><td>222</td><td>3595±169</td><td>5510±483</td><td>2879±293</td><td>3060 ±101</td><td>8010 ±381</td><td>11231± 503</td></tr><tr><td>asterix</td><td>8503</td><td>210</td><td>6253±154</td><td>14328± 2859</td><td>6822 ±181</td><td>32478±2567</td><td>11170 ± 5355</td><td>28350± 607</td></tr><tr><td>asteroids</td><td>47389</td><td>719</td><td>1824±83</td><td>3455±1054</td><td>2544±523</td><td>4541 ± 311</td><td>2220±91</td><td>86700 ± 80459</td></tr><tr><td>atlantis</td><td>29028</td><td>12580</td><td>876000 ± 15013</td><td>923733 ± 25798</td><td>422700 ± 4759</td><td>465700 ± 4224</td><td>902742 ± 17087</td><td>972175 ± 31961</td></tr><tr><td>bank heist</td><td>753</td><td>14</td><td>455±25</td><td>1068 ± 277</td><td>1296±20</td><td>1033±463</td><td>1428±37</td><td>1318±37</td></tr><tr><td>battle zone</td><td>37188</td><td>2360</td><td>28981 ± 1497</td><td>36786±2892</td><td>16411 ±1283</td><td>17871 ± 5007</td><td>40481 ± 2161</td><td>52262 ±1480</td></tr><tr><td>beam rider</td><td>16926</td><td>364</td><td>10564 ± 613</td><td>20793±284</td><td>9214±608</td><td>11237 ± 1582</td><td>16298 ± 1101</td><td>18501 ± 662</td></tr><tr><td>berzerk</td><td>2630</td><td>124</td><td>634±16</td><td>905±21</td><td>1022 ±151</td><td>1235±259</td><td>1122 ±35</td><td>1896 ± 604</td></tr><tr><td>bowling</td><td>161</td><td>23</td><td>62±4</td><td>71±26</td><td>37±2</td><td>42 ±11</td><td>72±6</td><td>68±6</td></tr><tr><td>boxing</td><td>12</td><td>0</td><td>87±1</td><td>89±4</td><td>91±1</td><td>100±0</td><td>99±0</td><td>100±0</td></tr><tr><td>breakout</td><td>30</td><td>2</td><td>396±13</td><td>516±26</td><td>496±56</td><td>374±27</td><td>200±21</td><td>263±20</td></tr><tr><td>centipede</td><td>12017</td><td>2091</td><td>6440 ± 1194</td><td>4269 ± 261</td><td>5350±432</td><td>8282 ±685</td><td>4166± 23</td><td>7596±1134</td></tr><tr><td>chopper command</td><td>7388</td><td>811</td><td>7271±473</td><td>8893 ±871</td><td>5285±159</td><td>7561±1190</td><td>7388 ±1024</td><td>11477 ±1299</td></tr><tr><td>crazy climber</td><td>35829</td><td>10780</td><td>116480 ± 896</td><td>118305 ± 7796</td><td>134783± 5495</td><td>139950 ± 18190</td><td>163335±2460</td><td>171171 ± 2095</td></tr><tr><td>defender</td><td>18689</td><td>2874</td><td>18303 ± 2611</td><td>20525± 3114</td><td>52917±3355</td><td>55492± 3844</td><td>37275±1572</td><td>42253±2142</td></tr><tr><td>demon attack</td><td>1971</td><td>152</td><td>12696±214</td><td>36150 ± 4646</td><td>37085±803</td><td>37880±2093</td><td>61033 ± 9707</td><td>69311 ± 26289</td></tr><tr><td>double dunk</td><td>-16</td><td>-19</td><td>-6±1</td><td>1±0</td><td>3±1</td><td>3±1</td><td>17±7</td><td>1±0</td></tr><tr><td>enduro</td><td>860</td><td>0</td><td>835±56</td><td>1240±83</td><td>0±0</td><td>300±424</td><td>2064±81</td><td>2013 ±219</td></tr><tr><td>fishing derby</td><td>-39</td><td>-92</td><td>4±4</td><td>11±2</td><td>-7±30</td><td>-38±39</td><td>35±5</td><td>57±2</td></tr><tr><td>freeway</td><td>30</td><td>0</td><td>31±0</td><td>32±0</td><td>0±0</td><td>18±13</td><td>34±0</td><td>34±0</td></tr><tr><td>frostbite</td><td>4335</td><td>65</td><td>1000±258</td><td>753 ±101</td><td>288±20</td><td>261±0</td><td>2807 ±1457</td><td>2923 ±1519</td></tr><tr><td>gopher</td><td>2412</td><td>258</td><td>11825 ± 1444</td><td>14574 ± 1837</td><td>7992 ± 672</td><td>12439 ± 16229</td><td>27313 ± 2629</td><td>38909± 2229</td></tr><tr><td>gravitar</td><td>3351</td><td>173</td><td>366±26</td><td>447±94</td><td>379±31</td><td>314±25</td><td>1682 ±170</td><td>2209±99</td></tr><tr><td>hero</td><td>30826</td><td>1027</td><td>15176 ± 3870</td><td>6246±2092</td><td>30791± 246</td><td>8471±4332</td><td>35895±1035</td><td>31533±4970</td></tr><tr><td>ice hockey</td><td>1</td><td>-11</td><td>-2±0</td><td>-3±0</td><td>-2±0</td><td>-3±1</td><td>-0±0</td><td>3±1</td></tr><tr><td>jamesbond</td><td>303</td><td>29</td><td>909±223</td><td>1235± 421</td><td>509±34</td><td>188 ±103</td><td>1667 ±134</td><td>4682 ± 2281</td></tr><tr><td>kangaroo</td><td>3035</td><td>52</td><td>8166 ± 1512</td><td>10944± 4149</td><td>1166 ±76</td><td>1604 ±278</td><td>14847±29</td><td>15227 ± 243</td></tr><tr><td>krull</td><td>2666</td><td>1598</td><td>8343±79</td><td>8805±313</td><td>9422 ±980</td><td>22849±12175</td><td>10733±65</td><td>10754 ± 181</td></tr><tr><td>kung fu master</td><td>22736</td><td>258</td><td>30444 ±1673</td><td>36310±5093</td><td>37422 ± 2202</td><td>55790± 23886</td><td>30316±2397</td><td>41672 ± 1668</td></tr><tr><td>montezuma revenge</td><td>4753</td><td>0</td><td>2±3</td><td>3±4</td><td>14 ±12</td><td>4±3</td><td>0±0</td><td>57±15</td></tr><tr><td>ms pacman</td><td>6952</td><td>307</td><td>2674±43</td><td>2722 ±148</td><td>2436±249</td><td>3401 ±761</td><td>3650±445</td><td>5546±367</td></tr><tr><td>name this game</td><td>8049</td><td>2292</td><td>8179 ± 551</td><td>8181±742</td><td>7168± 224</td><td>8798±1847</td><td>9919 ±38</td><td>12211 ± 251</td></tr><tr><td>phoenix</td><td>7243</td><td>761</td><td>9704 ± 2907</td><td>16028 ± 3317</td><td>9476±569</td><td>50338± 30396</td><td>8215±403</td><td>10379 ± 547</td></tr><tr><td>pitfall</td><td>6464</td><td>-229</td><td>0±0</td><td>0±0</td><td>0±0</td><td>0±0</td><td>0±0</td><td>0±0</td></tr><tr><td>pong</td><td>15</td><td>-21</td><td>20±0</td><td>21±0</td><td>7±19</td><td>12 ± 11</td><td>21±0</td><td>21±0</td></tr><tr><td>private eye</td><td>69571</td><td>25</td><td>2361±781</td><td>3712 ± 161</td><td>3781 ± 2994</td><td>100±0</td><td>227±138</td><td>279 ±109</td></tr><tr><td>qbert</td><td>13455</td><td>164</td><td>11241 ± 1579</td><td>15545± 462</td><td>18586± 574</td><td>17896 ± 1522</td><td>19819 ± 2640</td><td>27121± 422</td></tr><tr><td>riverraid</td><td>17118</td><td>1338</td><td>7241 ±140</td><td>9425±705</td><td>8135±483</td><td>7878±162</td><td>18405±93</td><td>23134±1434</td></tr><tr><td>road runner</td><td>7845</td><td>12</td><td>37910 ± 1778</td><td>45993± 2709</td><td>45315±1837</td><td>30454±13309</td><td>64051 ± 1106</td><td>234352 ±132671</td></tr><tr><td>robotank</td><td>12</td><td>2</td><td>55±1</td><td>51±5</td><td>6±0</td><td>36±3</td><td>63±1</td><td>64±1</td></tr><tr><td>seaquest</td><td>42055</td><td>68</td><td>4163±425</td><td>2282±361</td><td>1744±0</td><td>943± 41</td><td>19595 ± 1493</td><td>16754 ± 6619</td></tr><tr><td>skiing</td><td>-4337</td><td>-17098 1263</td><td>-12630± 202 4055±842</td><td>-14763 ± 706 6088 ± 1791</td><td>-12972 ± 2846 12380 ± 519</td><td>-15970 ± 9887 10427 ± 3878</td><td>-7989 ±1349 3423±152</td><td>-7550 ±451 6522±750</td></tr><tr><td>solaris space invaders</td><td>12327 1669</td></table>
399
+
400
+ ![](images/6dc44e0375370dd767c5132066e9fefe60e4ea11ef83a24c8080a304d861926c.jpg)
401
+ Figure 6: Training curves for all Atari games comparing DQN and NoisyNet-DQN.
402
+
403
+ ![](images/0fbae35b0515600598535510a646f79b1428b22f14c18bc4db668379f4b93e65.jpg)
404
+ Figure 7: Training curves for all Atari games comparing Duelling and NoisyNet-Dueling.
405
+
406
+ ![](images/6f151046db4ae4e8405824f408a132d27b98762db382818789fbaf61f357b673.jpg)
407
+ Figure 8: Training curves for all Atari games comparing A3C and NoisyNet-A3C.
md/train/tkAtoZkcUnm/tkAtoZkcUnm.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/tyd9yxioXgO/tyd9yxioXgO.md ADDED
@@ -0,0 +1,400 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # COMPOSITIONAL VIDEO SYNTHESIS WITH ACTIONGRAPHS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ ![](images/dd57d5a4c7773321aa0d76a629ee349f047bb4eb3033c54e96c33faa0fc1e7a7.jpg)
6
+ Figure 1: We focus on video synthesis from actions and propose a new task called Action Graph to Video. To represent input actions, we use a graph structure called Action Graph, and together with the first frame and first scene layout, our goal is to synthesize a video that matches the input actions. For illustration, we include above a (partial) example. Our model outperforms various baselines and can generalize to previously unseen compositions of actions.
7
+
8
+ # ABSTRACT
9
+
10
+ Videos of actions are complex signals, containing rich compositional structure. Current video generation models are limited in their ability to generate such videos. To address this challenge, we introduce a generative model (AG2Vid) that can be conditioned on an Action Graph, a structure that naturally represents the dynamics of actions and interactions between objects. Our AG2Vid model disentangles appearance and position features, allowing for more accurate generation. AG2Vid is evaluated on the CATER and Something-Something datasets and outperforms other baselines. Finally, we show how Action Graphs can be used for generating novel compositions of actions.
11
+
12
+ # 1 INTRODUCTION
13
+
14
+ Learning to generate visual content is a fundamental task in computer vision, with numerous applications from sim-to-real training of autonomous agents, to creating visuals for games and movies. While the quality of generating still images has leaped forward recently (Karras et al., 2020; Brock et al., 2019), generating videos is much harder. Generating actions and interactions is perhaps the most challenging aspect of conditional video generation. Actions create long-range spatio-temporal dependencies between people and the objects they interact with. For example, when a player passes a ball, the entire movement sequence of all entities (thrower, ball, receiver) must be coordinated and carefully timed. The current paper focuses on this difficult obstacle, the task of generating coordinated and timed actions, as an important step towards generating videos of complex scenes.
15
+
16
+ Current approaches for conditional video generation are not well suited to condition the generation on actions. First, future video prediction (Ye et al., 2019; Watters et al., 2017), generates future frames based on an initial input frame, but a first frame cannot be used to predict coordinated actions. Second, in video-to-video , the goal is to translate a sequence of semantic masks into an output video.
17
+
18
+ However, segmentation maps contain only class information, and thus do not explicitly capture the action information. As Wang et al. (2018a) notes, this is a limitation that leads to systematic mistakes, such as in the case of car turns. Finally, text-to-video (Li et al., 2018; Gupta et al., 2018) is potentially useful for generating videos of actions because language can describe complex actions. However, in applications that require a precise description of the scene, language is not ideal due to ambiguities (MacDonald et al., 1994) or subjectivity of the user (Wiebe et al., 2004). Hence, we address this problem with a more structural approach.
19
+
20
+ To provide a better way to condition on actions, we introduce a formalism we call an “Action Graph” (AG), propose a new task of “Action Graph to Video” (AG2Vid), and present a model for this task. An AG is a graph structure aimed at representing coordinated and timed actions. Its nodes represent objects, and edges represent actions annotated with their start and end time (Fig. 1). We argue that AGs are an intuitive representation for describing timed actions and would be a natural way to provide precise inputs to generative models. A key advantage of AGs is their ability to describe the dynamics of object actions precisely in a scene.
21
+
22
+ In our AG2Vid task, the input is the initial frame of the video and an AG. Instead of generating the pixels directly, our AG2Vid model uses three levels of abstraction. First, we propose an action scheduling mechanism we call “Clocked edges” that tracks the progress of actions in different timesteps. Second, based on this, a graph neural network (Kipf & Welling, 2016) operates on the AGs and predicts a sequence of scene layouts, and finally, pixels are generated conditioned on the predicted layouts. We apply this AG2Vid model to the CATER (Girdhar & Ramanan, 2020) and Something-Something (Goyal et al., 2017) datasets and show that this approach results in realistic videos that are semantically compliant with the input AG. To further demonstrate the expressiveness of AG representation and the effectiveness of the AG2Vid model, we test how it generalizes to previously unseen compositions of the learned actions. Human raters then confirm the correctness of the generated actions.1
23
+
24
+ Our contributions are as follows: 1) Introducing the formalism of Action Graphs (AG) and proposing a new video synthesis task. 2) Presenting a novel action-graph-to-video (AG2Vid) model for this task. 3) Using the AG and AG2Vid model, we show this approach generalizes to the generation of novel compositions of the learned actions.
25
+
26
+ # 2 RELATED WORK
27
+
28
+ Video generation is challenging because videos contain long range dependencies. Recent generation approaches (Vondrick et al., 2016; Kumar et al., 2020; Denton & Fergus, 2018; Lee et al., 2018; Babaeizadeh et al., 2018; Villegas et al., 2019) extended the framework of unconditional image generation to video, based on a latent representation. For example, MoCoGAN (Tulyakov et al., 2018) disentangles the latent space representations of motion and content to generate a sequence of frames using RNNs; TGAN (Saito et al., 2017) generates each frame in a video separately while also having a temporal generator to model dynamics across the frames. Here, we tackle a different problem by aiming to generate videos that comply with AGs.
29
+
30
+ Conditional video generation has attracted considerable interest recently, with focus on two main tasks: video prediction (Mathieu et al., 2015; Battaglia et al., 2016; Walker et al., 2016; Watters et al., 2017; Kipf et al., 2018; Ye et al., 2019) and video-to-video translation (Wang et al., 2019; Chan et al., 2019; Siarohin et al., 2019; Kim et al., 2019; Mallya et al., 2020). In prediction, the goal is to generate future video frames conditioned on few initial frames. For example, it was proposed to train predictors with GANs (Goodfellow et al., 2014) to predict future pixels (Mathieu et al., 2015). However, directly predicting pixels is challenging (Walker et al., 2016). Instead of pixels, researchers explored object-centric graphs and perform prediction on these (Battaglia et al., 2016; Luc et al., 2018; Ye et al., 2019). While inspired by object-centric representations, our method is different from these works as our generation is goal-oriented, guided by an AG. The video-to-video translation task was proposed by Wang et al. (2018a), where a natural video was generated from frame-wise semantic segmentation annotations. However, densely labeling pixels for each frame is expensive, and might not even be necessary. Motivated by this, researchers have sought to perform generation conditioned on more accessible signals including audio or text (Song et al., 2018; Fried et al., 2019; Ginosar et al., 2019). Here, we propose to synthesize videos conditioned on a novel AG, which is easy to obtain compared to semantic segmentation and is a more structured representation compared to natural audio and text.
31
+
32
+ ![](images/c5ae1e2431da7cf7874221a1611a5ee2b78ad3ce7b902e2ded628d35798e31d5.jpg)
33
+ Figure 2: Example of a partial Action Graph execution schedule in different time-steps.
34
+
35
+ A recent method, HOI-GAN (HG) (Nawhal et al., 2020b), was proposed for the generation task of a single action and object. Specifically, this work addresses the zero-shot setting, and the model is tested on action and object compositions which are first presented at test time. Our focus is on generation of multiple simultaneous actions over time, performed by multiple objects. Our approach directly addresses this challenge via the AG representation and the notion of clocked edges.
36
+
37
+ Various methods have been proposed to generate videos based on input text (Marwah et al., 2017; Pan et al., 2017; Li et al., 2018). Most recent methods typically used very short captions which do not contain complex descriptions of actions. For example, (Li et al., 2018) used video-caption pairs from YouTube, where typical captions are ”playing hockey” or ”flying a kite”. Gupta et al. (2018) proposed the Flinstones animated dataset and introduced the CRAFT model for text-to-video generation. While the CRAFT model relies on text-to-video retrieval, our approach works in an end-to-end manner and aims to accurately synthesize the given input actions.
38
+
39
+ Scene Graphs (SG) (Johnson et al., 2015; 2018) are a structured representation that models scenes, where objects are nodes and relations are edges. SGs have been widely used in various tasks including image retrieval (Johnson et al., 2015; Schuster et al., 2015), relationship modeling (Krishna et al., 2018; Schroeder et al., 2019; Raboh et al., 2020), SG prediction (Xu et al., 2017; Newell & Deng, 2017; Zellers et al., 2018; Herzig et al., 2018), and image captioning (Xu et al., 2019). Recently, SGs have been applied to image generation (Johnson et al., 2018; Deng et al., 2018; Herzig et al., 2020), where the goal is to generate a natural image corresponding to the input SG. More generally, spatio-temporal graphs have been explored in the field of action recognition (Jain et al., 2016; Sun et al., 2018; Wang & Gupta, 2018; Yan et al., 2018; Girdhar et al., 2019; Herzig et al., 2019; Materzynska et al., 2020). For example, a space-time region graph is proposed by (Wang & Gupta, 2018) where object regions are taken as nodes and a GCN (Kipf & Welling, 2016) is applied to perform reasoning across objects for classifying actions. Recently, it was also shown by (Ji et al., 2019; Yi et al., 2019; Girdhar & Ramanan, 2020) that a key obstacle in action recognition is the ability to capture the long-range dependencies and compositionality of actions. While inspired by these approaches, we focus on generating videos which is a very different challenge.
40
+
41
+ Recently, Ji et al. (2019) presented Action Genome, a new video dataset annotated by SGs. This dataset includes spatio-temporal SG annotations, where for each video, few individual frames were chosen and spatially annotated by SGs. Here, we use the Something-Something V2 (Goyal et al., 2017) dataset that is larger (200K vs. 10K videos) and more diverse since it includes basic human activities created by a large number of crowd workers. Finally, we propose the Action Graph representation, which we view as a temporal extension of SGs.
42
+
43
+ # 3 ACTION GRAPHS
44
+
45
+ Our goal in this work is to build a model for synthesizing videos that contain a specified set of actions. A key component in this effort is developing a semantic representation to describe the actions performed by different objects in the scene. Towards this end, we introduce a formalism we call Action Graph (AG). In an AG, nodes correspond to objects, and edges correspond to actions that these objects participate in. Objects and actions are annotated by semantic categories, and actions are also annotated by their start and end times.
46
+
47
+ ![](images/8730b7aa9c09154696b8ecd325362daadd8c364270ac0d6aede33c19a4549db4.jpg)
48
+ Figure 3: Our AG2Vid Model. The AG $A _ { t }$ describes the execution stage of each action at time $t$ . Together with the previous layout $\ell _ { t - 1 }$ , it is used to generate the next layout $\ell _ { t }$ which has object representations that are enriched with $A _ { t }$ actions information. Then, $\ell _ { t } , \ell _ { t - 1 } , v _ { t - 1 }$ are used to generate the next frame.
49
+
50
+ More formally, an AG is a tuple $( \mathcal { C } , \mathcal { A } , O , E )$ described as follows:
51
+
52
+ • An alphabet of object categories $\mathcal { C }$ . Categories can be compounded and include attributes. For example “Blue Cylinder” or “Large Box”.
53
+
54
+ • An alphabet of action categories $\mathcal { A }$ . For Example “Slide” and “Rotate”. Similarly, actions can contain attributes (e.g., rotation speed).
55
+
56
+ • Object nodes O: A set $O \in { \mathcal { C } } ^ { n }$ of $n$ objects.
57
+
58
+ • Action edges E: Actions are represented as labeled directed edges between object nodes. Each edge is annotated with an action category and with the time period during which the action is performed. Formally, each edge is of the form $( i , a , j , t _ { s } , t _ { e } )$ where $i , j \in \{ 1 , . . . , n \}$ are object instances, $a \in { \mathcal { A } }$ is an action and $t _ { s } , t _ { e } \in \mathbb { N }$ are action start and end time. Thus, this edge implies that object $i$ (which has category $o _ { i }$ ) performs an action $a$ over object $j$ , and that this action takes place between times $t _ { s }$ and $t _ { e }$ . We note that an AG edge can directly model actions over a single object and a pair of objects. For example, “Swap the positions of objects $i$ and $j$ between time 0 and $9 ^ { \ast }$ is an action over two objects corresponding to edge $( i , s w a p , j , 0 , 9 )$ . Some actions, such as “Rotate”, involve only one object and will therefore be specified as self-loops.
59
+
60
+ # 4 ACTION GRAPH TO VIDEO VIA CLOCKED EDGES
61
+
62
+ We now turn to the key challenge of this paper: transforming an AG into a video. Naturally, this transformation will be learned from data. The generation problem is defined as follows: we wish to build a generator $G$ that takes as input an AG and outputs a video. We will also allow conditioning on the first video frame and layout, so we can preserve the visual attributes of the given objects.2
63
+
64
+ There are multiple unique challenges in generating a video from an AG that cannot be addressed using current generation methods. First, each action in the graph unfolds over time, so the model needs to “keep track” of the progress of actions rather than just condition on previous frames as commonly done. Second, AGs may contain multiple concurrent actions and the generation process needs to combine them in a realistic way. Third, one has to design a training loss that captures the spatio-temporal video structure to ensure that the semantics of the AG is accurately captured.
65
+
66
+ Clocked Edges. As discussed above, we need a mechanism for monitoring the progress of action execution during the video. A natural approach is to keep a “clock” for each action, for keeping track of action progress as the video progresses. See Fig. 2 for an illustration. Formally, we keep a clocked version of the graph $A$ where each edge is augmented with a temporal state. Let $e =$ $( i , a , j , t _ { s } , t _ { e } ) \in E$ be an edge in the AG $A$ . We define the progress of $e$ at time $t$ to be $\begin{array} { r } { r = \frac { t - t _ { s } } { t _ { e } - t _ { s } } } \end{array}$ , and clip $r$ to $[ 0 , 1 ]$ . Thus, if $r = 0$ the action has not started yet, if $r \in ( 0 , 1 )$ it is currently being executed, and if $r = 1$ it has completed. We then create an augmented version of the edge $e$ at time $t$ given by $e _ { t } = ( i , a , j , t _ { s } , t _ { e } , r )$ . We define $A _ { t } = \{ e _ { t } | e \in A \}$ to be the AG at time $t$ . To summarize the above, we take the original graph $A$ and turn it into a sequence of AGs $A _ { 0 } , \ldots , A _ { T }$ , where $T$ is the last time-step. Each action edge in the graph now has its unique clock for its execution. This facilitates both a timely execution of actions and coordination between actions.
67
+
68
+ # 4.1 THE AG2VID MODEL
69
+
70
+ Next, we describe our proposed AG-to-video model (AG2Vid). Fig. 3 provides a high-level illustration of our model architecture. The rationale of our generation process is that first the AG is used to produce intermediate layouts, and then these layouts are used to produce frame pixels We let $\ell _ { t } \dot { = } \left( x _ { t } , y _ { t } , w _ { t } , h _ { t } , z _ { t } \right)$ denote the set of predicted layouts for all the $n$ objects in the video at time $t$ . The values $x _ { t } , y _ { t } , w _ { t } , h _ { t } \in [ 0 , 1 ] ^ { n }$ are the bounding box coordinates for all objects, and $z _ { t }$ is a descriptor vector for the object (later used for frame generation). Let $v _ { t }$ denote the generated frame at time $t$ , and $p ( v _ { 2 } , \ldots , v _ { T } , \ell _ { 2 } , \ldots \ell _ { T } | A , v _ { 1 } , \ell _ { 1 } )$ denote the generating distribution of the frames and layouts given the AG and the first frame $v _ { 1 }$ and scene layout $l _ { 1 }$ .
71
+
72
+ We assume that the generation of the frame and layout directly depends only on recent generated frames and layouts.3 Specifically, this corresponds to the following form for $p$ : $\begin{array} { r } { p ( v _ { 2 } , . . . , v _ { T } , \ell _ { 2 } , . . . , \ell _ { T } | A , v _ { 1 } , l _ { 1 } ) = \prod _ { t = 2 } ^ { T } p ( \ell _ { t } | A _ { t } , \ell _ { t - 1 } ) p ( v _ { t } | v _ { t - 1 } , \ell _ { t } , \ell _ { t - 1 } ) } \end{array}$ . We refer to the distribution $p ( l _ { t } | \cdot )$ as The Layout Generating Function $( L G F )$ and to $p ( v _ { t } | \cdot )$ as The Frame Generating Function $( F G F )$ . Next, we describe how we model these distributions as functions.
73
+
74
+ The Layout Generating Function (LGF). At time $t$ we want to use the previous layout $\ell _ { t - 1 }$ and current AG $A _ { t }$ to predict the current layout $\ell _ { t }$ . The rationale is that $A _ { t }$ captures the current state of the actions and can thus “propagate” $\ell _ { t - 1 }$ to the next layout. This prediction requires integrating information from different objects as well as the progress of the actions given by the edges of $A _ { t }$ . Thus, a natural architecture for this task is a Graph Convolutional Network (GCN) that operates on the graph $A _ { t }$ whose nodes are “enriched” with the layouts $\ell _ { t }$ . Formally, we construct a new graph of the same structure as $A _ { t }$ , with new features on nodes and edges. At the graph node corresponding to object $i$ the features are comprised of the previous object location defined in $\ell _ { t - 1 } ^ { i }$ and object class embedding. The features on the edges are the embedding of action $a$ and the progress of the action $r$ , taken from $( i , a , j , r )$ from $A _ { t }$ . Then, node and edge features are repeatedly re-estimated for $K$ steps using a GCN. The resulting activations of the ith object at timestep $t$ are $\boldsymbol { z } _ { t } ^ { i } \in \mathbb { R } ^ { D }$ which we use as the new object descriptor. An MLP is then applied to it to produce the new box coordinates, which together form the predicted layout $\ell _ { t }$ . For more details refer to Sec.1 in the Suppl.
75
+
76
+ The Frame Generating Function (FGF). After obtaining the layout $\ell _ { t }$ which contains updated objects representations $z _ { t }$ , we wish to use it along with $v _ { t - 1 }$ and $\ell _ { t - 1 }$ to predict the next frame. The idea is that $\ell _ { t } , \ell _ { t - 1 }$ characterize how objects should move, $z _ { t } , z _ { t - 1 }$ should capture the objectactions dynamics, and $v _ { t - 1 }$ shows their last physical appearance. Combining these information sources we should be able to generate the next frame accurately. As a first step, we construct a mask $m _ { t - 1 } , m _ { t } \in \mathbb { R } ^ { H \times W \times D }$ using the embedding and layout pairs. Then, we estimate the optical flow at time $t$ , denoted by $f _ { t }$ . We let $f _ { t } = F ( v _ { t - 1 } , m _ { t - 1 } , m _ { t } )$ . The idea is that given the previous frame and two consecutive layouts, we should be able to predict in which direction pixels in the image will move, namely predict the flow. The flow prediction network $F$ is similar to (Ilg et al., 2017), and it is trained using an auxiliary loss and does not require additional supervision (see section 4.2). Given the flow $f _ { t }$ and previous frame $v _ { t - 1 }$ a natural estimate of the next frame is to use a warping function (Zhou et al., 2016) $w _ { t } = W ( f _ { t } , v _ { t - 1 } )$ . Finally we fine-tune $w _ { t }$ via a network $S ( m _ { t } , w _ { t } )$ that provides an additive correction resulting in the final frame prediction: $v _ { t } = w _ { t } + S ( m _ { t } , w _ { t } )$ , where the $S$ network a SPADE generator (Park et al., 2019).
77
+
78
+ ![](images/114ee9dc2d804163aca6c406ce5e61cf003c699c8e4bd631667cec4bac04f20a.jpg)
79
+ Figure 4: Qualitative examples of generation on CATER and Something Something. AG2Vid generated videos of four and eight standard actions on CATER and Something Something, respectively. For CATER we also used AGs with multiple simultaneous actions, and the generated actions indeed correspond to those (verified manually). For more examples please refer to Figure 1 and 2 in the Supp. Click the image to play the video clip in a browser.
80
+
81
+ # 4.2 LOSSES AND TRAINING
82
+
83
+ We use ground truth frames $v _ { t } ^ { G T }$ and layouts $\ell _ { t } ^ { G T }$ for training,4 and use the following losses: Layout Prediction Loss $\mathcal { L } _ { \ell }$ . Defined as $\mathcal { L } _ { \ell } \overset { ^ { \cdot } } { = } \Vert \ell _ { t } - \ell _ { t } ^ { G T } \Vert _ { 1 }$ , the $L _ { 1 }$ loss between ground-truth bounding boxes $\ell _ { t } ^ { G T }$ and predicted boxes $\ell _ { t }$ . Here we ignore the object descriptor part of $\ell _ { t }$ .
84
+
85
+ Pixel Action Discriminator Loss $\mathcal { L } _ { A }$ . For the generated pixels $v _ { t }$ we employ a GAN loss that uses a discriminator between generated frames $v _ { t }$ and GT frames $v _ { t } ^ { G T }$ conditioned on $A _ { t }$ and $l _ { t }$ . Formally, let $D _ { A }$ be a discriminator with output in $( 0 , 1 )$ . First, a GCN is applied over $A _ { t }$ to obtain objects representations, which are then using together with the GT layout boxes to construct a scene layout. The layout and frames are then concatenated and fed into a multi-scale PatchGAN discriminator (Wang et al., 2018b). The loss is then the GAN loss (e.g., see Isola et al. (2017)):
86
+
87
+ $$
88
+ \mathcal { L } _ { A } = \operatorname* { m a x } _ { D _ { A } } \mathbb { E } _ { G T } \left[ \log D _ { A } ( A _ { t } , v _ { t } ^ { G T } , \ell _ { t } ^ { G T } ) \right] + \mathbb { E } _ { p } \left[ \log ( 1 - D _ { A } ( A _ { t } , v _ { t } , \ell _ { t } ^ { G T } ) ) \right]
89
+ $$
90
+
91
+ where $G T$ corresponds to sampling frames from the ground truth videos, and $p$ corresponds to sampling from the generated videos. Optimization of this loss is done in the standard way of alternating gradient ascent on $D _ { A }$ parameters and descent on generator parameters.
92
+
93
+ Flow Loss $\mathcal { L } _ { f }$ . The flow loss measures the error between the warps of the previous frame and the ground truth of the next frame $v _ { t } ^ { G T }$ $\begin{array} { r } { T \colon \mathcal { L } _ { f } = \frac { 1 } { T - 1 } \sum _ { t = 1 } ^ { T - 1 } \| w _ { t } - v _ { t } \| _ { 1 } } \end{array}$ , where $w _ { t } = W ( f _ { t } , v _ { t - 1 } )$ as defined in Section 4.1. This loss was proposed previously by (Zhou et al., 2016; Wang et al., 2018a). Perceptual and Feature Matching Loss $\mathcal { L } _ { P }$ . We use these losses as proposed in pix2pixHD (Wang et al., 2018b; Larsen et al., 2016) and other previous works.
94
+
95
+ The overall optimization problem is to minimize the weighted sum of the losses.
96
+
97
+ # 5 EXPERIMENTS AND RESULTS
98
+
99
+ We evaluate our AG2Vid model on two datasets: CATER and Something Something V2 (Smth). For each dataset, we learn an AG2Vid model with a given set of actions. We then evaluate the visual quality of the generated videos and measure how they semantically comply with the input actions. Last, we estimate the generalization of the AG2Vid model to novel composed actions.
100
+
101
+ Datasets. We use two datasets: (1) CATER (Girdhar & Ramanan, 2020) is a synthetic video dataset originally created for action recognition and reasoning. Each video contains multiple objects performing actions. The dataset contains bounding-box annotations for all objects, as well as labels of the actions. These include: “Rotate”, “Cover”, “Pick Place” and “Slide”. See Figure 7 for
102
+
103
+ ![](images/b726ed61f0449442e6e3b406cf5fcb42111734442a789c01e078ee9c872a0e8c.jpg)
104
+ Figure 5: Comparison of baselines methods. The top row are based on CATER videos, while the bottom row are based on Something Something. Click the images to play the video clips in a browser.
105
+ Figure 6: Composing unseen actions in SomethingSomething and CATER. For example, the “swap” action is composed by combining the “Pick-Place” and “Slide” actions on frames $1 - 1 0$ and their locations.
106
+
107
+ Table 1: Human evaluation of action generation with respect to Semantic Accuracy and Visual Quality. For each metric, raters selected the better of two generation methods. In the results $X X / Y Y$ means that AG2Vid was selected as better for $X \%$ of the presented pairs. Image resolution is $2 5 6 \times 2 5 6$ .
108
+
109
+ <table><tr><td rowspan="2">Methods AG2Vid /Baseline</td><td colspan="2">Semantic Accuracy</td><td colspan="2">Visual Quality</td></tr><tr><td>CATER</td><td>Smth</td><td>CATER</td><td>Smth</td></tr><tr><td>AG2Vid / CVP (Ye et al., 2019) AG2Vid /HG (Nawhal et al., 2020a)</td><td>85.7/14.3 -/1 68.8/31.2</td><td>90.6/9.4 84.6/15.4 84.4/15.6</td><td>76.2/23.8 -/1 68.8/31.2 96.9/3.1</td><td>93.8/6.2 88.5/11.5</td></tr></table>
110
+
111
+ qualitative examples. For “Pick Place” and “Slide” we include the action destination coordinates.
112
+ We use these actions to create action graphs for training and evaluation.
113
+
114
+ We employ the standard CATER training partition (3849 videos) and split the validation into $30 \%$ val (495 videos) and use the rest for testing (1156 videos). (2) Something Something V2 (Goyal et al., 2017) contains real world videos of humans performing basic actions. Here we use the eight most frequent actions (e.g., “Putting [something] on a surface” and “Covering [something] with [something]”). All videos contain up to three different objects, including the hand which is performing the action. We use the box annotations of the objects from Materzynska et al. (2020). See Sec. 3 in Suppl for the full list of actions.
115
+
116
+ Implementation details. The GCN model uses $K = 3$ hidden layers and an embedding layer of 128 units for each object and action. For optimization we use ADAM Kingma & Ba (2014) with $l r = 1 e - 4$ and $( \beta _ { 1 } , \dot { \beta } _ { 2 } ) = ( 0 . 5 , 0 . 9 9 )$ . Models were trained on an NVIDIA V100 GPU. For loss weights (see section 4.2) we use $\lambda _ { B } = \lambda _ { F } = \lambda _ { P } = 1 0$ and $\lambda _ { A } = 1$ . For training we use a batch size of 2. We use videos of 8 FPS and 6 FPS for CATER and Smth and evaluate on videos consisting of 16 frames which correspond to spans of 2.7 and 2 seconds accordingly.
117
+
118
+ Performance metrics. The AG2Vid outputs can be quantitatively evaluated as follows. a) Visual Quality: It is common in video generation to evaluate the visual quality of videos, regardless of the semantic content. To evaluate visual quality, we use the Learned Perceptual Image Patch Similarity (LPIPS) (Zhang et al., 2018) (lower is better) over predicted and GT videos. For the Smth dataset, since videos contain single actions (meaning the AG contains a single triplet), we can report the Inception Score (IS) Salimans et al. (2016) (higher is better) and Frechet Inception Distance ´ (FID) (Heusel et al., 2017) (lower is better) using a TSM (Lin et al., 2019) model, pretrained on Smth. We note that we cannot report FID and IS on CATER since it provides multiple activities simultaneously, and hence does not support a pretrained video classifier. Finally, we also evaluate relative visual quality of two models by asking human annotators to select the video with higher quality. b) Semantic Accuracy: The key goal of AG2Vid is to generate videos which contain specified actions. To evaluate this, we ask human annotators to select which of two video generation models provides a better depiction of actions in the real video. The protocol is similar to the visual quality evaluation above. We also evaluated action timing, see below.
119
+
120
+ Table 2: Visual quality metrics of conditional video-generation methods in CATER and Smth. All methods use resolution $2 5 6 \times 2 5 6$ except for HG, which only supports $6 4 \times 6 4$ .
121
+
122
+ <table><tr><td rowspan="2">Resolution</td><td rowspan="2">Methods</td><td>Inception ↑</td><td>FID↓</td><td colspan="2">LPIPS↓</td></tr><tr><td>Smth</td><td>Smth</td><td>CATER</td><td>Smth</td></tr><tr><td rowspan="3">64x64</td><td>Real Videos</td><td>3.9±0.12</td><td>0.0±0.0</td><td>0.0±0.0</td><td>0.0±0.0</td></tr><tr><td>HG (Nawhal et al., 2020a)</td><td>1.66 ± 0.03</td><td>35.18±3.6</td><td>1</td><td>0.33±0.08</td></tr><tr><td>AG2Vid (Ours)</td><td>2.51 ± 0.08</td><td>26.05 ± 0.73</td><td>0.04 ± 0.01</td><td>0.13 ± 0.01</td></tr><tr><td rowspan="5">256x256</td><td>Real Videos</td><td>7.58 ± 0.2</td><td>0.0±0.0</td><td>0.0±0.0</td><td>0.0±0.0</td></tr><tr><td>CVP (Ye et al., 2019)</td><td>1.92 ± 0.03</td><td>67.77 ± 1.43</td><td>0.24±0.04</td><td>0.55±0.08</td></tr><tr><td>RNN</td><td>1.99 ± 0.05</td><td>74.17 ± 1.54</td><td>0.14±0.05</td><td>0.26 ± 0.08</td></tr><tr><td>V2V (Wang et al., 2018a)</td><td>2.22 ± 0.07</td><td>67.51 ± 1.42</td><td>0.11±0.02</td><td>0.29 ± 0.09</td></tr><tr><td>AG2Vid (Ours)</td><td>3.02 ± 0.11</td><td>66.7 ± 1.29</td><td>0.07 ± 0.02</td><td>0.25 ± 0.08</td></tr><tr><td></td><td>AG2Vid, GTL (Ours)</td><td>3.52 ± 0.14</td><td>65.04 ± 1.25</td><td>0.06 ± 0.02</td><td>0.22 ± 0.09</td></tr></table>
123
+
124
+ Table 3: Ablation experiment for components of the frame generation. Losses are added one by one.
125
+
126
+ <table><tr><td>Loss</td><td>Inception ↑ Smth</td><td>FID↓ Smth</td><td>LPIPS↓</td><td>Smth</td></tr><tr><td rowspan="3">Flow + Perceptual + Action Disc.</td><td>1.59±0.02</td><td>107.26±1.46</td><td>CATER .14±.01</td><td>.70±.06</td></tr><tr><td>2.21 ±0.07</td><td>71.70 ± 1.46</td><td>.08±.03</td><td>.29±.07</td></tr><tr><td>3.02 ± 0.11</td><td>66.7 ± 1.29</td><td>.07± .02</td><td>.25±.08</td></tr></table>
127
+
128
+ Compared methods. Generating videos based on action-graphs is a new task. There are no off-theshelf models that can be used for direct evaluation with our approach, since no existing models take as input an action graph and output a video. To provide fair evaluation, we compare with two types of baselines. (1) First, existing baseline models that share some functionality with AG2Vid. (2) Second, variants of the AG2Vid model that shed light on its design choices. Each baseline serves to evaluate specific aspects of the model, as described next. Baselines: (1) HOI-GAN (HG) (Nawhal et al., 2020b) generates videos given a single action-object pair, an initial frame and a layout. It can be viewed as operating on a two-node action graph without timing information. we compare HG to AG2Vid on the Smth dataset because it contains exactly such action graphs. HG is not applicable to CATER data. (2) CVP (Ye et al., 2019) uses as input the first image and layout for future frame prediction without access to action information. CVP allows us to asses the visual quality of AG2Vid videos. However, it is not expected that CVP captures the semantics of the action-graph, unless the first frame and action are highly correlated (e.g., a hand at the top-left corner always moves downwards). (3) V2V (Wang et al., 2018a): This baseline uses a state-of-the-art Vid2Vid model based on (Wang et al., 2018a) to generate videos from ground-truth layout. Since it uses groundtruth layout it provides an upper bound on Vid2Vid performance for this task. We note that Vid2Vid cannot use the action graph, and thus it is not provided as input. AG2Vid variants: (4) RNN: This AG2Vid variant replaces the layout generation GCN with an RNN that processes the action graphs. The frame generation part is the same as AG2Vid. More details are provided in the Supp Sec.4.1. (5) AG2Vid, GTL: An AG2Vid model that uses ground truth layout at inference time. It allows us to test if using the GT layout for all frames improves overall AG2Vid video quality and semantics.
129
+
130
+ Layout Generation Ablations. We experiment with an RNN architecture as an alternative to the GCN implementation of the LGF. The motivation behind the RNN experiment is to compare the design choice of the GNN to a model that processes edges sequentially (RNN). This RNN has access to the same input and supervision to the GCN, namely, $\cdot$ and $A _ { t }$ , and the results from Table 4 confirm the advantage of GCN processing. For more details, see Sec. 4.1 in the Supplementary.
131
+
132
+ Loss Ablations. Table 3 reports ablations over the losses of FGF, confirming that the perceptual loss and actions discriminator losses improve the overall visual quality on CATER and Smth.
133
+
134
+ Semantic and Visual Quality. Fig. 4 shows sample videos generated by AG2Vid, and Fig. 5 shows comparison to generation by baselines. Table 1 shows the results of human evaluations for semantic and visual quality. It can be seen that AG2Vid is more semantically accurate and has better visual quality than the baselines, and it is comparable to AG2Vid,GTL. See Sec 4.4 in Suppl for additional evaluations of AG2Vid correctness of the generated actions. Table 2 evaluates visual quality using several metrics, with similar takeaways as in Table 1.
135
+
136
+ Action Timings. To evaluate the extent to which the AG2Vid model can control the timing of actions, we generated AGs of actions at different times and asked annotators to choose in which video the action is executed first. In $8 9 . 4 5 \%$ of the cases, the annotators confirmed the intended result. For more information see Sec. 4.3 in Suppl.
137
+
138
+ Composing New Actions. To evaluate the extent to which the AG2Vid model can generalize at test time to unseen actions, we manually defined four compositions of learned actions. As seen in Fig. 6, we are using learned atomic actions to generate new action combinations that did not appear in the training data (either by having the same object perform multiple objects at the same time, or multiple objects performing coordinated actions). For example, in CATER, we created the actions “swap” based on “pick-place” and “slide” and “huddle” based on “contain”. For Smth we composed the “push-left” and “move-down” to form the “left-down” action. For each generated video, raters were asked to choose the correct action class from a list of possible actions. The avg. class recall for CATER and Smth is 96.65 and 87.5 respectively, see the Supplementary for results by action.
139
+
140
+ # 6 DISCUSSION
141
+
142
+ We present a video-synthesis approach with a new Action Graph formalism, that describes how multiple objects interact in a scene over time. By using this formalism, we can synthesize complicated compositional videos and construct novel actions and action combinations. Although our approach outperforms previous methods, our model still fails in several situations. First, our model depends on the initial frame and layout. This could be potentially addressed by using an off-the-shelf image generation model. The formal AG representation is designed for describing complex semantic information in an easy-to-grasp way. The formalism could be further extended to handle other actions or their properties that were not present in today’s datasets. For instance, it may be desired to capture features of actions described by adverbs. This can be achieved by adding attributes over actions, which we leave for future work. Finally, in this work we present an hierarchical and modular pipeline of video synthesis: first actions are scheduled for a specific timestep, then the scene layout is predicted, and finally the future flow is predicted and refined. While this pipeline is fairly general, we believe these representations can be further adopted to different datasets. For example, pose representation can be added for videos of people.
143
+
144
+ # 7 BROADER IMPACT
145
+
146
+ The paper proposes a new framework for video generation, which focuses on coordinated multiple simple actions, operating on simple daily objects. We believe it has potential for improving the quality and versatility of video generation. Video synthesis technology has many practical implications, such as generating simulated data for training robots and improving content search in video. These clearly have positive societal impact. The current work does not focus on generating faces or human movement, and as a result, we estimate that the potential for negative societal and ethic aspects is low.
147
+
148
+ # REFERENCES
149
+
150
+ Oron Ashual and Lior Wolf. Specifying object attributes and relations in interactive scene generation. In Proceedings of the IEEE International Conference on Computer Vision, pp. 4561–4569, 2019.
151
+
152
+ Mohammad Babaeizadeh, Chelsea Finn, Dumitru Erhan, Roy H. Campbell, and Sergey Levine. Stochastic variational video prediction. In International Conference on Learning Representations, 2018.
153
+
154
+ 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.
155
+
156
+ Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale GAN training for high fidelity natural image synthesis. In International Conference on Learning Representations, 2019.
157
+
158
+ Caroline Chan, Shiry Ginosar, Tinghui Zhou, and Alexei A Efros. Everybody dance now. In Proceedings of the IEEE International Conference on Computer Vision, pp. 5933–5942, 2019.
159
+
160
+ Zhiwei Deng, Jiacheng Chen, Yifang Fu, and Greg Mori. Probabilistic neural programmed networks for scene generation. In Advances in Neural Information Processing Systems, pp. 4028–4038, 2018.
161
+
162
+ Emily Denton and Rob Fergus. Stochastic video generation with a learned prior. In ICML, pp. 1174–1183, 2018.
163
+
164
+ Ohad Fried, Ayush Tewari, Michael Zollhofer, Adam Finkelstein, Eli Shechtman, Dan B Gold- ¨ man, Kyle Genova, Zeyu Jin, Christian Theobalt, and Maneesh Agrawala. Text-based editing of talking-head video. ACM Transactions on Graphics (TOG), 38(4):1–14, 2019.
165
+
166
+ Shiry Ginosar, Amir Bar, Gefen Kohavi, Caroline Chan, Andrew Owens, and Jitendra Malik. Learning individual styles of conversational gesture. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3497–3506, 2019.
167
+
168
+ Rohit Girdhar and Deva Ramanan. CATER: A diagnostic dataset for Compositional Actions and TEmporal Reasoning. In ICLR, 2020.
169
+
170
+ Rohit Girdhar, Joao Carreira, Carl Doersch, and Andrew Zisserman. Video action transformer network. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 244–253, 2019.
171
+
172
+ 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.
173
+
174
+ Raghav Goyal, Samira Ebrahimi Kahou, Vincent Michalski, Joanna Materzynska, Susanne Westphal, Heuna Kim, Valentin Haenel, Ingo Fruend, Peter Yianilos, Moritz Mueller-Freitag, et al. The” something something” video database for learning and evaluating visual common sense. In ICCV, pp. 5, 2017.
175
+
176
+ Tanmay Gupta, Dustin Schwenk, Ali Farhadi, Derek Hoiem, and Aniruddha Kembhavi. Imagine this! scripts to compositions to videos. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 598–613, 2018.
177
+
178
+ Roei Herzig, Moshiko Raboh, Gal Chechik, Jonathan Berant, and Amir Globerson. Mapping images to scene graphs with permutation-invariant structured prediction. In Advances in Neural Information Processing Systems (NIPS), 2018.
179
+
180
+ Roei Herzig, Elad Levi, Huijuan Xu, Hang Gao, Eli Brosh, Xiaolong Wang, Amir Globerson, and Trevor Darrell. Spatio-temporal action graph networks. In Proceedings of the IEEE International Conference on Computer Vision Workshops, pp. 0–0, 2019.
181
+
182
+ Roei Herzig, Amir Bar, Huijuan Xu, Gal Chechik, Trevor Darrell, and Amir Globerson. Learning canonical representations for scene graph to image generation. In European Conference on Computer Vision, 2020.
183
+
184
+ Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 6626–6637. Curran Associates, Inc., 2017.
185
+
186
+ E. Ilg, N. Mayer, T. Saikia, M. Keuper, A. Dosovitskiy, and T. Brox. Flownet 2.0: Evolution of optical flow estimation with deep networks. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Jul 2017. URL http://lmb.informatik.uni-freiburg.de/ /Publications/2017/IMKDB17.
187
+
188
+ Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. CVPR, 2017.
189
+
190
+ Ashesh Jain, Amir R Zamir, Silvio Savarese, and Ashutosh Saxena. Structural-rnn: Deep learning on spatio-temporal graphs. In Proceedings of the ieee conference on computer vision and pattern recognition, pp. 5308–5317, 2016.
191
+
192
+ Jingwei Ji, Ranjay Krishna, Li Fei-Fei, and Juan Carlos Niebles. Action genome: Actions as composition of spatio-temporal scene graphs. arXiv preprint arXiv:1912.06992, 2019.
193
+
194
+ Justin Johnson, Ranjay Krishna, Michael Stark, Li-Jia Li, David Shamma, Michael Bernstein, and Li Fei-Fei. Image retrieval using scene graphs. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3668–3678, 2015.
195
+
196
+ Justin Johnson, Agrim Gupta, and Li Fei-Fei. Image generation from scene graphs. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1219–1228, 2018.
197
+
198
+ Tero Karras, Samuli Laine, Miika Aittala, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. Analyzing and improving the image quality of stylegan. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020.
199
+
200
+ Dahun Kim, Sanghyun Woo, Joon-Young Lee, and In So Kweon. Deep video inpainting. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5792–5801, 2019.
201
+
202
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
203
+
204
+ Thomas Kipf, Ethan Fetaya, Kuan-Chieh Wang, Max Welling, and Richard Zemel. Neural relational inference for interacting systems. arXiv preprint arXiv:1802.04687, 2018.
205
+
206
+ Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016.
207
+
208
+ Ranjay Krishna, Ines Chami, Michael S. Bernstein, and Li Fei-Fei. Referring relationships. ECCV, 2018.
209
+
210
+ Manoj Kumar, Mohammad Babaeizadeh, Dumitru Erhan, Chelsea Finn, Sergey Levine, Laurent Dinh, and Durk Kingma. Videoflow: A conditional flow-based model for stochastic video generation. In International Conference on Learning Representations, 2020.
211
+
212
+ Anders Boesen Lindbo Larsen, Søren Kaae Sønderby, Hugo Larochelle, and Ole Winther. Autoencoding beyond pixels using a learned similarity metric. In Proceedings of The 33rd International Conference on Machine Learning, pp. 1558–1566, 2016.
213
+
214
+ Alex X. Lee, Richard Zhang, Frederik Ebert, Pieter Abbeel, Chelsea Finn, and Sergey Levine. Stochastic adversarial video prediction. arXiv preprint arXiv:1804.01523, 2018.
215
+
216
+ Yitong Li, Martin Renqiang Min, Dinghan Shen, David E Carlson, and Lawrence Carin. Video generation from text. In AAAI, pp. 5, 2018.
217
+
218
+ Ji Lin, Chuang Gan, and Song Han. Tsm: Temporal shift module for efficient video understanding. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), October 2019.
219
+
220
+ Pauline Luc, Camille Couprie, Yann Lecun, and Jakob Verbeek. Predicting Future Instance Segmentation by Forecasting Convolutional Features. In ECCV, pp. 593–608, 2018.
221
+
222
+ Maryellen C MacDonald, Neal J Pearlmutter, and Mark S Seidenberg. The lexical nature of syntactic ambiguity resolution. Psychological review, 101(4):676, 1994.
223
+
224
+ Arun Mallya, Ting-Chun Wang, Karan Sapra, and Ming-Yu Liu. World-consistent video-to-video synthesis. In European Conference on Computer Vision (ECCV), 2020.
225
+
226
+ Tanya Marwah, Gaurav Mittal, and Vineeth N Balasubramanian. Attentive semantic video generation using captions. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1426–1434, 2017.
227
+
228
+ Joanna Materzynska, Tete Xiao, Roei Herzig, Huijuan Xu, Xiaolong Wang, and Trevor Darrell. Something-else: Compositional action recognition with spatial-temporal interaction networks. In proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2020.
229
+
230
+ Michael Mathieu, Camille Couprie, and Yann LeCun. Deep multi-scale video prediction beyond mean square error. arXiv preprint arXiv:1511.05440, 2015.
231
+
232
+ Megha Nawhal, Mengyao Zhai, Andreas Lehrmann, Leonid Sigal, and Greg Mori. Generating videos of zero-shot compositions of actions and objects. In Proceedings of the European Conference on Computer Vision (ECCV), 2020a.
233
+
234
+ Megha Nawhal, Mengyao Zhai, Andreas Lehrmann, Leonid Sigal, and Greg Mori. Generating videos of zero-shot compositions of actions and objects. In European Conference on Computer Vision (ECCV), 2020b.
235
+
236
+ Alejandro Newell and Jia Deng. Pixels to graphs by associative embedding. In Advances in Neural Information Processing Systems 30 (to appear), pp. 1172–1180. Curran Associates, Inc., 2017.
237
+
238
+ Yingwei Pan, Zhaofan Qiu, Ting Yao, Houqiang Li, and Tao Mei. To create what you tell: Generating videos from captions. In Proceedings of the 25th ACM international conference on Multimedia, pp. 1789–1798, 2017.
239
+
240
+ Taesung Park, Ming-Yu Liu, Ting-Chun Wang, and Jun-Yan Zhu. Semantic image synthesis with spatially-adaptive normalization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2337–2346, 2019.
241
+
242
+ Moshiko Raboh, Roei Herzig, Gal Chechik, Jonathan Berant, and Amir Globerson. Differentiable scene graphs. In Winter Conf. on App. of Comput. Vision, 2020.
243
+
244
+ Masaki Saito, Eiichi Matsumoto, and Shunta Saito. Temporal generative adversarial nets with singular value clipping. In ICCV, 2017.
245
+
246
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, Xi Chen, and Xi Chen. Improved techniques for training gans. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems 29, pp. 2234–2242. Curran Associates, Inc., 2016.
247
+
248
+ Brigit Schroeder, Subarna Tripathi, and Hanlin Tang. Triplet-aware scene graph embeddings. In The IEEE International Conference on Computer Vision (ICCV) Workshops, Oct 2019.
249
+
250
+ Sebastian Schuster, Ranjay Krishna, Angel Chang, Li Fei-Fei, and Christopher D Manning. Generating semantically precise scene graphs from textual descriptions for improved image retrieval. In Proceedings of the fourth workshop on vision and language, pp. 70–80, 2015.
251
+
252
+ Aliaksandr Siarohin, Stephane Lathuili ´ ere, Sergey Tulyakov, Elisa Ricci, and Nicu Sebe. Animating \` arbitrary objects via deep motion transfer. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2377–2386, 2019.
253
+
254
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
255
+
256
+ Yang Song, Jingwen Zhu, Dawei Li, Xiaolong Wang, and Hairong Qi. Talking face generation by conditional recurrent adversarial network. arXiv preprint arXiv:1804.04786, 2018.
257
+
258
+ Chen Sun, Abhinav Shrivastava, Carl Vondrick, Kevin Murphy, Rahul Sukthankar, and Cordelia Schmid. Actor-centric relation network. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 318–334, 2018.
259
+
260
+ Sergey Tulyakov, Ming-Yu Liu, Xiaodong Yang, and Jan Kautz. MoCoGAN: Decomposing motion and content for video generation. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1526–1535, 2018.
261
+
262
+ Ruben Villegas, Arkanath Pathak, Harini Kannan, Dumitru Erhan, Quoc V Le, and Honglak Lee. High fidelity video prediction with large stochastic recurrent neural networks. In Advances in Neural Information Processing Systems 32, pp. 81–91. Curran Associates, Inc., 2019.
263
+
264
+ Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Generating videos with scene dynamics. In Advances in neural information processing systems (NIPS), 2016.
265
+
266
+ Jacob Walker, Carl Doersch, Abhinav Gupta, and Martial Hebert. An uncertain future: Forecasting from static images using variational autoencoders. In European Conference on Computer Vision, pp. 835–851. Springer, 2016.
267
+
268
+ Ting-Chun Wang, Ming-Yu Liu, Jun-Yan Zhu, Guilin Liu, Andrew Tao, Jan Kautz, and Bryan Catanzaro. Video-to-video synthesis. In Advances in Neural Information Processing Systems (NeurIPS), 2018a.
269
+
270
+ Ting-Chun Wang, Ming-Yu Liu, Jun-Yan Zhu, Andrew Tao, Jan Kautz, and Bryan Catanzaro. Highresolution image synthesis and semantic manipulation with conditional gans. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 8798–8807, 2018b.
271
+
272
+ Ting-Chun Wang, Ming-Yu Liu, Andrew Tao, Guilin Liu, Jan Kautz, and Bryan Catanzaro. Fewshot video-to-video synthesis. In Advances in Neural Information Processing Systems (NeurIPS), 2019.
273
+
274
+ Xiaolong Wang and Abhinav Gupta. Videos as space-time region graphs. In ECCV, 2018.
275
+
276
+ Nicholas Watters, Daniel Zoran, Theophane Weber, Peter Battaglia, Razvan Pascanu, and Andrea Tacchetti. Visual interaction networks: Learning a physics simulator from video. In Advances in neural information processing systems, pp. 4539–4547, 2017.
277
+
278
+ Janyce Wiebe, Theresa Wilson, Rebecca Bruce, Matthew Bell, and Melanie Martin. Learning subjective language. Computational linguistics, 30(3):277–308, 2004.
279
+
280
+ Danfei Xu, Yuke Zhu, Christopher B. Choy, and Li Fei-Fei. Scene Graph Generation by Iterative Message Passing. In Proc. Conf. Comput. Vision Pattern Recognition, pp. 3097–3106, 2017.
281
+
282
+ Ning Xu, An-An Liu, Jing Liu, Weizhi Nie, and Yuting Su. Scene graph captioner: Image captioning based on structural visual representation. Journal of Visual Communication and Image Representation, pp. 477–485, 2019.
283
+
284
+ Sijie Yan, Yuanjun Xiong, and Dahua Lin. Spatial temporal graph convolutional networks for skeleton-based action recognition. In Thirty-second AAAI conference on artificial intelligence, 2018.
285
+
286
+ Yufei Ye, Maneesh Singh, Abhinav Gupta, and Shubham Tulsiani. Compositional video prediction. In Proceedings of the IEEE International Conference on Computer Vision, pp. 10353–10362, 2019.
287
+
288
+ Kexin Yi, Chuang Gan, Yunzhu Li, Pushmeet Kohli, Jiajun Wu, Antonio Torralba, and Joshua B Tenenbaum. Clevrer: Collision events for video representation and reasoning. arXiv preprint arXiv:1910.01442, 2019.
289
+
290
+ Rowan Zellers, Mark Yatskar, Sam Thomson, and Yejin Choi. Neural motifs: Scene graph parsing with global context. In Conference on Computer Vision and Pattern Recognition, 2018.
291
+
292
+ Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In CVPR, 2018.
293
+
294
+ Tinghui Zhou, Shubham Tulsiani, Weilun Sun, Jitendra Malik, and Alexei A. Efros. View synthesis by appearance flow. In ECCV, 2016.
295
+
296
+ In this supplementary file we provide additional information about our model, training losses, experimental results, and qualitative examples.
297
+
298
+ # 1 GRAPH CONVOLUTION NETWORK
299
+
300
+ As explained in the main paper, we used a Graph Convolution Network (GCN) (Kipf & Welling, 2016) to predict the layout $\ell _ { t }$ at time step $t$ . The GCN uses the structure of the action graph, and propagates information along this graph (in $K$ iterations) to obtain a set of layout coordinates per object.
301
+
302
+ Each object category $c \in { \mathcal { C } }$ is assigned a learned embedding $\phi _ { c } \in \mathbb { R } ^ { D }$ and each action $a \in \mathcal { R }$ is assigned a learned embedding $\psi _ { a } \in \mathbb { R } ^ { D }$ . We next explain how to obtain the layouts $\ell _ { t }$ using a GCN. Consider the action graph $A _ { t }$ at time $t$ with the corresponding clocked edges $( i , a , j , r )$ . Denote the layout for node $i$ at time $t - 1$ by $\ell _ { t - 1 , i }$ . The GCN iteratively calculates a representation for each object and each action in the graph. Let $z _ { i , k } \in \mathbb { R } ^ { d }$ be the representation of the $i ^ { t h }$ object in the $k ^ { t h }$ layer of the GCN. Similarly, for each edge in $A _ { t }$ given by $\boldsymbol { e } = ( i , a , j , r )$ let $\boldsymbol { u } _ { e , k } \in \mathbb { R } ^ { d }$ be the representation of this edge in the $k ^ { t h }$ layer. These representations are calculated as follows. At the GCN input, we set the representation for node $i$ to be: $z _ { i , 0 } = [ \phi _ { o ( i ) } , \ell _ { t - 1 , i } ]$ . And, for each edge $e = ( i , a , j , r )$ set $\boldsymbol { \mathbf { \mathit { u } } } _ { e , 0 } = [ \psi _ { a } , r , \ell _ { t - 1 , i } , \ell _ { t - 1 , j } ]$ . All representations at time 0 are transformed to $D$ dimensional vectors using an MLP. Next, we use three functions (MLPs) $F _ { s } , F _ { a } , F _ { o }$ , each from $\mathbb { R } ^ { D } \times \mathbb { R } ^ { D } \times \mathbb { R } ^ { D }$ to $\mathbb { R } ^ { D }$ . These can be thought of as processing three vectors on an edge (the subject, action and object representations) and returning three new representations. Given these functions, the updated object representation is the average of all edges incident on $i$ :5
303
+
304
+ $$
305
+ z _ { i , k + 1 } = \sum _ { e = ( i , a , j , r ) } F _ { s } ( z _ { i , k } , { \pmb u } _ { e , k } , z _ { j , k } ) + \sum _ { e = ( j , a , i , r ) } F _ { o } ( z _ { j , k } , { \pmb u } _ { e , k } , z _ { i , k } )
306
+ $$
307
+
308
+ Similarly, the representation for edge $e$ is updated via: $\begin{array} { r } { { \pmb u } _ { e , k + 1 } = F _ { a } ( z _ { i , k + 1 } , { \pmb u } _ { e , k } , z _ { j , k + 1 } ) . } \end{array}$
309
+
310
+ Finally, we transform the GCN representations above at each time-step $t$ to a layout $\ell _ { t }$ as follows. Let $K$ denote the number of GCN updates. The layout coordinates of $\ell _ { t , i }$ are the output of an MLP applied to $z _ { i , K } ^ { t }$ , which are simply the set of the predicted normalized bounding box coordinates. The object descriptor is $z _ { i , K } ^ { t }$ .
311
+
312
+ # 2 LOSSES AND TRAINING
313
+
314
+ We elaborate on the Flow and Perceptual losses from Section 4.2.
315
+
316
+ Optical flow loss $\mathcal { L } _ { F }$ . The flow loss $\mathcal { L } _ { F }$ is the warping loss which measures the error between the warps of the previous frame and the ground truth of the next frame $v _ { t } ^ { G T }$ .
317
+
318
+ $$
319
+ \mathcal { L } _ { f } = \frac { 1 } { T - 1 } \sum _ { t = 1 } ^ { T - 1 } \Vert w _ { t } - v _ { t } ^ { G T } \Vert _ { 1 }
320
+ $$
321
+
322
+ where $w _ { t } = W ( f _ { t } , v _ { t - 1 } )$ as defined in Section 4.1. This flow loss proposed previously in Wang et al. (2018a); Zhou et al. (2016).
323
+
324
+ Perceptual loss $\mathcal { L } _ { P }$ . This is the standard perceptual loss as in pix2pixHD (Wang et al., 2018b). In particular, we use the VGG network (Simonyan & Zisserman, 2014) as a feature extractor and minimize the error between the extracted features from the generated and ground truth images from $L$ layers.
325
+
326
+ $$
327
+ \mathcal { L } _ { P } = \sum _ { l } ^ { L } \frac { 1 } { P _ { l } } | | \phi ^ { ( l ) } ( v _ { t } ) - \phi ^ { ( l ) } ( v _ { t } ^ { G T } ) | | _ { 1 }
328
+ $$
329
+
330
+ ![](images/3b3c969a8ae09f7a081a5b277ec0a09b718221e5ed2754d59da344e3b685a958.jpg)
331
+ Figure 7: Qualitative examples for the generation of actions on the CATER dataset. We use the AG2Vid model to generate videos of four standard actions and two composed unseen actions (“Swap” and “Huddle”). The objects involved in actions are highlighted. Click the image to play the video clip in a browser.
332
+
333
+ where $\phi ^ { ( l ) }$ denotes the $l$ -th layer with $P _ { l }$ elements of the VGG network. We sum the above over all frames in the videos.
334
+
335
+ The overall optimization problem is to minimize the weighted sum of the losses:
336
+
337
+ $$
338
+ \operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { D _ { A } } \mathcal { L } _ { A } ( D _ { A } ) + \lambda _ { \ell } \mathcal { L } _ { \ell } + \lambda _ { f } \mathcal { L } _ { f } + \lambda _ { P } \mathcal { L } _ { P } ,
339
+ $$
340
+
341
+ where $\theta$ are all the trainable parameters of the generative model, $\mathcal { L } _ { \ell }$ is the Layout loss, and $\mathcal { L } _ { A }$ is the pixel action discriminator loss from Section 4.2. In addition to the loss terms in Equation 5, we use a feature matching loss (Larsen et al., 2016; Wang et al., 2018b) to match the statistics of features extracted by the GAN discriminators.
342
+
343
+ # 3 ACTIONS
344
+
345
+ For the Something Something dataset (Goyal et al., 2017), we use the eight most frequent actions. These include: “Putting [something] on a surface”, “Moving [something] up”, “Pushing [something] from left to right”, “Moving [something] down”, “Pushing [something] from right to left”, “Covering [something] with [something]”, “Uncovering [something]”, “Taking [one of many similar things on the table]” . See Figure 8 for qualitative examples. The box annotations of the objects from the videos are taken from Materzynska et al. (2020).
346
+
347
+ Table 4: Layout generation evaluation.
348
+
349
+ <table><tr><td rowspan="2">Model</td><td colspan="2">mIOU↑</td><td colspan="2">R@0.3 ↑</td><td colspan="2">R@0.5 ↑</td></tr><tr><td>CATER</td><td>Smth</td><td>CATER</td><td>Smth</td><td>CATER</td><td>Smth</td></tr><tr><td>Random</td><td>5.05</td><td>13.55</td><td>5.94</td><td>16.50</td><td>01.86</td><td>4.81</td></tr><tr><td>RNN</td><td>75.71</td><td>41.28</td><td>80.67</td><td>61.70</td><td>78.91</td><td>39.23</td></tr><tr><td>AG2Vid</td><td>93.09</td><td>51.32</td><td>99.55</td><td>74.50</td><td>98.04</td><td>53.85</td></tr></table>
350
+
351
+ ![](images/bc0f42eb93c0cfca9389b441244a9e8ea6b2db22a20ce395ac314e489f9f67d6.jpg)
352
+ Figure 8: Qualitative examples for the generation of actions on the Something Something dataset. We use our AG2Vid model to generate videos of eight standard actions and two composed unseen actions (“Right Up” and “Down Left”). Click the image to play the video clip in a browser.
353
+
354
+ # 4 EXPERIMENTS AND RESULTS
355
+
356
+ # 4.1 RNN BASELINE
357
+
358
+ We experiment with an RNN architecture as an alternative to the GCN implementation of the LGF. This RNN has access to the same input and supervision to the GCN, namely, to $l _ { t - 1 }$ and $A _ { t }$ . We next explain how to obtain the layouts $\ell _ { t }$ using the RNN.
359
+
360
+ Each object category $c \in { \mathcal { C } }$ is assigned a learned embedding $\phi _ { c } \in \mathbb { R } ^ { D }$ and each action $a \in \mathcal { R }$ is assigned a learned embedding $\bar { \psi _ { a } } \in \mathbb { R } ^ { D } + 1$ . Consider the action graph $A _ { t }$ at time $t$ with the corresponding clocked edges $( i , a , j , r )$ .
361
+
362
+ let $U _ { i } \in \mathbb { R } ^ { | E | \times 4 D + 1 }$ denote the matrix, where every row that corresponds to edge is comprised of the object, action, subject embeddings, the embedding of the ith object, and the target the progress feature. We apply the RNN over $U _ { i }$ and denote $z _ { i , t }$ as the last hidden state of the result. The new object descriptor of $l _ { t , i }$ is then $z _ { i , t }$ , and to obtain a new bounding box location, an MLP is applied over $z _ { i , t }$ . $l _ { t }$ is the new updated bboxes and object descriptors. The RNN model has 3 layers and 512 hidden layer size.
363
+
364
+ Table 5: Human evaluation of the semantic accuracy of the actions in the generated videos.
365
+
366
+ <table><tr><td>Composed Actions Swap Huddle</td><td>RU DL</td></tr><tr><td>92.1 98.6</td><td>75.0 100.</td></tr></table>
367
+
368
+ Table 6: Human evaluation of timing in generated videos (see section 4.3). The table reports accuracy of human annotator answer with respect to the true answer.
369
+
370
+ <table><tr><td colspan="4">Standard Actions</td><td colspan="2">Composed Actions Huddle</td></tr><tr><td>Slide</td><td>Contain</td><td>Pick Place</td><td>Rotate</td><td>Swap</td></tr><tr><td>96.7</td><td>100.0</td><td>90.0</td><td>56.7</td><td>93.3</td></tr></table>
371
+
372
+ # 4.2 LAYOUT ACCURACY
373
+
374
+ AG2Vid produces bounding boxes of objects as a function of time. Since our datasets contain ground-truth boxes, we can compare our predictions to these. We evaluate the intersection over union (IOU) over the predicted and ground truth boxes. We report the mean intersection over union (mIOU) which is the mean over the entire set of boxes. Additionally, we measure the recall over the by considering an object to be a correct detected if the IOU between the GT and predicted box is higher than 0.3 $( \mathbb { R } ^ { \ @ 0 . 3 ) }$ or 0.5 $( \mathbf { R } @ 0 . 5 )$ . Results are reported in Table 4. It can be seen that the RNN underperforms, supporting the choice of GCN for layout generation in the AG2Vid model. The RNN is likely to under-perform as it assumes order over the AG list of edges, which is not a natural way to process a graph.
375
+
376
+ # 4.3 HUMAN EVALUATION OF ACTION TIMING IN GENERATED VIDEOS
377
+
378
+ As described in Section 5.1, we evaluated to which extent the action graphs (AGs) can control the timing execution of actions on the CATER dataset. Thus, we generated 90 pairs of action graphs where the only difference between the two graphs is the timing of one action. We then asked the annotators to select the video where the action is executed first. The full results are depicted in Table 6, and visual examples are shown in Figure 9. The results for all actions but “Rotate” are consistent with the expected behavior, indicating that the model correctly executes actions in a timely fashion. The “Rotate” action is especially challenging to generate since it occurs within the intermediate layout. It is also easier to miss as it involves a relatively subtle change in the video.
379
+
380
+ ![](images/b1f86495e13e81e8c9a31be4ca7671927269b60c26a9bb45bc852f47591712c3.jpg)
381
+ Figure 9: Timing experiment examples in CATER. We show the clock edges can manipulate the timing of a video by controlling when the action is performed to achieve goal-oriented video synthesis. The objects involved in “rotate” are highlighted. Click the image to play the video clip in a browser.
382
+
383
+ # 4.4 HUMAN EVALUATION OF SEMANTIC QUALITY IN GENERATED VIDEOS
384
+
385
+ To test the degree to which the generated videos match their corresponding actions, we generated twenty videos per action for the Something-Something dataset and asked three different human annotators to evaluate each video. Each annotator was asked to pick the action that best describes the video out of the list of possible actions. We provide the results in Fig. 7. Each cell in the table corresponds to the class recall of a specific action. To determine if a video correctly matches its corresponding action, we used the majority voting over the answers of all annotators.
386
+
387
+ It turns out that humans do not perform perfectly in the above task. We quantified this effect in the following experiments on the Something-Something dataset. We used the above annotation process for ground-truth videos (see “Real” row in Table 7). Interestingly, it can be seen from the reported accuracy in Table 7 that our generated action videos of “Move Down” and “Take” are more easily recognizable by humans than the ground truth videos. For the CATER dataset, we did not perform such human evaluation of predicted actions, since CATER videos contain multiple activities.
388
+
389
+ To evaluate the extent to which the AG2Vid model can generalize at test time to unseen actions, we manually defined four compositions of learned actions. In Table 5, we show the semantic accuracy of the human evaluation we did for the new unseen actions: “huddle”, “Swap”, “Right Up” and “Down Left”.
390
+
391
+ <table><tr><td rowspan="2">Video Source</td><td colspan="8">Standard Actions</td></tr><tr><td>Right</td><td>Up</td><td>Down</td><td>Left</td><td>Put</td><td>Take</td><td>Uncover</td><td>Cover</td></tr><tr><td>Generated</td><td>100.</td><td>50.</td><td>100.</td><td>75.</td><td>95.</td><td>80.</td><td>25.</td><td>55.</td></tr><tr><td>Real</td><td>100.</td><td>100.</td><td>90.</td><td>100.</td><td>100.</td><td>65.</td><td>100.</td><td>85.</td></tr></table>
392
+
393
+ Table 7: The semantic quality evaluated by humans of the generated and real action videos. We asked raters to select the action described in the video for each synthesized video with a given action. The table reports the accuracy of the human annotators with respect to the true action underlying the video. Actions above correspond to: ’Pushing [something] from left to right’, ’Moving [something] up’, ’Moving [something] down’, ’Pushing [something] from right to left’, ’Putting [something] on a surface’, ’Taking [one of many similar things on the table]’, ’Uncovering [something]’, ’Covering [something] with [something]’ .
394
+
395
+ # 4.5 COMPARING AG2VID TO SCENE-GRAPH BASED GENERATION
396
+
397
+ Scene graphs are an expressive formalism for describing image content. Both datasets we use have frame-level scene graph annotation. Thus, we wanted to compare generation from these scene graphs with generation from action graphs. Towards this end, we used a scene-graph-to-image model (Johnson et al., 2018) trained to generate the images in the videos from their corresponding scene graphs. This model does not condition the action or initial frame and serves only for comparison in terms of realistic generation. It can be seen in Figure 10 that the temporal coherency of AG2Vid is more consistent and coherent than the sequence of scene graphs.
398
+
399
+ ![](images/e36029f47486ffa0ab568d1e783dd7a946a7d70cdf16c52d1847309451233d3b.jpg)
400
+ Figure 10: Comparing $\mathrm { { S g 2 I m } }$ and $\mathrm { A g 2 V i d }$ results in CATER. Each column is a different sample. Click the image to play the video clip in a browser.
md/train/vlcVTDaufN/vlcVTDaufN.md ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DIFFERENTIABLE COMBINATORIAL LOSSES THROUGH GENERALIZED GRADIENTS OF LINEAR PROGRAMS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Combinatorial problems with linear objective function play a central role in many computer science applications, and efficient algorithms for solving them are well known. However, the solutions to these problems are not differentiable with respect to the parameters specifying the problem instance – for example, shortest distance between two nodes in a graph is not a differentiable function of graph edge weights. Recently, attempts to integrate combinatorial and, more broadly, convex optimization solvers into gradient-trained models resulted in several approaches for differentiating over the solution vector to the optimization problem. However, in many cases, the interest is in differentiating over only the objective value, not the solution vector, and using existing approaches introduces unnecessary overhead. Here, we show how to perform gradient descent directly over the objective value of the solution to combinatorial problems. We demonstrate advantage of the approach in examples involving sequence-to-sequence modeling using differentiable encoder-decoder architecture with softmax or Gumbel-softmax, and in weakly supervised learning involving a convolutional, residual feed-forward network for image classification.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Combinatorial optimization problems, such as shortest path in a weighted directed graph, minimum spanning tree in a weighted undirected graph, or optimal assignment of tasks to workers, play a central role in many computer science applications. We have highly refined, efficient algorithms for solving these fundamental problems (Cormen et al., 2009; Schrijver, 2003). However, while we can easily find, for example, the minimal spanning tree in a graph, the total weight of the tree as function of graph edge weights is not differentiable. This problem hinders using solutions to combinatorial problems as criteria in training models that rely on differentiability of the objective function with respect to the model parameters.
12
+
13
+ Losses that are defined by objective value of some feasible solution to a combinatorial problem, not the optimal one, have been recently proposed for image segmentation using deep models (Zheng et al., 2015; Lin et al., 2016). These focus on a problem where some pixels in the image have segmentation labels, and the goal is to train a convolutional network that predicts segmentation labels for all pixels. For pixels with labels, a classification loss can be used. For the remaining pixels, a criterion based on a combinatorial problem – for example the maximum flow / minimal cut problem in a regular, lattice graph connecting all pixels (Boykov et al., 2001) or derived, higher-level super-pixels (Lin et al., 2016) – is often used as a loss, in an iterative process of improving discrete segmentation labels (Zheng et al., 2015; Marin et al., 2019). In this approach, the instance of the combinatorial problem is either fixed, or depends only on the input to the network; for example, similarity of neighboring pixel colors defines edge weights. The output of the neural network gives rise to a feasible, but rarely optimal, solution to that fixed instance a combinatorial problem, and its quality is used as a loss. For example, pixel labeling proposed by the network is interpreted as a cut in a pre-defined graph connecting then pixels. Training the network should result in improved cuts, but no attempt to use a solver to find an optimal cut is made.
14
+
15
+ Here, we are considering a different setup, in which each new output of the neural network gives rise to a new instance of a combinatorial problem. A combinatorial algorithm is then used to find the optimal solution to the problem defined by the output, and the value of the objective function of the optimal solution is used as a loss. After each gradient update, the network will produce a new combinatorial problem instance, even for the same input sample. Iteratively, the network is expected to learn to produce combinatorial problem instances that have low optimal objective function value. For example, in sequence-to-sequence modeling, the network will output a new sentence that is supposed to closely match the desired sentence, leading to a new optimal sequence alignment problem to be solved. Initially, the optimal alignment will be poor, but as the network improves and the quality of the output sentences get higher, the optimal alignment scores will be lower.
16
+
17
+ Recently, progress in integrating combinatorial problems into differentiable models have been made by modifying combinatorial algorithms to use only differentiable elements (Tschiatschek et al., 2018; Mensch & Blondel, 2018; Chang et al., 2019), for example smoothed max instead of max in dynamic programming. Another approach involves executing two runs of a non-differentiable, black-box combinatorial algorithm and uses the two solutions to define a differentiable interpolation (Vlastelica Poganciˇ c et al., 2020; Rol ´ ´ınek et al., 2020). Finally, differentiable linear programming and quadratic programming layers, which can be used to model many combinatorial problems, have been proposed recently (Amos & Kolter, 2017; Agrawal et al., 2019; Wilder et al., 2019; Ferber et al., 2019).
18
+
19
+ The approaches above allow for differentiating through optimal solution vectors. In many cases, we are interested only in the optimal objective value, not the solution vector, and the approaches above introduce unnecessary overhead. We propose an approach for gradient-descent based training of a network $f ( x ; { \boldsymbol { \beta } } )$ for supervised learning problems involving samples $( x , y )$ with the objective criterion involving a loss term of the form ${ \tilde { L ( \beta ) } } = h ( \mathrm { O p t S o l u t i o n O b j e c t i v e V a l u e } ( \Pi ( F ( x ; \tilde { \beta } ) , y ) )$ , where $h : \mathbb { R } \mathbb { R }$ is some differentiable function, and $\Pi$ is a combinatorial solver for a problem instance defined by the output of the $\beta$ -parameterized network $F$ for feature vector $x$ and by the true label $y$ . We show that a broad class of combinatorial problems can be integrated into models trained using variants of gradient descent. Specifically, we show that for an efficiently solvable combinatorial problem that can be efficiently expressed as an integer linear program, generalized gradients of the problem’s objective value with respect to real-valued parameters defining the problem exist and can be efficiently computed from a single run of a black-box combinatorial algorithm. Using the above result, we show how generalized gradients of combinatorial problems can provide sentence-level loss for text summarization using differentiable encoder-decoder models that involve softmax or Gumbel softmax (Jang et al., 2016), and a multi-element loss for training classification models when only weakly supervised, bagged training data is available.
20
+
21
+ # 2 DIFFERENTIABLE COMBINATORIAL LOSSES
22
+
23
+ # 2.1 BACKGROUND ON GENERALIZED GRADIENTS
24
+
25
+ A function $f : \mathcal { X } \to \mathbb { R }$ defined over a convex, bounded open set $\mathcal { X } \in \mathbb { R } ^ { p }$ is Lipschitz continuous on an open set $B \in { \mathcal { X } }$ if there is a finite $K \in \mathbb { R }$ such that $\begin{array} { r } { \forall x , y \in B | f ( x ) - \bar { f ( y ) } | \leq K | | x - y | | } \end{array}$ . A function is locally Lipschitz-continuous if for every point $x _ { 0 }$ in its domain, there is a neighborhood $B _ { 0 }$ , an open ball centered at $x _ { 0 }$ , on which the function is Lipschitz-continuous. For such functions, a generalized gradient can be defined.
26
+
27
+ Definition 1. (Clarke, 1975) Let $f : \mathcal { X } \to \mathbb { R }$ be Lipschitz-continuous in the neighborhood of $x \in \mathcal { X }$ Then, the Clarke subdifferential $\partial f ( x )$ of $f$ at $x$ is defined as
28
+
29
+ $$
30
+ \partial f ( x ) = { \mathrm { c o n v } } \left\{ \operatorname* { l i m } _ { x _ { k } \to x } \nabla f ( x _ { k } ) \right\} ,
31
+ $$
32
+
33
+ where the limit is over all convergent sequences involving those $x _ { k }$ for which gradient exists, and conv denotes convex hull, that is, the smallest polyhedron that contains all vectors from a given set. Each element of the set $\partial f ( x )$ is called $a$ generalized gradient of $f$ at $x$ .
34
+
35
+ The Rademacher theorem (see e.g. (Evans, 1992)) states that for any locally Lipschitz-continuous function the gradient exists almost everywhere; convergent sequences can be found.
36
+
37
+ In optimization algorithms, generalized gradients can be used in the same way as subgradients (Redding & Downs, 1992), that is, nondifferentiability may affect convergence in certain cases.
38
+
39
+ # 2.2 GRADIENT DESCENT OVER COMBINATORIAL OPTIMIZATION
40
+
41
+ Many combinatorial problems have linear objective function and can be intuitively expressed as integer linear programs (ILP), that is, linear programs with additional constraint that the solution vector involves only integers. Any ILP can be reduced to a linear program. Consider an ILP
42
+
43
+ $$
44
+ \begin{array} { r } { z ^ { * } = I L P ( c , A ^ { \prime } , b ^ { \prime } ) : = \operatorname* { m i n } _ { u } \ c ^ { T } u \ \mathrm { ~ s . t . ~ } A ^ { \prime } u = b ^ { \prime } , \ u \geq 0 , \ u \in \mathbb { Z } ^ { p } , } \end{array}
45
+ $$
46
+
47
+ with an optimal solution vector $u ^ { * }$ and optimal objective value $z ^ { * }$ . Then, there exists a corresponding linear program $L P ( c , A , b )$
48
+
49
+ $$
50
+ \begin{array} { r } { z ^ { * } = L P ( c , A , b ) : = \operatorname* { m i n } _ { u } c ^ { T } u \mathrm { ~ s . t . ~ } A u = b , u \geq 0 , } \end{array}
51
+ $$
52
+
53
+ called ideal formulation (Wolsey, 1989), for which $u ^ { * }$ is also an optimal solution vector, with the same objective value $z ^ { * }$ . For a feasible, bounded $p$ -dimensional integer program, we can view the pair $( A ^ { \prime } , b ^ { \prime } )$ as a convex polyhedron $\mathcal { A } ^ { \prime }$ , the set of all feasible solutions. Then, the pair $( A , b )$ in the ideal formulation LP is defined as the set of constraints specifying the feasible set $\mathcal { A } = \mathrm { c o n v } \left\{ \mathcal { A } ^ { \prime } \cap \mathbb { Z } ^ { p } \right\}$ . Convex hull of a subset of a convex set $\mathcal { A } ^ { \prime }$ cannot extend beyond $\mathcal { A } ^ { \prime }$ , thus, $\mathcal { A }$ is convex, contains all integer solutions from $\mathcal { A } ^ { \prime }$ , and no other integer solutions. The number of linear constraints in the ideal formulation may be exponential in $p$ , and/or in $m$ , the number of the original constraints in $\mathcal { A } ^ { \prime }$ . Thus, the existence of the ideal formulation LP for an ILP may not have practical utility for solving the ILP.
54
+
55
+ For a combinatorial problem and its corresponding ILP, we use the ideal formulation of the ILP as a conceptual tool to define generalized gradient of the objective value of the optimal solution to the combinatorial problem with respect to the parameters defining the combinatorial problem. Specifically, our approach first uses a single run of an efficient, black-box combinatorial algorithm to produce the optimal solution vector and the associated objective value. Then, the combinatorial problem is conceptually viewed as an instance of an ILP. A possibly exponentially large linear program (LP) equivalent to the ILP is then used, without actually being spelled out or solved, to derive generalized gradients based on the solution vector returned by the combinatorial algorithm.
56
+
57
+ First, we introduce several notions of efficiency of transforming a combinatorial problem into a linear integer program that will be convenient in defining the generalized gradients of combinatorial problems.
58
+
59
+ Definition 2. Let $P ( w )$ be a combinatorial problem that is parameterized by a continuous vector $w \in \mathcal { W } \subseteq \mathbb { R } ^ { n }$ , where $\mathcal { W }$ is simply connected and n is the problem size, and let $k \in \mathbb { Z }$ be a constant that may depend on the problem type but not on its size. Then, a combinatorial problem is
60
+
61
+ • primal-dual $\partial$ -efficient if it can be phrased as an integer linear program involving n variables, with kn constraints in an $L P$ formulation equivalent to the ILP, and the parameters $( A , b , c )$ of the $L P$ formulation depend on w through (sub)differentiable functions, $c = c ( w ) , A =$ $A ( w ) , b = b ( w )$ .
62
+
63
+ • primal $\partial$ -efficient if it can be phrased as an integer linear program involving n variables, the parameters w of the problem influence the cost vector c through a (sub)differentiable function $c = c ( w )$ , and do not influence the constraints $A , b$ .
64
+
65
+ • dual $\partial$ -efficient if it can be phrased as an integer linear program in which the number of constraints in the equivalent LP formulation is kn, the parameters w of the problem influence b through a (sub)differentiable function $b = b ( w )$ , and do no influence the constraint matrix A nor the cost vector c.
66
+
67
+ The class of $\partial$ -efficient problems includes polynomially solvable combinatorial problems with objective function that is linear in terms of problem parameters. Typically, the functions $c = c ( w )$ , $b = b ( w )$ and $A = A ( w )$ are either identity mapping or are constant; for example, in the LP for maximum network flow, the cost vector $c$ is composed directly of edge capacities, and $A$ an $b$ are constant for a given flow network topology, and do not depend on capacities.
68
+
69
+ For any polynomially solvable combinatorial problem, we can construct a $\mathrm { p o l y } ( n )$ -sized Boolean circuit for the algorithm solving it. For each poly $( n )$ -sized circuit, there is a linear program with $\mathrm { p o l y } ( n )$ variables and constraints that gives the same solution (see (Dasgupta et al., 2008), Chap.
70
+
71
+ 7). For example, for MST in a graph with $V$ vertices and $E$ edges, the Martin’s ILP formulation (Martin, 1991) has only poly $( V + E )$ constraints, but it is an extended formulation that involves $V E$ additional variables on top of the typical $E$ variables used in the standard ILP formulations for MST. Thus, we cannot use it to construct an ILP formulation that would make MST primal-dual $\partial$ -efficient. Alternatively, there is an ILP for MST with one binary variable per edge, and the weight of the edge only influences the cost vector $c$ , but to prohibit cycles in the solution there is a constraint for each cycle in the graph, thus the number of constraints is not $\mathrm { p o l y } ( n )$ for arbitrary graphs. These constraints are specified fully by the topology of the graph, not by the edge weights, so $w$ does not influence $A$ nor $b$ , meeting the conditions for primal $\partial$ -efficiency. The MST example shows that there are problems that are primal $\partial$ -efficient and not primal-dual $\partial$ -efficient.
72
+
73
+ Some polynomially solvable combinatorial problems are not $\partial \mathbf { \cdot }$ -efficient in any of the above sense. For example, fixed-rank combinatorial problems with interaction costs (Lendl et al., 2019) can be phrased succinctly as a bilinear program, but lead to prohibitively large linear programs both in terms of the number of variables and the number of constraints.
74
+
75
+ For $\partial$ -efficient problems, we can efficiently obtain generalized gradients of the objective value.
76
+
77
+ Theorem 1. Consider a combinatorial problem $P ( w )$ of size $n$ , a parameter vector w from the interior of the parameter domain $\mathcal { W }$ , and an algorithm $\Pi ( w )$ for solving it in time $\mathrm { p o l y } ( n )$ . Let $z ^ { * }$ be the optimal objective value returned by Π. Then,
78
+
79
+ • if $P$ is primal $\partial$ -efficient, then the generalized gradients $\partial z ^ { * } ( w )$ exist, and can be efficiently computed from $U ^ { * }$ , the set of primal solution of the ideal formulation of integer program corresponding to $P$ ;
80
+
81
+ • if $P$ is dual $\partial$ -efficient, then the generalized gradients of $\partial z ^ { * } ( w )$ exist, and can be efficiently computed from $V ^ { * }$ , the set of all dual solution to the ideal formulation of the integer program corresponding to $P$ ;
82
+
83
+ • if $P$ is primal-dual $\partial$ -efficient, then the generalized gradients of $A$ over w exist, and can be efficiently computed from $U ^ { * }$ and $V ^ { * }$ , as defined above.
84
+
85
+ Proof. A series of results (Gal, 1975; Freund, 1985; De Wolf & Smeers, 2000) shows that if the optimal objective value $\boldsymbol { z } ^ { * } = L P ( \boldsymbol { c } , A , b )$ for a linear program is finite at $( c , A , b )$ and in some neighborhood of $( c , A , b )$ , then generalized gradients of $z ^ { * }$ with respect to $c , b$ , and $A$ exist and are
86
+
87
+ $$
88
+ \begin{array} { r } { \partial { z } ^ { * } ( c ) = U ^ { * } , ~ \partial { z } ^ { * } ( b ) = V ^ { * } , ~ \partial { z } ^ { * } ( A ) = \left\{ - v { u } ^ { T } : ( u , v ) \in V ^ { * } \times U ^ { * } \right\} . } \end{array}
89
+ $$
90
+
91
+ We build on these results to obtain generalized gradients of the linear program corresponding to the combinatorial problem. For the first case in the theorem, definition 2 states that in the linear program corresponding to $P$ , only the cost vector $c$ depends on $w$ , through a (sub)differentiable function $c = c ( w )$ . Since $w$ is in the interior of the parameter domain $\mathcal { W }$ , the objective value is finite over some neighborhood of $w$ . Then,
92
+
93
+ $$
94
+ \partial z ^ { * } ( w ) = \partial z ^ { * } ( c ) \frac { \partial c } { \partial w } = \frac { \partial c } { \partial w } U ^ { * } ,
95
+ $$
96
+
97
+ where the generalized gradient $z ^ { * } ( c )$ exists and is equal to $U ^ { * }$ .
98
+
99
+ For the second case, the ideal formulation LP exists. Then, from definition 2 we have that
100
+
101
+ $$
102
+ \partial z ^ { * } ( w ) = \partial z ^ { * } ( b ) \frac { \partial b } { \partial w } = \frac { \partial b } { \partial w } V ^ { * } .
103
+ $$
104
+
105
+ The third case is a direct extension of the first two cases.
106
+
107
+ Theorem 1 indicates that black-box combinatorial algorithms can be used to expand the range of transformations that can be efficiently utilized in neural networks. One immediate area of application is using them to specify a loss function. Consider a network $F ( x ; { \boldsymbol { \beta } } )$ parameterized by a vector of tunable parameters $\beta$ . The network transforms a batch of input samples $x$ into a batch of outputs $\chi = F ( x ; \beta )$ . Then, in the broadest primal-dual $\partial$ -efficient case, $\chi$ is used, possibly with the true classes $y$ , to formulate parameters $\mathsf { \bar { ( } } c , A , b ) = g ( \chi , y )$ of a linear program corresponding to the combinatorial problem, through some (sub)differentiable function $g$ . For
108
+
109
+ # Algorithm 1 Minimization of a combinatorial loss
110
+
111
+ Input: batch $x \subset \mathcal { X }$ , $y \subset \mathcal { P }$ , network $F ( x ; { \boldsymbol { \beta } } )$ , functions $g , h$ , combinatorial algorithm Π
112
+ Output: Loss and its generalized gradient, $L ( \beta ) , \partial L ( \beta )$
113
+ 1: procedure $\boldsymbol { \mathrm { C O M B L O S S M I N } } ( x , y , \beta , F , g , h , \Pi )$
114
+ 2: forward pass $\chi = F ( x ; \beta )$
115
+ 3: forward pass $( c , A , b ) = g ( \chi , y )$
116
+ 4: run combinatorial solver to find optimal objective value $\boldsymbol { z } ^ { * } = \Pi ( c , A , b )$ and optimal primal and/or dual solution vectors $u ^ { * }$ , $v ^ { * }$
117
+ 5: forward pass $L ( \beta ) = h ( z ^ { * } )$
118
+ 6: backward pass through $h$ : $\partial L / \partial z ^ { * }$
119
+ 7: backward pass through Π: $\partial z ^ { * } ( c ) = u ^ { * } , \partial z ^ { * } ( b ) = v ^ { * } , \partial z ^ { * } ( A ) = - v ^ { * } { u ^ { * } } ^ { T }$
120
+ 8: backward pass through $g$ and $F$
121
+ 9: $\begin{array} { r } { \partial L ( \beta ) = \hat { \frac { \partial L } { \partial z } } \Big ( u ^ { * } \frac { \partial c } { \partial \beta } - v ^ { * } { u ^ { * } } ^ { T } \frac { \partial A } { \partial \beta } + v ^ { * } \frac { \partial b } { \partial \beta } \Big ) } \end{array}$
122
+ 10: return $L ( \beta )$ , $\partial L ( \beta )$
123
+ 11: end procedure
124
+
125
+ a given $\beta$ and given batch samples $( x , y )$ , we can then define loss as a function of the optimal objective value of the linear program corresponding to the combinatorial problem resulting from $g ( F ( x ; \beta ) , y )$ , ${ \cal L } ( \beta ) = h ( z ^ { * } \bar { ( } c , \bar { A } , b ) )$ . This approach, summarized in Algorithm 1, allows us to obtain the generalized gradient of the loss with respect to $\beta$ as long as functions $g$ and $h$ are differentiable. For clarity, in Algorithm 1, we did not consider functions $h$ depending not just on $z$ but also on $x$ or $y$ , but the extension is straightforward.
126
+
127
+ # 3 EXAMPLE USE CASES AND EXPERIMENTAL VALIDATION
128
+
129
+ 3.1 DIFFERENTIATING OVER BIPARTITE MATCHING FOR WEAKLY-SUPERVISED LEARNING
130
+
131
+ To illustrate gradient descent over a combinatorial loss, we first focus on a simple image recognition problem. Consider a photo of a group of people with a caption listing each of the persons in the picture, but missing the ”from left to right” part. Given a collection of such labeled photos, can a model learn to recognize individual faces? Similarly, consider a shopping cart and a printout from the register. Given a collection of unordered shopping carts together with matching receipts, can a model learn to recognize individual shopping items? These are example of a weakly-supervised learning where the goal is to learn to classify previously unseen feature vectors, but a training sample is a bag of feature vectors accompanied by a bag of correct labels, instead of a feature-vector and a correct label. We are not told which class belongs to which sample, which prevents us from directly using the standard cross-entropy loss.
132
+
133
+ More formally, consider a $d$ -class classification problem, and a model $F ( x _ { j } ; \beta )$ that for sample $x _ { j }$ returns a $d$ -dimensional vector of class probabilities, $p _ { j }$ , with $\mathbf { \Delta } _ { p _ { j } ^ { c } } ^ { p _ { j } ^ { c } }$ denoting the predicted conditional probability of class $c$ given feature vector $x _ { j }$ . Let $y _ { j }$ denote a $d$ -dimensional, one-hot representation of the true class label of sample $x _ { j }$ , with $y _ { j } ^ { c } = 1$ if sample $j$ is of class $c$ , and zero otherwise. In weakly supervised learning involving bags of size $b$ , we are given a tuple of $b$ feature vectors, $\boldsymbol { X } = \left( \boldsymbol { x } _ { j } \right) _ { j = 1 } ^ { b }$ , and a tuple of permuted labels Y = yσ(i)bi=1 as one-hot-vectors, for some permutation $\sigma$ ; we will refer to the $j$ -th element of the tuple $Y$ as $\bar { Y } _ { j }$ . The permutation $\sigma$ is unknown, thus using a loss $\ell ( p _ { j } , Y _ { j } ) = \ell ( p _ { j } , y _ { \sigma ( i ) } )$ to compare predicted distribution over classes for sample $j$ with one-hot representation of $j$ -th element in the randomly ordered set of true classes $Y _ { j }$ makes no sense, since most likely $i \neq j ; Y _ { j } = y _ { \sigma ( i ) }$ is the class for some other sample $i$ , not for sample $j$ .
134
+
135
+ While the permutation is unknown, with repeated presentation of bags of samples and bags of corresponding labels, we do have some information connecting the feature vector to classes. Intuitively, we can try to match model’s outputs for feature vectors in the bag to the class labels using the information in the probability distribution $p _ { j }$ over classes provided by the model for each feature vector $x _ { j }$ . That is, we can aim to find permutation $\hat { \sigma }$ optimal in the average loss sense $\begin{array} { r } { \operatorname* { m i n } _ { \hat { \sigma } } \sum _ { j = 1 } ^ { b } \ell ( p _ { j } , \hat { \sigma } ( \bar { Y } ) _ { j } ) , } \end{array}$ . If the class conditional probabilities $p _ { j }$ resulting from the model perfectly match the one-hot vectors, the optimal $\hat { \sigma }$ will be the inverse of the permutation $\sigma$ , that is, $\hat { \sigma } ( Y ) _ { j } = y _ { j }$ .
136
+
137
+ <table><tr><td>Algorithm 2 Loss based on bipartite matching for weakly-supervised image classification</td></tr><tr><td>Input: X = (𝑥j)j=1-bag of b input images; Y = (Yk)=1-aset of b sample classes to match,in</td></tr><tr><td>one-hot representation, in arbitrary order; β-ResNet18 network weights. Output: Loss (optimal matching cost) and its generalized gradient, L(β), ∂L(β)</td></tr><tr><td>1: procedure MATCHBAG(X,Y, β)</td></tr><tr><td>2: forward pass,class probabilities pj = softmax(ResNet18(xj; β)) for j = 1,.,b</td></tr><tr><td>3: forward pass,cross-entropy for all image-label pairs Cjk = {log pj,Yk) for j, k =1.,.., b</td></tr><tr><td>4: optimal matching cost and matching matrix: z*,M* = OptMatching(C),</td></tr><tr><td>i.e.,M* = arg minm(C,M)F, z* = (C,M*)F</td></tr><tr><td>5: final loss: cost of optimal matching L(β) = z*</td></tr><tr><td>6:</td></tr><tr><td>backward pass through bipartite matching Oz*(C) = M* 7: backward pass through cross-entropy, softmax and ResNet18: aL(β) = M* </td></tr><tr><td></td></tr></table>
138
+
139
+ A $b$ -element permutation can be represented by a $b \times b$ permutation matrix $M$ . To find $M$ , we define a $b \times b$ matrix $C$ with $C _ { j k } = \ell ( p _ { j } , \bar { Y } _ { k } )$ , where $\ell$ represents cross-entropy loss $\ell ( p , y ) = - \langle \log p , y \rangle$ , with the logarithm applied element-wise. The elements $C _ { j k }$ correspond to edge weight in a bipartite graph with the feature vectors $x$ processed by the neural network on one side, and labels $y$ on the other side. We use a combinatorial solver, for example the Hungarian method with computational complexity $O \left( b ^ { 3 } \right)$ , to find the the permutation matrix $M ^ { * } = \arg \operatorname* { m i n } _ { M } \langle C , M \rangle _ { F }$ minimizing the Frobenius inner product of $C$ and $M$ . The procedure is outlined in Algorithm 2.
140
+
141
+ To test the approach, we used the CIFAR100 benchmark image dataset. As a baseline, we trained 5 independent fully supervised models with ResNet18 architecture (Zagoruyko & Komodakis, 2016) (see Supplementary Material for details), that is, models where each image is a separate sample with its true class available for loss calculation. To evaluate the ability of our method to provide gradients of a combinatorial loss defined by weighted matching, during training we explored image bags of samples consisting of $b { = } 4$ , 8, 12, 16, 24, or 32 images, and including correct but shuffled image labels. We trained 5 independent models for each bag size with the loss and its gradient provided using Algorithm 2. To avoid situations where the combinatorial loss is superficially aided by bags with mostly one class, we ignored any bag that has less than $7 5 \%$ of different classes, that is, for bag of size 8, we only consider bags that consist of at least 6 different classes. During testing, same as in the baseline model experiments, each image had the matching label available for test error calculations. For comparison, we trained a model with the same setup of image bags using cvxpylayers (Agrawal et al., 2019), a recently proposed methods for differentiable layers defined by conic programs. In contrast to our approach, which uses a combinatorial algorithm and relies on the LP formulation of the weighted bipartite matching only conceptually, for the definition of gradients, cvxpylayers solve the linear program in order to obtain gradients. We also trained the same model using a recently proposed approach to approximate gradients of the optimal solution vector, not the optimal objective value, of a combinatorial problem (Vlastelica Poganciˇ c et al., 2020); we used the same combinatorial ´ solver as in the experiments with our method.
142
+
143
+ Test error for CIFAR100 of the training set reshuffled into bags after each epoch (Fig. 1, left) shows that for bag sizes up to twelve elements, weak supervision through weighted bipartite graph matching is almost as effective as supervised learning with true label available for each individual image, that is, bag of size one. Training using the bipartite matching loss was implemented in three different ways: through interpolated combinatorial gradients proposed in (Vlastelica Poganciˇ c et al., 2020), ´ through differentiable LP approach (cvxpylayers), and through the proposed approach for obtaining gradients of the objective value. All three approaches lead to very similar error rates (Fig. 1, left), indicating these three ways of obtaining gradients provide similar training signal to the network. The two methods that use combinatorial solvers are much more efficient than LP solver-based cvxpylayers (Fig. 1, right). The performance of the LP-based method decreases for very small bag sizes, where each epoch has large number of individual problems to solve, as well as for large bag sizes, where each problem to be solved involves more computation. Among the two methods using the same combinatorial solver, our proposed method is twice as fast as the interpolation method of (Vlastelica Poganciˇ c et al., 2020), which requires solving a combinatorial problem not only in the ´ forward pass, but also in the backwards pass in order to obtain gradients of the solution vector. These results show that the generalized gradient over combinatorial optimization is effective in providing training signal to train a large neural network, and can do it much faster than the state-of-the-art alternative approaches.
144
+
145
+ ![](images/762335fb3b62a0a4e91a1b574cd52b163b878a9f942bed11e1efe77b65477878.jpg)
146
+ Figure 1: Test set error (left) and total training time (right) for increasing bag sizes for classifiers trained using the proposed bipartite matching loss with gradients calculated using the proposed approach and, for comparison, using cvxpylayers (Agrawal et al., 2019) and using an interpolation approach for obtaining gradients of the solution vector of combinatorial problems (Vlastelica Poganciˇ c´ et al., 2020). A supervised model with true label available for each individual sample, which corresponds to bag of size one, is used as a baseline lower bound on the error that the bag-trained models should attempt to match. Mean, and the $9 5 \%$ confidence interval of the mean, are shown.
147
+
148
+ 3.2 DIFFERENTIATING OVER GLOBAL SEQUENCE ALIGNMENT FOR SENTENCE-LEVEL LOSS IN SEQUENCE-TO-SEQUENCE MODELS
149
+
150
+ Another use case where a combinatorial loss is advantageous occurs in to sequence-to-sequence natural language models. We used a standard encoder-decoder architecture for the model (see Supplementary Material for details). The encoder takes the source sequence on input and prepares a context vector capturing the source sequence. The decoder is a recurrent network that outputs the predicted sequence one token at a time, based on the context vector and the output of the previous step. The output of the decoder at a step $t$ is a vector of probabilities $p _ { t }$ over the set of all possible output tokens.
151
+
152
+ Existing encoder-decoder models use cross-entropy loss to compare predicted probabilities $p _ { t }$ to the target word at position $t$ , encoded as one-hot vector $y _ { t }$ . Instead of a sequence-level optimization, position-specific cross entropy loss results in an averaged token-level optimization. We hypothesize this has detrimental effect on the training process of differentiable sequence-to-sequence models that involve softmax or Gumbel-softmax (Jang et al., 2016) as the mechanism for feeding the output of the previous step of the decoder as input for the next step. For example, a recurrent model that learned to output almost all of the target sentence correctly but is still making the mistake of missing one word early in the sentence will have very high loss at all the words following the missing word – correcting the mistake should involve keeping most of the model and focusing on the missing word, but with position-specific loss, all the outputs are considered wrong and in need of correction.
153
+
154
+ Gaps or spurious words in the output sequence can be treated naturally if we consider global sequence alignment (GSA) as the loss. Global sequence alignment (Needleman & Wunsch, 1970) is a combinatorial problem in which two sequences are aligned by choosing, at each position, to either match a token from one sequence to a token from the other, or to introduce a gap in one or the other sequence; each choice has a cost (see Fig. 2). In sequence-to-sequence modeling, the cost of matching the decoder’s output from position $i$ to the target sequence token as position $k$ will be given by $\langle - \log p _ { i } , y _ { k } \rangle$ . The cost of a gap, that is, of a horizontal or a vertical move in Fig. 2, is specified in a way that promotes closing of the gap; we use the cost of diagonal move from that position as the cost of the gap, multiplied by a scalar $\gamma > 1$ to prioritize closing the gaps over improving the matchings. In our experiments, we used $\gamma = 1 . 5$ . The GSA problem can stated as a linear program with $p$ variables and $m + 1$ constraints, with the costs of the moves forming the right-hand side of the constraints. Thus, by Theorem 1, the generalized gradient of the minimum global sequence alignment with respect to matching and gap costs is efficiently available.
155
+
156
+ ![](images/f1807f4eb7e544f2d35eef2bff8d22e78796f032794eb978d4ec25eb1d5f71f3.jpg)
157
+ Figure 2: A directed acyclic graph (DAG) corresponding to the global sequence alignment between the target sequence and the sequence predicted by the RNN model. Each node, except the end of sequence indicator $< / >$ , has out-degree of three: a diagonal edge corresponding to a match between the predicted and the target sequence, a horizontal edge corresponding to a gap in the predicted sequence, and a vertical edge corresponding to a gap in the target sequence. Optimal sequence alignment is depicted in red, with the weights – the alignment costs – of the selected edges in blue.
158
+
159
+ In experiments involving global sequence alignment in sequence-to-sequence models, we used an encoder-decoder sequence-to-sequence architecture with bidirectional forward-backward RNN encoder and an attention-based RNN decoder (Luong et al., 2015), as implemented in PyTorch-Texar (Hu et al., 2018). While this architecture is no longer the top performer in terms of ROUGE metric – currently, large pre-trained self-attention models are the state-of-the-art – it is much more efficient in training, allowing for experimenting with different loss functions. During inference, we used beam search. During training, to have a differentiable decoder, we use two alternative approaches. First, we feed the probabilities resulting from the softmax layer applied to the outputs of the RNN directly as the recursive inputs to the RNN. Second, inputs to the RNN are provided by the straight-through Gumbel-softmax distribution (Jang et al., 2016) based on the outputs of the RNN, which is an approximation of the categorical distribution from which one-hot, single-token outputs are sampled. In both cases, as a baseline for comparisons with the GSA-based loss, we use word-level maximum likelihood, that is, cross-entropy between the probability vector on output of the softmax layer of the RNN and the desired target word at that position. In evaluating the combinatorial GSA loss, we used text summarization task involving the GIGAWORD dataset (Graff & Cieri, 2003) as an example of a sequence-to-sequence problem. We used test set ROUGE 1, 2, and L scores (Lin, 2004) as the measure of quality of the summarizations.
160
+
161
+ The results in Table 1 show that the GSA-based loss leads to improved text summarization results in all three ROUGE metrics compared to position-specific cross-entropy maximum likelihood training, both for the softmax and the Gumbel-softmax approach for providing the recursive input to the RNN in a differentiable way. The increase in accuracy comes at the cost of doubling the training time when our method is used to provide gradients of the optimal alignment score. A similar increased accuracy can be observed when the interpolation approach (Vlastelica Poganciˇ c et al., 2020) for gradients of ´ optimal alignment path is used instead, but the interpolation method further increases the training time, by a factor of two compared to our method. The proposed combinatorial approach is much more accurate and efficient than the recently proposed cvxpylayers method. The running time for the cvxpylayers approach is orders of magnitude slower. The cvxpylayers solver managed to reduce the training loss for several initial epochs, after which solver errors start to occur and the learning process diverges. In order to confirm this behavior, we performed 3 additional runs of the cvxpylayers-based training for the softmax model. In all cases, the loss dropped from the initial value in the 90-95 range to above 50, after which it increased to 500 or more. For comparison, the proposed combinatorial loss approach and the standard cross-entropy approach reach loss in the 30-32 range by epoch 10.
162
+
163
+ Table 1: Results for the GIGAWORD text summarization task using ROUGE-1, ROUGE-2, and ROUGE-L metrics. For the position-specific cross-entropy loss (MLE), for the interpolated combinatorial gradient (GSA-I) (Vlastelica Poganciˇ c et al., 2020) applied to global sequence alignment, and ´ for our combinatorial method (GSA-L), results are given as mean(std.dev.) over five independent runs with different random seed. For the method involving cvxpylayers (GSA-C) (Agrawal et al., 2019) applied to GSA, we only performed one run. We report test set values for the epoch that minimizes the total ROUGE score on a separate validation set. Time is per one epoch.
164
+
165
+ <table><tr><td>Loss Type</td><td>ROUGE-Total</td><td>ROUGE-1</td><td>ROUGE-2</td><td>ROUGE-L</td><td>Epoch</td><td>Time</td></tr><tr><td colspan="7">Softmax</td></tr><tr><td>MLE</td><td>72.80(0.38)</td><td>32.45(0.15)</td><td>11.95(0.22)</td><td>28.39(0.20)</td><td>18.4(1.5)</td><td>8 min</td></tr><tr><td>GSA- C</td><td>32.18</td><td>17.04</td><td>2.49</td><td>12.65</td><td>3</td><td>9 hr</td></tr><tr><td>GSA-I</td><td>75.87(0.82)</td><td>33.94(0.31)</td><td>12.03(0.35)</td><td>29.90(0.32)</td><td>13.4(3.4)</td><td>32 min</td></tr><tr><td>GSA-L</td><td>76.36(0.60)</td><td>34.05(0.21)</td><td>12.31(0.20)</td><td>29.99(0.24)</td><td>15.4(2.5)</td><td>17 min</td></tr><tr><td colspan="7">Gumbel-softmax</td></tr><tr><td>MLE</td><td>67.50(0.20)</td><td>31.25(0.18)</td><td>9.72(0.26)</td><td>26.52(0.08)</td><td>18.0(2.8)</td><td>9 min</td></tr><tr><td>GSA-I</td><td>73.36(0.33)</td><td>33.44(0.16)</td><td>10.90(0.05)</td><td>29.01(0.14)</td><td>14.8(2.3)</td><td>32 min</td></tr><tr><td>GSA-L</td><td>72.62(0.51)</td><td>33.25(0.15)</td><td>10.60(0.22)</td><td>28.77(0.17)</td><td>14.0(1.9)</td><td>17 min</td></tr></table>
166
+
167
+ # 4 RELATED WORK
168
+
169
+ Recently, (Tschiatschek et al., 2018) proposed an approximate solver for submodular function maximization that uses differentiable elements and allows for differentiating through the solver. Differentiable solvers are also considered in (Mensch & Blondel, 2018), where dynamic programming solver is re-implemented with the maximum operation replaced by smoothed max. Similar approach is used in differentiable dynamic time warping (Chang et al., 2019). Several authors used a differential approximation to linear program solutions instead of introducing differentiable operations into combinatorial algorithms. WGAN-TS (Liu et al., 2018) solves an LP to obtain the exact empirical Wasserstein distance. Then, to circumvent lack of differentiability of linear programs, WGAN-TS proceeds by training a neural network to approximate the LP solution in order to obtain gradients. In seq2seq-OT (Chen et al., 2019), an approximation is used to model optimal transport between word embeddings serving as a regularizer in training sequence-to-sequence models. These approximation approaches are limited to specific problems and preclude using off-the-shelf combinatorial solvers.
170
+
171
+ Recently, an approach that relies on interpolation to obtain gradients of the optimal solution vector – not optimal objective value as in our method – produced by combinatorial solvers has been proposed (Vlastelica Poganciˇ c et al., 2020; Rol ´ ´ınek et al., 2020). Similar to our approach, it allows for using off-the-shelf, black-box implementations of combinatorial algorithms. However, unlike our approach, it requires two executions of the solver, one in the forward phase, and a second execution for a slightly perturbed problem for the backward phase. As can be seen in our experiments, this results in doubling the performance overhead compared to our approach.
172
+
173
+ An alternative approach is to use mathematical programming solvers in gradient-trained neural networks. OptNet (Amos & Kolter, 2017) provides differentiable quadratic programming layers, and an efficient GPU-based batch solver, qpth. Cvxpylayers (Agrawal et al., 2019) generalizes this approach to a broad class of convex optimization problems expressed as cone programs, which include QP and LP as special cases, using conic solver based on ADMM, providing a general-purpose package based on the easy-to-use interface of cvxpy, with speed comparable to qpth for QP problems. Other authors (Wilder et al., 2019; Ferber et al., 2019) focus on LP problems, regularize them by adding the quadratic term, and use a QP solver as in OptNet to obtain the optimal solution vector and its gradient. Quadratic smoothing is also used in (Djolonga & Krause, 2017) in submodular set function minimization. While these methods can handle broader class of problems than our method, the reliance on quadratic or linear programming solvers translates to increased solving time. In the approach proposed here, linear programming is used only as a theoretical tool that allows for defining a mapping from the solution to a combinatorial problem to the gradient of its objective value. The solution is obtained by a single run of a combinatorial algorithm, which, as our experiments confirm, is faster than using mathematical programming and not affected by numerical instability and convergence problems.
174
+
175
+ # REFERENCES
176
+
177
+ Akshay Agrawal, Brandon Amos, Shane Barratt, Stephen Boyd, Steven Diamond, and J Zico Kolter. Differentiable convex optimization layers. In Advances in Neural Information Processing Systems, pp. 9558–9570, 2019.
178
+
179
+ Brandon Amos and J Zico Kolter. Optnet: Differentiable optimization as a layer in neural networks. In Proceedings of the 34th International Conference on Machine Learning, pp. 136–145, 2017.
180
+
181
+ Yuri Boykov, Olga Veksler, and Ramin Zabih. Fast approximate energy minimization via graph cuts. IEEE Transactions on Pattern Analysis and Machine Intelligence, 23(11):1222–1239, 2001.
182
+
183
+ Chien-Yi Chang, De-An Huang, Yanan Sui, Li Fei-Fei, and Juan Carlos Niebles. D3TW: Discriminative differentiable dynamic time warping for weakly supervised action alignment and segmentation. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2019.
184
+
185
+ Liqun Chen, Yizhe Zhang, Ruiyi Zhang, Chenyang Tao, Zhe Gan, Haichao Zhang, Bai Li, Dinghan Shen, Changyou Chen, and Lawrence Carin. Improving sequence-to-sequence learning via optimal transport. In International Conference on Learning Representations, pp. arXiv:1901.06283, 2019.
186
+
187
+ Frank H Clarke. Generalized gradients and applications. Transactions of the American Mathematical Society, 205:247–262, 1975.
188
+
189
+ Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. Introduction to Algorithms, Third Edition. The MIT Press, 3rd edition, 2009.
190
+
191
+ Sanjoy Dasgupta, Christos H Papadimitriou, and Umesh Virkumar Vazirani. Algorithms. McGrawHill Higher Education, 2008.
192
+
193
+ Daniel De Wolf and Yves Smeers. Generalized derivatives of the optimal value of a linear program with respect to matrix coefficients. In Technical report. Universite Catholique de Louvain, 2000. ´
194
+
195
+ Josip Djolonga and Andreas Krause. Differentiable learning of submodular models. In Advances in Neural Information Processing Systems, pp. 1013–1023, 2017.
196
+
197
+ LawrenceCraig Evans. Measure theory and fine properties of functions. Routledge, 1992.
198
+
199
+ Aaron Ferber, Bryan Wilder, Bistra Dilina, and Milind Tambe. MIPaaL: Mixed integer program as a layer. arXiv preprint arXiv:1907.05912, 2019.
200
+
201
+ Robert M Freund. Postoptimal analysis of a linear program under simultaneous changes in matrix coefficients. In Mathematical Programming Essays in Honor of George B. Dantzig Part I, pp. 1–13. Springer, 1985.
202
+
203
+ Tomas Gal. Rim multiparametric linear programming. Management Science, 21(5):567–575, 1975.
204
+
205
+ David Graff and C Cieri. English Gigaword corpus. Linguistic Data Consortium, 2003.
206
+
207
+ Zhiting Hu, Haoran Shi, Bowen Tan, Wentao Wang, Zichao Yang, Tiancheng Zhao, Junxian He, Lianhui Qin, Di Wang, et al. Texar: A modularized, versatile, and extensible toolkit for text generation. arXiv preprint arXiv:1809.00794, 2018.
208
+
209
+ Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with Gumbel-softmax. In International Conference on Learning Representations ICLR’17. arXiv:1611.01144, 2016.
210
+
211
+ Stefan Lendl, Ante Custi ´ c, and Abraham P Punnen. Combinatorial optimization with interaction ´ costs: Complexity and solvable cases. Discrete Optimization, 33:101–117, 2019.
212
+
213
+ Chin-Yew Lin. Rouge: A package for automatic evaluation of summaries. In Text summarization branches out, pp. 74–81, 2004.
214
+
215
+ Di Lin, Jifeng Dai, Jiaya Jia, Kaiming He, and Jian Sun. Scribblesup: Scribble-supervised convolutional networks for semantic segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3159–3167, 2016.
216
+
217
+ Huidong Liu, Xianfeng Gu, and Dimitris Samaras. A two-step computation of the exact GAN Wasserstein distance. In International Conference on Machine Learning, pp. 3165–3174, 2018.
218
+
219
+ Minh-Thang Luong, Hieu Pham, and Christopher D Manning. Effective approaches to attention-based neural machine translation. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 1412––1421, 2015.
220
+
221
+ Dmitrii Marin, Meng Tang, Ismail Ben Ayed, and Yuri Boykov. Beyond gradient descent for regularized segmentation losses. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
222
+
223
+ R Kipp Martin. Using separation algorithms to generate mixed integer model reformulations. Operations Research Letters, 10(3):119–128, 1991.
224
+
225
+ Arthur Mensch and Mathieu Blondel. Differentiable dynamic programming for structured prediction and attention. In Proceedings of the 35th International Conference on Machine Learning, pp. 3462–3471, 2018.
226
+
227
+ Saul B Needleman and Christian D Wunsch. A general method applicable to the search for similarities in the amino acid sequence of two proteins. Journal of molecular biology, 48(3):443–453, 1970.
228
+
229
+ Nicholas J Redding and Tom Downs. Learning in feedforward networks with nonsmooth functions. In Advances in Neural Information Processing Systems, pp. 1056–1063, 1992.
230
+
231
+ Michal Rol´ınek, Paul Swoboda, Dominik Zietlow, Anselm Paulus, V´ıt Musil, and Georg Martius. Deep graph matching via blackbox differentiation of combinatorial solvers. arXiv preprint arXiv:2003.11657, 2020.
232
+
233
+ Alexander Schrijver. Combinatorial optimization: polyhedra and efficiency, volume 24. Springer Science & Business Media, 2003.
234
+
235
+ Sebastian Tschiatschek, Aytunc Sahin, and Andreas Krause. Differentiable submodular maximization. In Proceedings of the 27th International Joint Conference on Artificial Intelligence, IJCAI’18, pp. 2731–2738. AAAI Press, 2018. ISBN 9780999241127.
236
+
237
+ Marin Vlastelica Poganciˇ c, Anselm Paulus, Vit Musil, Georg Martius, and Michal Rolinek. Differenti- ´ ation of blackbox combinatorial solvers. In International Conference on Learning Representations, 2020.
238
+
239
+ Bryan Wilder, Bistra Dilkina, and Milind Tambe. Melding the data-decisions pipeline: Decisionfocused learning for combinatorial optimization. In The Thirty-Third Conference on Artificial Intelligence (AAAI), pp. 1658–1665, 2019.
240
+
241
+ Laurence Wolsey. Strong formulations for mixed integer programming: a survey. Mathematical Programming, 45(1):173–191, 1989.
242
+
243
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In International Conference on Learning Representations ICLR’17. arXiv:1605.07146, 2016.
244
+
245
+ 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/wTutcPE7zOC/wTutcPE7zOC.md ADDED
@@ -0,0 +1,444 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Metropolis-CVAE: Bootstrapping Labels for Bayesian Inference via Semi-Supervised Conditional Variational Autoencoders
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 In Bayesian parameter estimation, models make simplifying assumptions to make
11
+ 2 parameter inference feasible. If learned inference methods are trained using data
12
+ 3 simulated by models, however, distributional differences between simulated and
13
+ 4 observed data may lead to biased inference results on the observed data. In this
14
+ 5 work, we introduce a semi-supervised learned Bayesian inference method which
15
+ 6 makes use of both simulated data – for which the underlying parameters are known
16
+ 7 by construction – and unlabeled data, which may depend on nuissance parameters
17
+ 8 not captured by the simulation procedure. A conditional variational autoencoder
18
+ 9 (CVAE) is trained to perform approximate inference simultaneously on the sets of
19
+ 10 labeled simulated data and unlabeled data, where the unlabeled data is initialized
20
+ 11 with arbitrary pseudo labels. At each training iteration, new candidate pseudo
21
+ 12 labels are drawn from the CVAE posterior and the pseudo labels are updated using
22
+ 13 the Metropolis-Hastings algorithm. This process results in a Markov chain of
23
+ 14 bootstrapped pseudo labels for each unlabeled datum, effectively performing online
24
+ 15 Markov chain Monte Carlo (MCMC) inference wherein the proposal distribution
25
+ 16 is a CVAE informed by labeled simulated data, producing proposals which are
26
+ 17 increasingly likely to be accepted as training proceeds. The resulting CVAE is
27
+ 18 able to efficiently produce samples from the posterior distributions of both the
28
+ 19 simulated and unlabeled data, implicitly marginalizing over nuissance parameters
29
+ 20 in the unlabeled data. We demonstrate the effectiveness of this method in magnetic
30
+ 21 resonance imaging (MRI) where MCMC is computationally impractical to due the
31
+ 22 $( 3 + 1 ) \mathrm { D }$ nature of the images, showing improvement against traditional MCMC
32
+ 23 inference in both speed and posterior quality.
33
+
34
+ # 24 1 Introduction
35
+
36
+ 25 Bayesian parameter estimation methods are robust techniques for quantifying properties of a system
37
+ 26 that cannot be observed directly [1]. In order to estimate such parameters, one first needs to develop
38
+ 27 a model of the phenomena to be studied. This process requires deep domain-specific knowledge. For
39
+ 28 all but the most basic of systems, a series of simplifying assumptions on the system are required to
40
+ 29 make parameter inference tractable. Typically, tractable is synonymous with not being unreasonably
41
+ 30 expensive to compute. Examples of such methodologies include perturbation theory, in which models
42
+ 31 containing Taylor series expansions drop higher order terms; mean-field theory, in which interactions
43
+ 32 involving many degrees of freedom are replaced by averaged approximations; and (stochastic)
44
+ 33 differential equations, when used as continuous limits of discrete stochastic processes. The price one
45
+ 34 pays for utilizing a given approximation is highly problem dependent. When approximate models
46
+ 35 are used for parameter inference, the mismatch between model predictions and data may propagate
47
+ 36 through the inference process and lead to bias and other misestimations of the inferred parameters. In
48
+ 37 this work, we are interested in the following research question: can a deep learning model be trained
49
+ 38 to perform inference, while incorporating both labeled data generated from a well-understood model,
50
+ 39 and unlabeled data which contains additional complex structure which cannot be modeled?
51
+ 40 Here, we present Metropolis conditional variational autoencoders (Metropolis-CVAEs). Metropolis
52
+ 41 CVAEs combine traditional CVAEs with the Metropolis-Hastings Markov chain monte carlo (MCMC)
53
+ 42 inference method. The resulting networks combine the ability of CVAEs to learn to perform rapid
54
+ 43 approximate Bayesian inference from labeled data with traditional MCMC methodology which
55
+ 44 requires only a likelihood model and a prior distribution over the parameters of interest. The
56
+ 45 Metropolis-CVAE initializes the unlabeled data with pseudo labels drawn from the prior distribution
57
+ 46 and, informed by the labeled data, iteratively improves the pseudo labels throughout training. We
58
+ 47 demonstrate the effectiveness of the Metropolis-CVAE network compared to traditional MCMC
59
+ 48 methods on an inference problem from magnetic resonance imaging (MRI) which is inherently
60
+ 49 computationally challenging due to the $( 3 + 1 ) \mathrm { D }$ nature of the data.
61
+
62
+ # 2 Methods
63
+
64
+ # 2.1 Related work
65
+
66
+ In the pioneering work by Sohn et al. [2], conditional variational autoencoders were introduced by considering a variational lower bound to the conditional log-likelihood $\log p ( \mathbf { y } | \mathbf { x } )$ of labels $\mathbf { y }$ given corresponding data $\mathbf { x }$ . Ideally, to perform data-driven approximate inference, one would like to train a network to learn to maximize the conditional log-likelihood directly. However, this is known to be an intractable problem. To mitigate this issue, the stochastic gradient variational Bayes (SGVB) framework is employed. In SGVB, a latent space which factorizes the marginal likelihood is introduced via $\begin{array} { r } { p ( \mathbf { y } | \mathbf { x } ) = \int _ { \mathbf { z } } \mathrm { d } \mathbf { z } p ( \mathbf { z } | \mathbf { x } ) p ( \mathbf { y } | \mathbf { z } , \mathbf { x } ) } \end{array}$ , as well as a recognition distribution $q ( \mathbf { z } | \mathbf { x } , \mathbf { y } )$ . The conditional log-likelihood is then maximized indirectly via maximizing the variational lower bound
67
+
68
+ $$
69
+ \begin{array} { r l } & { \log p ( \mathbf { y } | \mathbf { x } ) \geq - \mathrm { K L } \left( q ( \mathbf { z } | \mathbf { x } , \mathbf { y } ) \left| \right| p ( \mathbf { z } | \mathbf { x } ) \right) + \mathbb { E } _ { q ( \mathbf { z } | \mathbf { x } , \mathbf { y } ) } \left[ \log p ( \mathbf { y } | \mathbf { x } , \mathbf { z } ) \right] } \\ & { \qquad : = - \mathcal { L } ( \mathbf { x } , \mathbf { y } ) } \end{array}
70
+ $$
71
+
72
+ 60 where $\mathrm { K L }$ is the Kullback-Leibler divergence. The interpretation as a conditional autoencoder is
73
+ 61 as follows: let $p ( \mathbf { z } | \mathbf { x } )$ , $q ( \mathbf { z } | \mathbf { x } , \mathbf { y } )$ , and $p ( \mathbf { y } | \mathbf { x } , \mathbf { z } )$ be parameterized by deep neural networks $E _ { 1 } ( \mathbf { z } | \mathbf { x } )$ ,
74
+ 62 $E _ { 2 } ( \mathbf { z } | \mathbf { x } , \mathbf { y } )$ , and $D ( \mathbf { y } | \mathbf { x } , \mathbf { z } )$ , respectively. Then, $E _ { 1 }$ and $E _ { 2 }$ can be viewed as encoders which map
75
+ 63 their inputs into distributions over the latent variables $\mathbf { z }$ . $D$ can be viewed as a decoder which maps
76
+ 64 stochastic latent representations $\mathbf { z }$ and data $\mathbf { x }$ into posterior distributions over the labels y. Hence, $\mathbf { y }$
77
+ 65 is conditionally autoencoded via the encoder-decoder pipeline $\mathbf { z } \sim E _ { 2 } ( \mathbf { z } | \mathbf { x } , \mathbf { y } ) \mathbf { y } \sim D ( \mathbf { y } | \mathbf { x } , \mathbf { z } )$ .
78
+ 66 At inference time, posterior samples are similarly drawn via $\mathbf { z } \sim E _ { 1 } ( \mathbf { z } | \mathbf { x } ) \mathbf { y } \sim D ( \mathbf { y } | \mathbf { x } , \mathbf { z } )$ . The
79
+ 67 CVAE – the triplet of networks $( E _ { 1 } , E _ { 2 } , D ) -$ is trained by minimizing $\mathcal { L }$ over the CVAE parameters,
80
+ 68 thereby maximizing the variational lower bound on $\log p ( \mathbf { y } | \mathbf { x } )$ .
81
+ 69 The CVAE approach by Sohn et al. [2] is designed for supervised learning problems. Earlier work of
82
+ 70 a similar vein by Kingma et al. [3] introduces a semi-supervised framework in which labeled data
83
+ 71 $\left( \mathbf { x } _ { \ell } , \mathbf { y } \right)$ is used to infer labels for unlabeled data $\mathbf { x } _ { u }$ via the minimization of a two-term loss function.
84
+ 72 The first term of the loss function is a supervised loss over $\left( \mathbf { x } _ { \ell } , \mathbf { y } \right)$ samples, similar to Equation 1,
85
+ 73 derived from a variational lower bound on the joint log-likelihood $\log p ( \mathbf { x } _ { \ell } , \mathbf { y } )$ . The second term is an
86
+ 74 unsupervised loss over $\mathbf { x } _ { u }$ samples which treats label inference as a data imputation task. Specifically,
87
+ 75 the unknown label is treated as a parameter over which posterior inference is performed; the resulting
88
+ 76 loss is a variational lower bound on the log-likelihood $\bar { \log { p ( \mathbf { x } _ { u } ) } }$ .
89
+ 77 While the semi-supervised method of Kingma et al. is an elegant approach to discovering labels,
90
+ 78 it is not quite suitable for inferring labels for out of distribution data. This is due to the implicit
91
+ 79 assumption that relationships between $\mathbf { x } _ { \ell }$ and $\mathbf { y }$ learned from the joint distribution $p ( \mathbf x _ { \ell } , \mathbf y )$ generalize
92
+ 80 to data from $p ( \mathbf { x } _ { u } )$ . In fact, this assumption is made explicit via an extended objective function which
93
+ 81 adds a regularization term $\mathbb { E } _ { \widetilde { p } _ { \ell } ( \mathbf { x } , \mathbf { y } ) } \left[ - \log q ( \mathbf { y } | \mathbf { x } _ { \ell } ) \right]$ over the empirical distribution $\widetilde { p } _ { \ell } ( \mathbf { x } , \mathbf { y } )$ of labeled
94
+ 82 edata. This penalty encourages the learned posterior distribution $q ( \mathbf { y } \vert \mathbf { x } )$ e to generate labels for $\mathbf { x } _ { u }$ by
95
+ 83 extrapolating from the relationships it discovers between $\left( \mathbf { x } _ { \ell } , \mathbf { y } \right)$ pairs. This will naturally lead to
96
+ 84 biased labels for $\mathbf { x } _ { u }$ when the distribution underlying $\mathbf { x } _ { u }$ differs from that of $\mathbf { x } _ { \ell }$ .
97
+ 85 Gabbard et al., who made use of CVAEs to accelerate inference for an application in gravitational
98
+ 86 wave astronomy [4], presented an alternate view of Equation 1. Gabbard et al. begin by aiming to
99
+ 87 minimize the expected cross-entropy
100
+
101
+ $$
102
+ \mathcal { H } : = - \mathbb { E } _ { p ( \mathbf { x } ) } \left[ \int _ { \mathbf { y } } \mathrm { d } \mathbf { y } p ( \mathbf { y } | \mathbf { x } ) \log \hat { p } ( \mathbf { y } | \mathbf { x } ) \right]
103
+ $$
104
+
105
+ 88 over the data distribution $p ( \mathbf { x } )$ between the true posterior $p ( \mathbf { y } \vert \mathbf { x } )$ and approximate posterior ${ \hat { p } } ( \mathbf { y } | \mathbf { x } )$ . Employing the SGVB framework and letting 89 $\begin{array} { r } { \hat { p } ( \mathbf { y } | \mathbf { x } ) = \int _ { \mathbf { z } } \mathrm { d } \mathbf { z } \hat { p } ( \mathbf { z } | \mathbf { x } ) \hat { p } ( \mathbf { y } | \mathbf { z } , \mathbf { x } ) } \end{array}$ , it follows from 1 that
106
+
107
+ $$
108
+ \mathcal { H } \leq \mathbb { E } _ { p ( \mathbf { x } ) } \left[ \int _ { \mathbf { y } } \mathrm { d } \mathbf { y } p ( \mathbf { y } | \mathbf { x } ) \mathcal { L } ( \mathbf { x } , \mathbf { y } ) \right] .
109
+ $$
110
+
111
+ 90 Applying Bayes’ theorem, we equivalently have that
112
+
113
+ $$
114
+ \begin{array} { r l } & { \mathcal { H } \leq \mathbb { E } _ { p ( \mathbf { x } ) } \mathbb { E } _ { p ( \mathbf { y } \mid \mathbf { x } ) } \left[ \mathcal { L } ( \mathbf { x } , \mathbf { y } ) \right] } \\ & { \quad = \mathbb { E } _ { p ( \mathbf { y } ) } \mathbb { E } _ { p ( \mathbf { x } \mid \mathbf { y } ) } \left[ \mathcal { L } ( \mathbf { x } , \mathbf { y } ) \right] } \\ & { \quad = \mathbb { E } _ { p ( \mathbf { x } , \mathbf { y } ) } \left[ \mathcal { L } ( \mathbf { x } , \mathbf { y } ) \right] . } \end{array}
115
+ $$
116
+
117
+ 91 Therefore, maximizing the variational lower bound to $\log p ( \mathbf { y } | \mathbf { x } )$ over a dataset of $\displaystyle ( \mathbf { x } , \mathbf { y } )$ pairs, as in
118
+ 92 Equation 1, is equivalent to minimizing the expected cross-entropy via Equation 6. The interpretation
119
+ 93 of Equations 4 and 5, however, will prove useful for remedying the issue of label inference for out of
120
+ 94 distribution data.
121
+
122
+ # 95 2.2 Theoretical contributions
123
+
124
+ 96 Equation 5 is a natural framework for using CVAEs to perform inference on simulated data with
125
+ 97 known labels [4]. Suppose labels $\mathbf { y } \sim p ( \mathbf { y } )$ are sampled from a prior distribution and $\mathbf { x } \sim p ( \mathbf { x } | \mathbf { y } )$
126
+ 98 is subsequently given by a (possibly stochastic) model function $\mathbf { x } = f ( \mathbf { y } )$ . Then, Equation 5
127
+ 99 corresponds to minimizing the average CVAE loss $\mathcal { L } ( \mathbf { x } , \mathbf { y } )$ over pairs of simulated data $( \mathbf { x } = f ( \mathbf { y } ) , \mathbf { y } )$ .
128
+ 100 The novel contribution of this work stems from of Equation 4. Using this formulation directly would
129
+ 101 require sampling from the posterior $p ( \mathbf { y } \vert \mathbf { x } )$ , which is our stated objective. However, this can be
130
+ 102 circumvented by making the observation that if we could construct a Markov chain of pseudo labels
131
+ 103 $\widetilde { \mathbf { y } }$ during training, such that the stationary distribution of the sequence $( \widetilde { \mathbf { y } } _ { k } ) _ { k \in \mathbb { N } }$ was $p ( \mathbf { y } \vert \mathbf { x } )$ , then
132
+ 104 eEquation 4 could be approximated as
133
+
134
+ $$
135
+ \mathbb { E } _ { p ( \mathbf { x } ) } \mathbb { E } _ { p ( \mathbf { y } | \mathbf { x } ) } \left[ \mathcal { L } ( \mathbf { x } , \mathbf { y } ) \right] \approx \mathbb { E } _ { p ( \mathbf { x } ) } \left[ \frac { 1 } { L _ { c } } \sum _ { i = 0 } ^ { L _ { c } - 1 } \mathcal { L } ( \mathbf { x } , \widetilde { \mathbf { y } } _ { n - i } ) \right]
136
+ $$
137
+
138
+ 105 where $( \widetilde { \mathbf { y } } _ { n - L _ { c } + 1 } , \ldots , \widetilde { \mathbf { y } } _ { n } )$ are the $L _ { c }$ most recent samples in the Markov chain. This approach to
139
+ 106 e edistribution sampling – Markov chain Monte Carlo (MCMC) sampling – is considered the gold
140
+ 107 standard in parameter inference.
141
+ 108 In this work, we consider the Metropolis-Hastings (MH) algorithm [5, 6]. In the context of Bayesian
142
+ 109 inference for recovering labels $\mathbf { y }$ from data $\mathbf { x }$ , MH sampling begins with a prior distribution $p ( \mathbf { y } )$ , a
143
+ 110 likelihood function $p ( \mathbf { x } | \mathbf { y } )$ , and a proposal distribution $Q ( \mathbf { y } ^ { \prime } | \mathbf { y } )$ which quantifies the probability of
144
+ 111 transitioning from y to $\mathbf { y } ^ { \prime }$ in the space of possible labels. Given a sample ${ \bf y } _ { n }$ of a Markov chain, the
145
+ 112 MH update rule is given by
146
+
147
+ ![](images/97cf94220a9e5f30dc3213d1f093a81f544c1b859c6af51de3cb1c59aca7af8f.jpg)
148
+ Figure 1: (A-G) Comparison of inference results for data simulated using Equation 14 with parameters drawn from Equation 17. Histograms of errors between the means of the empirical distributions and the true labels are shown. $\mathrm { ( H ) }$ ) p-p plot for each label. In all plots, MCMC with 100 samples, MCMC with 3000 samples, and Metropolis-CVAE with 100 samples are shown in red, green, and blue, respectively.
149
+
150
+ $$
151
+ \begin{array} { r l } & { \mathbf { y } ^ { \prime } \sim Q ( \mathbf { y } ^ { \prime } | \mathbf { y } _ { n } ) } \\ & { \alpha = \operatorname* { m i n } ( 1 , \frac { p ( \mathbf { y } ^ { \prime } ) } { p ( \mathbf { y } _ { n } ) } \cdot \frac { p ( \mathbf { x } | \mathbf { y } ^ { \prime } ) } { p ( \mathbf { x } | \mathbf { y } _ { n } ) } ) } \\ & { u \sim \mathrm { U n i f o r m } ( 0 , 1 ) } \\ & { \mathbf { y } _ { n + 1 } = \{ \mathbf { y } ^ { \prime } \quad u \leq \alpha } \\ & { \mathbf { y } _ { n } + \mathrm { o t h e r w i s e } . } \end{array}
152
+ $$
153
+
154
+ 113 The proposal distribution $Q ( \mathbf { y } ^ { \prime } | \mathbf { y } )$ is a free parameter of the MH algorithm. In general, choosing $Q$
155
+ 114 to resemble the true posterior as closely as possible improves the efficiency of the MH algorithm.
156
+ 115 Therefore, we propose to use the approximate posterior ${ \hat { p } } ( \mathbf { y } | \mathbf { x } )$ of the CVAE itself as the proposal
157
+ 116 distribution. Recalling that $\begin{array} { r } { \hat { p } ( { \bf y } | { \bf x } ) = \int _ { \bf z } \mathrm { d } { \bf z } \hat { p } ( { \bf z } | { \bf x } ) \hat { p } ( { \bf y } | { \bf z } , { \bf x } ) : = \int _ { \bf z } \mathrm { d } { \bf z } E _ { 1 } ( { \bf z } | { \bf x } ) D ( { \bf y } | { \bf z } , { \bf x } ) } \end{array}$ , we let
158
+
159
+ $$
160
+ \begin{array} { r l r } { { Q ( \mathbf { y } ^ { \prime } | \mathbf { y } _ { n } ) = Q ( \mathbf { y } ^ { \prime } ) = \int _ { \mathbf { z } } \mathrm { d } \mathbf { z } E _ { 1 } ( \mathbf { z } | \mathbf { x } ) D ( \mathbf { y } ^ { \prime } | \mathbf { z } , \mathbf { x } ) } } \\ & { } & { \approx \frac { 1 } { L _ { \mathbf { z } } } \sum _ { i = 1 } ^ { L _ { \mathbf { z } } } D ( \mathbf { y } ^ { \prime } | \mathbf { z } _ { i } , \mathbf { x } ) \quad \mathrm { w h e r e } \quad \mathbf { z } _ { i } \sim E _ { 1 } ( \mathbf { z } | \mathbf { x } ) . } \end{array}
161
+ $$
162
+
163
+ 117 By choosing this proposal function, we are able to bootstrap pseudo labels $\widetilde { \mathbf { y } }$ onto unlabeled data $\mathbf { x } _ { u }$ .
164
+ 118 In particular, we minimize the semi-supervised hybrid loss
165
+
166
+ $$
167
+ \begin{array} { r l } & { \mathcal { L } _ { \mathrm { h y b r i d } } = \mathcal { L } _ { \mathrm { s u p e r } } + \mathcal { L } _ { \mathrm { s e l f } } } \\ & { \mathcal { L } _ { \mathrm { s u p e r } } = \mathbb { E } _ { ( \mathbf { x } _ { \ell } , \mathbf { y } ) \sim \widetilde { p } _ { \ell } ( \mathbf { x } , \mathbf { y } ) } \left[ \mathcal { L } ( \mathbf { x } _ { \ell } , \mathbf { y } ) \right] } \\ & { \quad \mathcal { L } _ { \mathrm { s e l f } } = \mathbb { E } _ { ( \mathbf { x } _ { u } , \widetilde { \mathbf { y } } ) \sim \widetilde { p } _ { u } ( \mathbf { x } , \widetilde { \mathbf { y } } ) } \left[ \mathcal { L } ( \mathbf { x } _ { u } , \widetilde { \mathbf { y } } ) \right] } \end{array}
168
+ $$
169
+
170
+ ![](images/b3d49121ec203886e2bc9c61ce626fb10e54c05e6823fcb7acd2debb6477c954.jpg)
171
+ Figure 2: (A) Pseudo label acceptance rate vs. epochs for the MRI datasets $\widetilde { p } _ { \ell , 1 } ( \mathbf { x } )$ and $\widetilde { p } _ { \ell , 2 } ( \mathbf { x } )$ . (B) e eWasserstein distance vs. epochs between empirical label distributions and MCMC with 100 posterior samples, and (C) same as (B) but MCMC with 3000 posterior samples.
172
+
173
+ 119 where $\widetilde { p } _ { \ell } ( \mathbf x , \mathbf y )$ and $\widetilde { p } _ { u } ( \mathbf { x } , \widetilde { \mathbf { y } } )$ are the empirical distributions over the pairs of labeled data $\left( \mathbf { x } _ { \ell } , \mathbf { y } \right)$
174
+ 120 e e eand unlabeled data with bootstrapped pseudo labels $\left( \mathbf { x } _ { u } , \widetilde { \mathbf { y } } \right)$ , respectively. The pseudolabels $\widetilde { \mathbf { y } }$ are
175
+ 121 initialized uniformly from the prior space $p ( \mathbf { y } )$ e eand are updated according to the MH algorithm 8 at
176
+ 122 each training iteration.
177
+ 123 Note that in the MH update step, the MH acceptance ratio $\alpha$ can be interepreted as computing a
178
+ 124 Bayesian goodness of fit check relative to the current label $\widetilde { \mathbf { y } } _ { n }$ . Therefore, $\widetilde { p } _ { \ell } ( \mathbf { x } )$ and $\widetilde { p } _ { u } ( \mathbf { x } )$ need
179
+ 125 e e enot be identical distributions, merely close enough such that decreasing the supervised loss $\mathcal { L } _ { \mathrm { s u p e r } }$
180
+ 126 improves the proposal quality for the self-supervised loss $\mathcal { L } _ { \mathrm { s e l f } }$ early in training.
181
+
182
+ # 2.3 MRI physics application
183
+
184
+ 128 We consider an application in magnetic resonance imaging. In MRI, data is typically acquired in
185
+ 129 the form of $( 3 + 1 ) \mathrm { D }$ spatio-temporal grids, with 1D magnetic resonance time signals measured in
186
+ 130 each voxel of the three spatial dimensions. Advanced imaging methods typically involve voxelwise
187
+ 131 parameter inference for each time signal for the computation of quantitative maps. Modeling the
188
+ 132 individual time signals for inference, however, is challenging due to imperfections in the magnetic
189
+ 133 field generated by the scanner and other sources of signal corruption. Effectively, in MRI there is a
190
+ 134 distributional mismatch problem: simulated data $\widetilde { p } _ { \ell } ( \mathbf { x } )$ , with labels corresponding to well understood
191
+ 135 ephysics parameters, does not contain the full distribution of measured data $\widetilde { p } _ { u } ( \mathbf { x } )$ which, while
192
+ 136 egenerated by the same physics in principle, depends on additional nuissance parameters which cannot
193
+ 137 be modeled. Machine learning models which intended to generalize to $\widetilde { p } _ { u } ( \mathbf { x } )$ should therefore not be
194
+ 138 trained only on data from $\widetilde { p } _ { \ell } ( \mathbf { x } )$ .
195
+ 139 In this work, we acquire multi spin-echo (MSE) MRI images. The MSE time signals are modeled
196
+ 140 using a two-component extended phase graph (EPG) model using the algorithm detailed in Prasloski
197
+ 141 et al. [7]. Using this model, the $j$ -th time point for each signal is given by
198
+
199
+ $$
200
+ \begin{array} { l } { { \displaystyle { \widehat { \mathbf { x } } } _ { j } = f ( j \cdot \mathrm { T E } ) } } \\ { { \displaystyle f ( t ) = \sum _ { \ell = 1 } ^ { 2 } A _ { \ell } \mathrm { E P G } ( t , \alpha , \beta , T _ { 2 , \ell } , T _ { 1 } ) } } \end{array}
201
+ $$
202
+
203
+ 142 where $\alpha$ is the spin flip angle, $\beta$ the refocusing control angle, $A _ { 1 } , A _ { 2 }$ the component amplitudes,
204
+ 143 $T _ { 2 , 1 } \leq T _ { 2 , 2 }$ the short and long transverse relaxation times, and $T _ { 1 }$ the longitudinal relaxation time.
205
+ 144 The $\mathrm { E P G } ( t , \ldots )$ terms are approximately exponentially decaying in $t$ with time constants $T _ { 2 , \ell }$ , with
206
+ 145 additional modifications due to MRI physics determined by $\alpha$ , $\beta$ , and $T _ { 1 }$ . The echo time $\mathrm { T E }$ is the
207
+ 146 uniform spacing between time points. We reparameterize $A _ { 1 }$ , $A _ { 2 }$ , $T _ { 2 , 1 }$ , and $T _ { 2 , 2 }$ in terms of the
208
+ 147 unconstrained parameters $\eta , \delta _ { 1 }$ , and $\delta _ { 2 }$ as follows: $A _ { 1 } = \eta$ , $A _ { 2 } = 1 - \eta$ , $\log T _ { 2 , 1 } = \log T _ { 2 , \mathrm { m i n } } +$
209
+ 148 $( \log T _ { 2 , \mathrm { m a x } } - \log T _ { 2 , \mathrm { m i n } } ) \cdot \delta _ { 1 }$ , and $\log T _ { 2 , 2 } = \log T _ { 2 , \mathrm { m i n } } + \left( \log T _ { 2 , \mathrm { m a x } } - \log T _ { 2 , \mathrm { m i n } } \right) \cdot \left( \delta _ { 1 } + \delta _ { 2 } \cdot \left( 1 - \delta _ { 1 } \right) \right)$ ,
210
+ 149 where $T _ { \mathrm { 2 , m i n } } = 1 0 \mathrm { m s }$ and $T _ { \mathrm { 2 , m a x } } = 1 \mathrm { s }$ . The longitudinal relaxation time is fixed $T _ { 1 } = 1 . 0 \mathrm { s }$ .
211
+ 150 MRI signal noise can be modeled as Rician [8, 9]. Given data $\mathbf { x }$ normalized to have maximum value
212
+ 151 1, the likelihood $p ( \mathbf { x } | \mathbf { y } )$ under Rician noise is given by
213
+
214
+ $$
215
+ \begin{array} { r l } & { \log p ( { \bf x } | { \bf y } ) = \displaystyle \sum _ { j = 1 } ^ { N _ { \bf x } } \log p _ { \mathrm { R i c e } } \left( { \bf x } _ { j } ~ \middle | \frac { { \boldsymbol s } \cdot \hat { \bf x } ( \boldsymbol \theta ) _ { j } } { \operatorname* { m a x } _ { \boldsymbol k } \hat { \bf x } ( \boldsymbol \theta ) _ { k } } ~ , ~ { \boldsymbol s } \cdot { \boldsymbol \epsilon } \right) , } \\ & { p _ { \mathrm { R i c e } } ( \boldsymbol { \xi } | \nu , \sigma ) = \displaystyle \frac { \boldsymbol { \xi } } { \sigma ^ { 2 } } \exp \left( - \frac { \boldsymbol { \xi } ^ { 2 } + \nu ^ { 2 } } { 2 \sigma ^ { 2 } } \right) I _ { 0 } \left( \frac { \boldsymbol { \xi } \nu } { \sigma ^ { 2 } } \right) } \end{array}
216
+ $$
217
+
218
+ 152 is the Rician probability density function with location parameter $\nu$ and scale parameter $\sigma ; I _ { 0 }$ is
219
+ 153 the modified Bessel function of the first kind with order zero. We have introduced two additional
220
+ 154 parameters: a scale parameter $s$ to account for signal normalization, and a noise level $\epsilon$ relative to this
221
+ 155 scale. Additionally, we denote $\theta = \left( \alpha , \beta , \eta , \delta _ { 1 } , \delta _ { 2 } \right)$ the parameters of the EPG model 14.
222
+ 156 In total, there are 7 labels to be inferred: $\mathbf { y } = ( \alpha , \beta , \eta , \delta _ { 1 } , \delta _ { 2 } , \log \epsilon , \log s )$ . We place the following
223
+ 157 priors on the parameters:
224
+
225
+ $$
226
+ \begin{array} { c c } { { \begin{array} { l } { \alpha \sim { \mathcal { T N } } ( 1 8 0 ^ { \circ } , 4 5 ^ { \circ } , 9 0 ^ { \circ } , 1 8 0 ^ { \circ } ) } \\ { \beta \sim { \mathcal { T N } } ( 1 8 0 ^ { \circ } , 4 5 ^ { \circ } , 9 0 ^ { \circ } , 1 8 0 ^ { \circ } ) } \\ { \eta \sim { \mathcal { T N } } ( 0 . 0 , 0 . 5 , 0 . 0 , 1 . 0 ) } \\ { \delta _ { 1 } \sim { \mathcal { T N } } ( 0 . 0 , 0 . 5 , 0 . 0 , 1 . 0 ) } \end{array} } } & { { \begin{array} { r } { \delta _ { 2 } \sim { \mathcal { T N } } ( 1 . 0 , 0 . 5 , 0 . 0 , 1 . 0 ) } \\ { \log \epsilon \sim { \mathcal { U } } ( \log 1 0 ^ { - 5 } , \log 1 0 ^ { - 1 } ) } \\ { \log s \sim { \mathcal { T N } } ( 0 . 0 , 0 . 5 , - 2 . 5 , 2 . 5 ) } \end{array} } } \end{array}
227
+ $$
228
+
229
+ 158 where $\mathcal { T N } ( \mu , \sigma , a , b )$ is the normal distribution with parameters $( \mu , \sigma )$ truncated to the interval $[ a , b ]$ ,
230
+ 159 and $\boldsymbol { \mathcal { U } } ( a , b )$ is the uniform distribution on $[ a , b ]$ . The priors were chosen to align with the expectations
231
+ 160 that: $\alpha , \beta$ are typically near $1 8 0 ^ { \circ }$ ; the short component amplitude $\eta$ is typically less than the long
232
+ 161 amplitude $1 - \eta ; \delta _ { 1 }$ and $\delta _ { 2 }$ should prefer to represent the shortest and longest components; the noise
233
+ 162 level $\epsilon$ is chosen uniformly from signal-to-noise ratios between 20 and 100; the scale parameter $s$
234
+ 163 should prefer to be 1.
235
+
236
+ # 3 Experiments
237
+
238
+ # 3.1 Data sets
239
+
240
+ 166 MRI data The MRI data used for this study consists of two anonymized brain scans acquired using
241
+ 167 a Carr-Purcell-Meiboom-Gill (CPMG) [10, 11] multi spin-echo sequence [12]. The first data set,
242
+ 168 denoted $\widetilde { p } _ { u , 1 } ( \mathbf { x } )$ , contains signals with $N _ { \mathbf { x } , 1 } = 4 8$ samples at times $t _ { i } = i \cdot \mathrm { T E }$ , with echo spacing
243
+ 169 $\mathrm { T E } = 8 \mathrm { m s }$ , repetition time $\mathrm { T R } = 1 0 7 3 \mathrm { m }$ s, matrix size $2 4 0 \times 2 4 0 \times 4 8$ , and spatial resolution
244
+ 170 $0 . 9 6 \times 0 . 9 6 \times 2 . 5 \mathrm { m m ^ { 3 } }$ . The second data set, denoted $\widetilde { p } _ { u , 2 } ( \mathbf { x } )$ , contains signals with $N _ { \mathbf { x } , 2 } = 5 6$
245
+ 171 samples at times $t _ { i } = i \cdot \mathrm { T E }$ , with echo spacing $\mathrm { T E } = 7 \mathrm { m s }$ , repetition time $\mathrm { T R } = 1 0 6 6 \mathrm { m s } .$
246
+ 172 matrix size $2 4 0 \times 2 4 0 \times 1 1 3$ , and spatial resolution $1 . 0 \times 1 . 0 \times 3 . 0 \mathrm { { \dot { m } m } ^ { 3 } }$ . Following the extraction
247
+ 173 of image volumes containing the brain, $\widetilde { p } _ { u , 1 } ( \mathbf { x } )$ and $\widetilde { p } _ { u , 2 } ( \mathbf { x } )$ contain 821 145 and 1 265 306 signals,
248
+ 174 erespectively. MRI data was acquired on a $3 \mathrm { T }$ eMR system (Ingenia Elition, Philips Medical Systems,
249
+ 175 Best, The Netherlands) from healthy volunteers giving written and informed consent, and approved
250
+ 176 by our university ethics board.
251
+ 177 Simulated data Using the EPG physics model 14 with Rician noise, we consider two simulated
252
+ 178 data sets. First, the labeled data set $\widetilde { p } _ { \ell } ( \mathbf { x } )$ which is generated on demand during training using labels
253
+ 179 $\mathbf { y } \sim p ( \mathbf { y } )$ e drawn from the prior distributions 17. Second, a precomputed simulated data set $\widetilde { p } _ { u , 3 } ( \mathbf { x } )$
254
+ 180 eused for validation of the method, where the labels are held out during training. All simulated signals
255
+ 181 are generated with $N _ { \mathbf { x } , 3 } = 6 4$ samples and $\mathrm { T E } = 1 0 \mathrm { m s }$ .
256
+ 182 MCMC data MCMC is performed using the No-U-Turn Sampler [13] algorithm to generate
257
+ 183 posterior samples $\hat { \mathbf { y } } \sim p ( \mathbf { y } | \mathbf { x } _ { u } )$ which can be compared with the (Metropolis-)CVAE posterior
258
+ 184 samples. MCMC was performed twice: once to draw 100 posterior samples for every time signal in
259
+ 185 $\widetilde { p } _ { u , 1 } ( \mathbf { x } )$ , $\widetilde { p } _ { u , 2 } ( \mathbf { x } )$ , and $\bar { \widetilde { p } } _ { u , 3 } ( { \bf x } )$ , and once to draw 3000 posterior samples for a subset of 5000 signals
260
+ 186 e e efrom the training, validation, and testing partitions of all three data sets. In total, performing the
261
+ 187 above MCMC analysis took approximately $7 2 \mathrm { h }$ using an AMD Ryzen 9 3950X 16-Core CPU.
262
+
263
+ ![](images/9b33f26f0cc59901628e3fadea310d4a50d7248c7e97428a7324e60c3f9b4790.jpg)
264
+ Figure 3: (A-G) Histograms of Wasserstein distances between (Metropolis-)CVAE and MCMC empirical distributions for the two MRI data sets. Histograms of errors between the means of the empirical distributions and the true labels are shown. (H) Quantile-quantile plot for each label between global empirical distributions of CVAE samples and MCMC samples. In all plots, comparison with MCMC with 100 samples and 3000 samples are shown in red and green, respectively; CVAE trained only on simulated data is shown in dashed lines; Metropolis-CVAE shown in solid lines.
265
+
266
+ # 188 3.2 Model architecture
267
+
268
+ 189 CVAE components Let $\mathbf { x } \in \mathbb { R } ^ { N _ { \mathbf { x } } }$ , $\mathbf { y } \in \mathbb { R } ^ { N _ { \mathbf { y } } }$ , and $\mathbf { z } \in \mathbb { R } ^ { N _ { \mathbf { z } } }$ be input data, corresponding labels,
269
+ 190 and latent space samples, respectively. The encoders $E _ { 1 }$ and $E _ { 2 }$ are chosen to be multivariate normal
270
+ 191 distributions: $E _ { 1 } ( \mathbf { z } | \mathbf { \bar { x } } ) = \bar { \mathcal { N } } ( \mu _ { \mathbf { z } _ { 1 } } , \bar { \mathcal { \sigma } _ { \mathbf { z } _ { 1 } } } )$ and $E _ { 2 } ( \mathbf { z } | \mathbf { x } , \mathbf { y } ) = \mathcal { N } ( \mu _ { \mathbf { z } _ { 2 } } , \sigma _ { \mathbf { z } _ { 2 } } )$ , where $\mu _ { \mathbf { z } _ { 1 } } , \mu _ { \mathbf { z } _ { 2 } } \in \mathbb { R } ^ { N _ { \mathbf { z } } }$ and
271
+ 192 $\sigma _ { \mathbf { z } _ { 1 } } , \sigma _ { \mathbf { z } _ { 2 } } \in \mathbb { R } _ { + } ^ { N _ { \mathbf { z } } }$ . Similarly, the decoder is given by $D ( \mathbf { y } | \mathbf { x } , \mathbf { z } ) = \mathscr { T N } ( \mu _ { \mathbf { y } } , \sigma _ { \mathbf { y } } , 0 , 1 )$ , where $\mu _ { \mathbf { y } } \in \mathbb { R } ^ { N _ { \mathbf { y } } }$
272
+ 193 and $\boldsymbol { \sigma _ { \mathbf { y } } } \in \mathbb { R } _ { + } ^ { N _ { \mathbf { y } } }$ parameterize independent multivariate normal distributions truncated to [0, 1]. The
273
+ 194 labels $\mathbf { y }$ are scaled linearly from the prior domains 17 to $[ 0 , 1 ] ^ { N _ { \mathbf { y } } }$ in order to better condition the
274
+ 195 network during training. Similarly, as we are interested only in the relative $\mathbf { x }$ values and not their
275
+ 196 absolute scale, inputs $\mathbf { x }$ are normalized to $[ 0 , 1 ] ^ { N _ { \mathbf { x } } }$ .
276
+ 197 Each of the $E _ { 1 }$ , $E _ { 2 }$ , and $D$ networks are composed of fully connected layers with ReLU activation
277
+ 198 functions and $H = 2$ hidden layers, with hidden dimension $N _ { H } = 5 1 2$ , for a total of $H + 2 = 4$
278
+ 199 layers. The dimensions of the data, labels, and latent space are $N _ { \mathbf { x } } = 6 4$ , $N _ { \mathbf { y } } = 7$ , and $N _ { \mathbf { z } } = 1 2$ ,
279
+ 200 respectively. The encoder networks output $\mu _ { \mathbf { z } _ { 1 } }$ , $\log \sigma _ { \mathbf { z } _ { 1 } }$ , $\mu _ { \mathbf { z } _ { 2 } }$ , and $\log \sigma _ { \mathbf { z } _ { 2 } }$ vectors. In order to avoid
280
+ 201 latent space collapse during early training stages – that is, one or both of $\vert \mu _ { \mathbf { z } _ { i } } \vert , \vert \log \sigma _ { \mathbf { z } _ { i } } \vert \infty -$
281
+ 202 each $\mu _ { \mathbf { z } _ { i } }$ was bounded to $( - 3 , 3 )$ using the activation function $x 3 \operatorname { t a n h } ( x )$ , and each $\log \sigma _ { \mathbf { z } _ { i } }$ was
282
+ 203 bounded to $( - 6 , 0 )$ using the activation function $x 3 \operatorname { t a n h } ( x ) - 3$ . These bounds were determined
283
+ 204 by observing empirical $\mu _ { \mathbf { z } _ { i } }$ and $\log \sigma _ { \mathbf { z } _ { i } }$ values and choosing intervals which clipped only the tails of
284
+ 205 the distributions. The decoder network outputs $\mu _ { \mathbf { y } }$ and $\log \sigma _ { \mathbf { y } }$ vectors without further nonlinearities.
285
+ 206 Loss functions The terms $\mathcal { L } _ { \mathrm { s u p e r } }$ and $\mathcal { L } _ { \mathrm { s e l f } }$ in Equation 11 are identical apart from their inputs,
286
+ 207 with each term consisting of the KL-divergence and evidence lower bound (ELBO) terms from the
287
+ 208 variational lower bound of Equation 1. The KL-divergence can be computed in closed closed-form,
288
+ 209 and is given by
289
+
290
+ $$
291
+ \displaystyle \mathrm { K L } \left( E _ { 2 } ( \mathbf { z } | \mathbf { x } , \mathbf { y } ) \left| \right| E _ { 1 } ( \mathbf { z } | \mathbf { x } ) \right) = \sum _ { j = 1 } ^ { N _ { \mathbf { z } } } \frac { \sigma _ { \mathbf { z } _ { 2 } , j } ^ { 2 } + ( \mu _ { \mathbf { z } _ { 2 } , j } - \mu _ { \mathbf { z } _ { 1 } , j } ) ^ { 2 } } { 2 \sigma _ { \mathbf { z } _ { 1 } , j } ^ { 2 } } + \log \frac { \sigma _ { \mathbf { z } _ { 1 } , j } } { \sigma _ { \mathbf { z } _ { 2 } , j } } - \frac { 1 } { 2 }
292
+ $$
293
+
294
+ 210 Following sampling $\mathbf { z } _ { 2 } \sim E _ { 2 } ( \mathbf { z } | \mathbf { x } , \mathbf { y } )$ and subsequently computing $( \mu _ { \mathbf { y } } , \log \sigma _ { \mathbf { y } } ) = D ( \mathbf { y } | \mathbf { x } , \mathbf { z } _ { 2 } )$ , the
295
+ 211 ELBO component is approximated as
296
+
297
+ $$
298
+ \begin{array} { r l } { \displaystyle \mathbb { E } _ { E _ { 2 } ( { \mathbf z } | { \mathbf x } , { \mathbf y } ) } \left[ \log D ( \mathbf { y } | { \mathbf x } , { \mathbf z } ) \right] \approx _ { j = 1 } ^ { N _ { y } } \Bigg \{ } & { } \\ { \displaystyle \log \phi \left( \frac { \mathbf { y } _ { j } - \mu _ { { \mathbf y } , j } } { \sigma _ { { \mathbf y } , j } } \right) - \log \left( \Phi \left( \frac { 1 - \mu _ { { \mathbf y } , j } } { \sigma _ { { \mathbf y } , j } } \right) - \Phi \left( \frac { 0 - \mu _ { { \mathbf y } , j } } { \sigma _ { { \mathbf y } , j } } \right) \right) - \log \sigma _ { { \mathbf y } , j } \Bigg \} } & { } \\ { \displaystyle \mathrm { w h e r e } \quad } & { \phi ( \xi ) = \frac { 1 } { \sqrt { 2 \pi } } \exp \left( - \frac { 1 } { 2 } \xi ^ { 2 } \right) } \\ & { \displaystyle \Phi ( \zeta ) = \frac { 1 } { 2 } \left( 1 + \mathrm { e r f } \left( \frac { \zeta } { \sqrt { 2 } } \right) \right) . } \end{array}
299
+ $$
300
+
301
+ $\phi ( \xi )$ and $\Phi ( \zeta )$ are the probability density and cumulative distribution functions of the standard normal distribution, respectively. Note that each term in the sum of Equation 19 is the log-likelihood of a normal distribution with parameters $( \mu _ { \mathbf { y } , i } , \sigma _ { \mathbf { y } , i } )$ truncated to the unit interval [0, 1].
302
+
303
+ # 3.3 Training
304
+
305
+ All data sets were split into training/validation/testing with proportions $5 0 \% / 2 5 \% / 2 5 \%$ . Input data was padded with zeros to length $N _ { \mathbf { x } } = 6 4$ , if necessary. To support data with differing unpadded lengths, random masking was performed during training: for each x, a random integer $j _ { \mathrm { m a s k } }$ was sampled from 32–64 and all elements $\mathbf { x } _ { j } { > } j _ { \mathrm { m a s k } }$ were set to zero. The ADAM optimizer was used with√ an initial learning rate of $1 0 ^ { - 4 }$ . The learning rate was decreased every 1000 epochs by a factor of $\sqrt { 1 0 }$ Training was completed after 5000 epochs, where an epoch is defined as 100 iterations. Each iteration, a batch of 1024 data and (pseudo-)label pairs are drawn from either a labeled or an unlabeled dataset, with equal probability. If labeled data are sampled, the loss component $\mathcal { L } _ { \mathrm { s u p e r } } ( \mathbf { x } _ { \ell } , \mathbf { y } )$ is descended on. If unlabeled data are sampled, the pseudo labels $\widetilde { \mathbf { y } }$ corresponding to the sampled $\mathbf { x } _ { u }$ are updated eusing Equation 8 before descending on the loss component $\bar { \mathcal { L } } _ { \mathrm { s e l f } } ( \mathbf { x } _ { u } , \widetilde { \mathbf { y } } )$ . In the Metropolis-Hastings update step, we set $L _ { c } = 1$ in equation 7 and $L _ { \mathbf { z } } = 1$ ein equation 9. Training was performed on a single Nvidia GeForce RTX 3080 GPU with 10 GB of VRAM; approximately 15 hours was required to train for 5000 epochs.
306
+
307
+ # 229 4 Results and discussion
308
+
309
+ In the first experiment, a Metropolis-CVAE is trained on online simulated labeled data $\mathbf { x } _ { \ell } \sim \widetilde { p } _ { \ell } ( \mathbf { x } )$ as well as precomputed simulated data $\mathbf { x } _ { u } \sim \widetilde { p } _ { u , 3 } ( \mathbf { x } )$ with labels held out during training. Figure 1(A-G) eshows the distributions of prediction errors by the trained network for each label. For each method, the prediction error is defined as the difference between the true label and the mean of the posterior samples. The labels have been normalized to [0, 1]. The histograms for the Metropolis-CVAE with 100 posterior samples are more tightly clustered around zero than MCMC with either 100 or 3000 posterior samples – denoted MCMC-100 and MCMC-3000 – in all cases except for one (Figure 1F). Figure 1H shows a $p { - } p$ plot: the fraction of posterior samples greater than or equal to the true label, $p$ is plotted against the cumulative distribution of $p$ -values across the data set; the Metropolis-CVAE produces similar curves as MCMC-3000.
310
+
311
+ 240 In the second experiment, a Metropolis-CVAE is similarly trained using labeled simulated $\mathbf { x } _ { \ell } \sim \widetilde { p } _ { \ell } ( \mathbf { x } )$ ,
312
+ 241 but now with the unlabeled data $\mathbf { x } _ { u }$ drawn from the MRI data sets $\widetilde { p } _ { u , 1 } ( \mathbf { x } )$ and $\widetilde { p } _ { u , 2 } ( \mathbf { x } )$ e. For
313
+ 242 e ecomparison, a second traditional CVAE is trained on the simulated data only. Figure 2A shows the
314
+ 243 acceptance rate of the proposed pseudo labels $\widetilde { \mathbf { y } } ^ { \prime } \sim Q ( \mathbf { y } ^ { \prime } )$ for each data set during training. As the
315
+ 244 eMetropolis-CVAE continually learns from both data sets, we find that the network quickly enters
316
+ 245 a negative feedback loop in which the acceptance rate continually increases throughout training.
317
+ 246 Noteworthy is that the acceptance rate of $\widetilde { \mathbf { y } }$ converges to a value between 0.6 and 0.7 for both datasets.
318
+ 247 eThe default target acceptance rate of the No-U-Turn sampler is 0.65, a value which originates from
319
+ 248 a theoretical result pertaining to Hamiltonian Monte Carlo (HMC) [14]. Theoretical work would
320
+ 249 be required to demonstrate a direct connection between Metropolis-CVAEs and the HMC result.
321
+ 250 However, this illustrates that the network neither accepts nor rejects more proposals than is typically
322
+ 251 desired. Figure 2(B-C) shows the average Wasserstein distance between empirical label distributions
323
+ 252 from the Metropolis-CVAE with MCMC-100 and MCMC-3000, respectively. During training, the
324
+ 253 Metropolis-CVAE quickly reaches minimum Wasserstein distances with respect to MCMC-100.
325
+ 254 Minima are reached with respect to MCMC-3000 similarly quickly. We can extrapolate from this
326
+ 255 result that the Metropolis-CVAE likely produces higher quality posterior samples than MCMC-3000.
327
+ 256 This may be expected, as the Metropolis-CVAE updates its pseudo labels at every training iteration,
328
+ 257 continuously performing MCMC throughout training using the MH update rule 8.
329
+ 258 Figure 3(A-G) compares the empirical distributions of a traditional CVAE trained only on simulated
330
+ 259 data with a Metropolis-CVAE. Histograms of the Wasserstein distances between the two networks and
331
+ 260 MCMC-100 do not show large differences, due to the low-quality of MCMC-100. Compared with
332
+ 261 MCMC-3000, parameters which are traditionally easier to infer, such as $\alpha$ and $\beta$ , show little difference
333
+ 262 between the networks. The CVAE trained on supervised data alone shows significant deviation from
334
+ 263 MCMC-3000 for several parameters, particularly $\eta$ , $\delta _ { 1 }$ , and $\log \epsilon$ . This illustrates the ability of the
335
+ 264 Metropolis-CVAE to generalize well to the unlabeled test data, as unlabeled training data from $\widetilde { p } _ { u } ( \mathbf { x } )$
336
+ 265 ehas been explicitly incorporated into its training process. Figure 3(H) shows quantile-quantile plots
337
+ 266 for distributions of all label samples across the data sets. All methods agree.
338
+ 267 Limitations A limitation of this method is the requirement of a likelihood function which is fast to
339
+ 268 compute in order to perform the Metropolis-Hastings update step 8. For physics models, computing
340
+ 269 the likelihood of a set of parameters often involves costly forward simulations of complex models.
341
+ 270 Therefore, computationally intensive models which require solving non-trivial integral or differential
342
+ 271 equations will not be suitable.
343
+ 272 Another limitation is that the pseudo label sampling procedure may converge to a stable local
344
+ 273 minimum which is far from the globally optimal labels. This is inherent to the MH update step; while
345
+ 274 MCMC methods often provide convergence guarantees in the limit of large numbers of update steps,
346
+ 275 one can not predict how many update steps this will require in practice. However, by training the
347
+ 276 Metropolis-CVAE on both simulated data generated from the prior space as well as real unlabeled
348
+ 277 data, we have not found this to be a practical concern.
349
+
350
+ Potential negative societal impacts This work describes a framework for ascribing labels to unlabeled data. Potential malicious and unintended uses could occur if this framework were significantly extended beyond the MRI physics inference problem which we considered. For example, this methodology could be used to infer missing data generally, with the inferred data then presented under the pretense that it were true data. Further, we have not shown that our method of data inference for unlabeled data is inherently fair, nor that the clinical MRI data under which the Metropolis-CVAE model is trained on cannot be recovered from the network weights.
351
+
352
+ 285 References
353
+ 286 [1] Udo von Toussaint. Bayesian inference in physics. Reviews of Modern Physics, 83(3):943–999,
354
+ 287 September 2011. doi: 10.1103/RevModPhys.83.943. URL https://link.aps.org/doi/
355
+ 288 10.1103/RevModPhys.83.943. Publisher: American Physical Society.
356
+ 289 [2] Kihyuk Sohn, Honglak Lee, and Xinchen Yan. Learning Structured Output Representation
357
+ 290 using Deep Conditional Generative Models. In C. Cortes, N. Lawrence, D. Lee, M. Sugiyama,
358
+ 291 and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 28. Curran
359
+ 292 Associates, Inc., December 2015. URL https://proceedings.neurips.cc/paper/2015/
360
+ 293 file/8d55a249e6baa5c06772297520da2051-Paper.pdf.
361
+ 294 [3] Diederik P. Kingma, Danilo J. Rezende, Shakir Mohamed, and Max Welling. Semi-Supervised
362
+ 295 Learning with Deep Generative Models. arXiv:1406.5298 [cs, stat], October 2014. URL
363
+ 296 http://arxiv.org/abs/1406.5298. arXiv: 1406.5298.
364
+ 297 [4] Hunter Gabbard, Chris Messenger, Ik Siong Heng, Francesco Tonolini, and Roderick
365
+ 298 Murray-Smith. Bayesian parameter estimation using conditional variational autoencoders
366
+ 299 for gravitational-wave astronomy. arXiv:1909.06296 [astro-ph, physics:gr-qc], September
367
+ 300 2019. URL http://arxiv.org/abs/1909.06296. arXiv: 1909.06296.
368
+ 301 [5] Nicholas Metropolis, Arianna W. Rosenbluth, Marshall N. Rosenbluth, Augusta H. Teller, and
369
+ 302 Edward Teller. Equation of State Calculations by Fast Computing Machines. The Journal of
370
+ 303 Chemical Physics, 21(6):1087–1092, June 1953. ISSN 0021-9606. doi: 10.1063/1.1699114.
371
+ 304 URL https://aip.scitation.org/doi/10.1063/1.1699114. Publisher: American In
372
+ 305 stitute of Physics.
373
+ 306 [6] W. K. Hastings. Monte Carlo sampling methods using Markov chains and their applications.
374
+ 307 Biometrika, 57(1):97–109, April 1970. ISSN 0006-3444. doi: 10.1093/biomet/57.1.97. URL
375
+ 308 https://doi.org/10.1093/biomet/57.1.97.
376
+ 309 [7] Thomas Prasloski, Burkhard Mädler, Qing-San Xiang, Alex MacKay, and Craig Jones.
377
+ 310 Applications of stimulated echo correction to multicomponent T2 analysis. Magnetic
378
+ 311 Resonance in Medicine, 67(6):1803–1814, 2012. ISSN 1522-2594. doi: 10.1002/
379
+ 312 mrm.23157. URL https://onlinelibrary.wiley.com/doi/abs/10.1002/mrm.23157.
380
+ 313 _eprint: https://onlinelibrary.wiley.com/doi/pdf/10.1002/mrm.23157.
381
+ 314 [8] S. O. Rice. Mathematical Analysis of Random Noise. Bell System Technical Journal, 23(3):
382
+ 315 282–332, 1944. ISSN 1538-7305. doi: 10.1002/j.1538-7305.1944.tb00874.x. URL https:
383
+ 316 //onlinelibrary.wiley.com/doi/abs/10.1002/j.1538-7305.1944.tb00874.x.
384
+ 317 _eprint: https://onlinelibrary.wiley.com/doi/pdf/10.1002/j.1538-7305.1944.tb00874.x.
385
+ 318 [9] S. O. Rice. Mathematical Analysis of Random Noise. Bell System Technical Journal, 24(1):
386
+ 319 46–156, 1945. ISSN 1538-7305. doi: 10.1002/j.1538-7305.1945.tb00453.x. URL https:
387
+ 320 //onlinelibrary.wiley.com/doi/abs/10.1002/j.1538-7305.1945.tb00453.x.
388
+ 321 _eprint: https://onlinelibrary.wiley.com/doi/pdf/10.1002/j.1538-7305.1945.tb00453.x.
389
+ 322 [10] H. Y. Carr and E. M. Purcell. Effects of Diffusion on Free Precession in Nuclear Magnetic
390
+ 323 Resonance Experiments. Physical Review, 94(3):630–638, May 1954. doi: 10.1103/PhysRev.94.
391
+ 324 630. URL https://link.aps.org/doi/10.1103/PhysRev.94.630. Publisher: American
392
+ 325 Physical Society.
393
+ 326 [11] S. Meiboom and D. Gill. Modified Spin-Echo Method for Measuring Nuclear Relaxation
394
+ 327 Times. Review of Scientific Instruments, 29(8):688–691, August 1958. ISSN 0034-6748. doi:
395
+ 328 10.1063/1.1716296. URL https://aip.scitation.org/doi/abs/10.1063/1.1716296.
396
+ 329 Publisher: American Institute of Physics.
397
+ 330 [12] Kenneth P. Whittall, Alex L. Mackay, Douglas A. Graeb, Robert A. Nugent, David K. B.
398
+ 331 Li, and Donald W. Paty. In vivo measurement of T2 distributions and water contents in
399
+ 332 normal human brain. Magnetic Resonance in Medicine, 37(1):34–43, 1997. ISSN 1522-2594.
400
+ 333 doi: 10.1002/mrm.1910370107. URL https://onlinelibrary.wiley.com/doi/abs/10.
401
+ 334 1002/mrm.1910370107.
402
+
403
+ 35 [13] Matthew D Hoffman and Andrew Gelman. The No-U-Turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo. J. Mach. Learn. Res., 15(1):1593–1623, 2014.
404
+
405
+ [14] Alexandros Beskos, Natesh Pillai, Gareth Roberts, Jesus-Maria Sanz-Serna, and Andrew Stuart. Optimal tuning of the hybrid Monte Carlo algorithm. Bernoulli, 19 (5A):1501–1534, November 2013. ISSN 1350-7265. doi: 10.3150/12-BEJ414. URL https://projecteuclid.org/journals/bernoulli/volume-19/issue-5A/ Optimal-tuning-of-the-hybrid-Monte-Carlo-algorithm/10.3150/12-BEJ414. full. Publisher: Bernoulli Society for Mathematical Statistics and Probability.
406
+
407
+ # Checklist
408
+
409
+ 1. For all authors...
410
+
411
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
412
+ (b) Did you describe the limitations of your work? [Yes] See the Limitations paragraph of the Results and discussion section.
413
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes] See the Potential negative societal impacts paragraph of the Results and discussion section.
414
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
415
+
416
+ 2. If you are including theoretical results...
417
+
418
+ (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]
419
+
420
+ 3. If you ran experiments...
421
+
422
+ (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 to reproduce the main results is included with the supplemental material. The MRI data cannot be included, as it is medical data. However, the simulated data is provided in the supplemental material.
423
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See the Training subsection of the Experiments section.
424
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] We provide entire histograms of relevant error metrics; see Figures 1 and 3.
425
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See the MCMC data paragraph of the Data sets subsection of the Experiments section, as well as the Training subsection of the Experiments section.
426
+
427
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
428
+
429
+ (a) If your work uses existing assets, did you cite the creators? [N/A]
430
+ (b) Did you mention the license of the assets? [N/A]
431
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes] The trained models are supplied in the supplemental material.
432
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes] See the MRI data paragraph of the Data sets subsection of the Experiments section.
433
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes] The MRI data used in this work is anonymized; see the MRI data paragraph of the Data sets subsection of the Experiments section.
434
+
435
+ 5. If you used crowdsourcing or conducted research with human subjects...
436
+
437
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [No] This was a prospective study; this information was not available.
438
+
439
+ 385 (b) Did you describe any potential participant risks, with links to Institutional Review
440
+ 386 Board (IRB) approvals, if applicable? [Yes] These MRI scans were acquired with
441
+ 387 approval from our university ethics board; see the MRI data paragraph of the Data sets
442
+ 388 subsection of the Experiments section.
443
+ 389 (c) Did you include the estimated hourly wage paid to participants and the total amount
444
+ 390 spent on participant compensation? [N/A]
md/train/x8gM-4nFq9b/x8gM-4nFq9b.md ADDED
@@ -0,0 +1,441 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Fighting Gradients with Gradients: Dynamic Defenses against Adversarial Attacks
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 Adversarial attacks optimize against models to defeat defenses. Existing defenses
11
+ 2 are static, and stay the same once trained, even while attacks change. We argue
12
+ 3 that models should fight back, and optimize their defenses against attacks at test
13
+ 4 time. We propose dynamic defenses, to adapt the model and input during testing,
14
+ 5 by defensive entropy minimization (dent). Dent alters testing, but not training, for
15
+ 6 compatibility with existing models and train-time defenses. Dent improves the
16
+ 7 robustness of adversarially-trained defenses and nominally-trained models against
17
+ 8 white-box, black-box, and adaptive attacks on CIFAR-10/100 and ImageNet. In
18
+ 9 particular, dent boosts state-of-the-art defenses by $^ { 2 0 + }$ points absolute against
19
+ 10 AutoAttack on CIFAR-10 at $\epsilon _ { \infty } = 8 / 2 5 5$ .
20
+
21
+ # 11 1 Introduction: Attack, Defend, and Then?
22
+
23
+ 12 Deep networks are vulnerable to adversarial attacks: input perturbations that alter natural data to
24
+ 13 cause errors or exploit predictions [54]. As deep networks are deployed in real systems, these attacks
25
+ 14 are real threats [63], and so defenses are needed. The challenge is that every new defense is followed
26
+ 15 by a new attack, in a loop [56]. The strongest attacks, armed with gradient optimization, update to
27
+ 16 circumvent defenses that do not. Such iterative attacks form an even tighter loop to ensnare defenses.
28
+ 17 In a cat and mouse game, the mouse must keep moving to survive.
29
+ 18 Current defenses, deterministic or stochastic, stand still: once trained, they are static and do not adapt
30
+ 19 during testing. Adversarial training [18, 30] learns from attacks during training, but cannot learn
31
+ 20 from test data. Stochastic defenses alter the network [11] or input [20, 7], but their randomness is
32
+ 21 independent of test data. Static defenses do not adapt, and so they may fail as attacks update.
33
+ 22 Our dynamic defense fights adversarial updates with defensive updates by adapting during testing
34
+ 23 (Figure 1). In fact, our defense updates on every input, whether natural or adversarial. Our defense
35
+ 24 objective is entropy minimization, to maximize model confidence, so we call our method dent for
36
+ 25 defensive entropy. Our updates rely on gradients and batch statistics, inspired by test-time adaptation
37
+ 26 approaches [53, 43, 28, 29, 58]. In pivoting from training to testing, dent is able to keep changing, so
38
+ 27 the attacker never hits the same defense twice. Dent has the last move advantage, as its update always
39
+ 28 follows each attack.
40
+ 29 Dent connects adversarial defense and domain adaptation, which share an interest in the sensitivity of
41
+ 30 deep networks to input shifts. Just as models fail on adversarial attacks, they fail on natural shifts
42
+ 31 like corruptions. Adversarial data is a particularly hard shift, as evidenced by the need for more
43
+ 32 parameters and optimization for adversarial training [30], and its negative side effect of reducing
44
+ 33 accuracy on natural data [52, 65]. Faced with these difficulties, we turn to adaptation, and change our
45
+ 34 focus to testing, rather than training more still.
46
+
47
+ ![](images/cde90b4997e64c6492e857350945388c631910eea48a703d9d07504bcbb2f595.jpg)
48
+ Figure 1: Attacks optimize the input $x + \delta$ against the model $\theta$ . Adversarial training optimizes $\theta$ for defense (a), but attacks update during testing while $\theta$ does not (b). Our dynamic defense improves robustness by adapting $\theta + \Delta$ during testing (c), so the attack cannot hit the same defense twice.
49
+
50
+ Experiments evaluate dent against white-box attacks (APGD, FAB), black-box attack (Square), and adaptive attacks that are aware of its updates. Dent boosts state-of-the-art adversarial training defenses on CIFAR-10 by $2 0 +$ points against AutoAttack [9] at $\epsilon _ { \infty } = 8 / 2 5 5$ . Ablations inspect the effects of iteration, parameterization, and batch size. Our code is included in the supplement.
51
+
52
+ # 39 Our contributions
53
+
54
+ • We highlight an opportunity for dynamic defense: the last move advantage.
55
+ • We propose the first fully test-time dynamic defense: dent adapts both the model and input during testing without needing to alter training.
56
+ • Dent augments state-of-the-art adversarial training methods, improving robustness by $3 0 \%$ relative, and tops the AutoAttack leaderboard by $1 5 +$ points.
57
+ • We devise two adaptive attacks against dent: denying updates and mixing batches.
58
+
59
+ # 46 2 Related Work
60
+
61
+ 47 Adversarial Defense For adaptive adversaries, which change in response to defenses, it is natural
62
+ 48 to consider dynamic defenses, which adapt in turn. Evans et al. [14] explain dynamic defenses are
63
+ 49 promising in principle but caution they may not be effective in practice. Their analysis concerns
64
+ 50 randomized defenses, which do change, but their randomization does not adapt to the input. We argue
65
+ 51 for dynamic defenses that depend on the input to keep adapting along with the attacks. Goodfellow
66
+ 52 [17] supports dynamic defenses for similar reasons, but does not develop a specific defense. We
67
+ 53 demonstrate the first defense to optimize the model and input during testing for improved robustness.
68
+ 54 Most defenses for deep learning focus on first-order adversaries [18, 30] that are equipped with
69
+ 55 gradient optimization but constrained by $\ell _ { p }$ -norm bounds. Adversarial training and randomization
70
+ 56 are the most effective defenses against such attacks, but are nevertheless limited, as they are fixed
71
+ 57 during testing. Adversarial training [18, 30] trains on attacks, but a different or stronger adversary
72
+ 58 (by norm or bound) can overcome the trained defense [46, 55]. Randomizing the input [37, 7, 32]
73
+ 59 or network [11] requires the adversary to optimize in expectation [3], but can still fail with more
74
+ 60 iterations. Furthermore, these defenses gain adversarial robustness by sacrificing accuracy on natural
75
+ 61 data. Dent adapts during testing to defend against various attacks without more harm to natural
76
+ 62 accuracy.
77
+ 63 Generative, self-supervised, and certified defenses try to align testing with training but are still
78
+ 64 static. Generative defenses optimize the input w.r.t. autoregressive [50], GAN [42], or energy [23]
79
+ 65 models, but the models do not adapt, and may be attacked by approximating their gradients [3].
80
+ 66 Self-supervised defenses optimize the input w.r.t. auxiliary tasks [49], but again the models do not
81
+ 67 adapt. Certified defenses [7, 66] guarantee robustness within their training scope, but are limited
82
+ 68 to small perturbations by specific types of attacker during testing. Changing data distributions or
83
+ 69 adversaries requires re-training all of these defenses. Dent adapts during testing, without requiring
84
+ 70 (re-)training, and is the only method to update the model itself against attack.
85
+ 71 Domain Adaptation Domain adaptation mitigates input shifts between the source (train) and target
86
+ 72 (test) to maintain model accuracy [34, 41]. Adversarial attacks are such a shift, and adversarial
87
+ 73 error is related to natural generalization error [51, 15]. How then can adaptation inform dynamic
88
+ 74 defense? Train-time adaptation is static, like adversarial training, with the same issues of capacity,
89
+ 75 optimization, and re-computation when the data/adversary changes. We instead turn to test-time
90
+ 76 adaptation methods.
91
+ 77 Test-time adaptation keeps updating the model as the data changes. Model parameters and statistics
92
+ 78 can be updated by self-supervision [53], normalization [43], and entropy minimization [58]. These
93
+ 79 methods improve robustness to natural corruptions [22], but their effect on adversarial perturbations
94
+ 80 is not known. We base our defense on entropy minimization as it enables optimization during testing
95
+ 81 without altering model architecture or training (as needed for self-supervision). For defense, we (1)
96
+ 82 extend the parameterization of adaptation with model and input transformations, (2) optimize for
97
+ 83 additional iterations, and (3) investigate usage on data that is adversarial, natural, or mixed. We are
98
+ 84 the first to report test-time model adaptation improves robustness to adversarial perturbations.
99
+ 85 Dynamic Inference A dynamic model conditionally changes inference for each input, while a
100
+ 86 static model unconditionally fixes inference for all inputs. There are various dynamic inference
101
+ 87 techniques, with equally varied goals, such as expressivity with more parameters or efficiency with
102
+ 88 less computation. All static models are alike; each dynamic model is dynamic in its own way.
103
+ 89 Selection techniques learn to choose a subset of components [1, 57]. Halting techniques learn to
104
+ 90 continue or end computation [19, 59]. Mixing techniques learn to combine parameters [47, 33, 62].
105
+ 91 Implicit techniques learn to iteratively update [6, 4]. While these methods learn to adapt during
106
+ 92 training, our method keeps adapting by directly optimizing during testing.
107
+
108
+ ![](images/2ad6b5c67642dbf6300c278533ac4bc7624d8a4ef2e07f1ade7a9da86f794f0e.jpg)
109
+ Figure 2: Dent adapts the model and input to minimize the entropy of the prediction $H ( \hat { y } )$ . The model $f$ is adapted by a constrained update $\Delta$ to the parameters $\theta$ . The input is adapted by smoothing $g$ with parameters $\Sigma$ . Dent updates batch-by-batch during testing.
110
+
111
+ # 93 3 Dynamic Defense by Test-Time Adaptation
112
+
113
+ 94 Adversarial attacks optimize against defenses at test time, so defenses should fight back, and counter
114
+ 95 optimize against attacks. Defensive entropy minimization (dent) does exactly this for dynamic
115
+ 96 defense by test-time adaptation.
116
+ 97 In contrast to many existing defenses, dent alters testing, but not training. Dent only needs differen
117
+ 98 tiable parameters for gradient optimization and probabilistic predictions for entropy measurement.
118
+ 99 As such, it applies to both adversarially-trained and nominally-trained models.
119
+
120
+ # 00 3.1 Preliminaries on Attacks and Defenses
121
+
122
+ Let 101 $x \in \mathbb { R } ^ { d }$ and $y \in \{ 1 , \ldots , C \}$ be an input sample and its corresponding ground truth. Given a model 102 $f ( \cdot ; \theta ) \colon { \mathbb { R } } ^ { d } \to { \mathbb { R } } ^ { C }$ parameterized by $\theta$ , the goal of the adversary is to craft a perturbation 103 $\delta \in \mathbb { R } ^ { d }$ such that the perturbed input $\tilde { x } = x + \delta$ causes a prediction error $f ( x + \delta ; \theta ) \neq y$ .
123
+
124
+ A targeted attack aims for a specific prediction of 104 $y ^ { \prime }$ , while an untargeted attack seeks any incorrect 105 prediction. The perturbation $\delta$ is constrained by a choice of $\ell _ { p }$ norm and threshold $\epsilon$ : $\{ \delta \in \mathbb { R } ^ { d } \mid$ 106 $\| \delta \| _ { p } < \epsilon \}$ . We consider the two most popular norms for adversarial attacks: $\ell _ { \infty }$ and $\ell _ { 2 }$ .
125
+
126
+ ![](images/439ac9d9ddf0430036f530597a8742137f0ef56820881f53ace56705281199a8.jpg)
127
+ Figure 3: The adversary optimizes its attacks $\delta ^ { 1 \cdots t }$ against the model $f$ . Static defenses (left) do not adapt, and are vulnerable to persistent, iterative attacks. Our dynamic defenses (right) do adapt, and update their parameters $\Delta , \Sigma$ each time the adversary updates its attack $\delta$ .
128
+
129
+ 107 Adversarial training is a standard defense, formulated by Madry et al. [30] as a saddle point problem,
130
+
131
+ $$
132
+ \underset { \theta } { \operatorname { a r g m i n } } \mathbb { E } _ { ( x , y ) } \operatorname* { m a x } _ { \delta } L ( f ( x + \delta ; \theta ) , y ) ,
133
+ $$
134
+
135
+ 108 which the model minimizes and the adversary maximizes with respect to the loss $L ( \hat { y } , y )$ , such as
136
+ 109 cross-entropy for classification. The adversary iteratively optimizes $\delta$ by projected gradient descent
137
+ 110 (PGD), a standard algorithm for constrained optimization, for each step $t$ via
138
+
139
+ $$
140
+ \begin{array} { r } { \delta ^ { t } = \Pi _ { p } \big ( \delta ^ { t - 1 } + \alpha \cdot \mathrm { s i g n } \big ( \nabla _ { \delta ^ { t - 1 } } L \big ( f \big ( x + \delta ^ { t - 1 } ; \theta \big ) , y \big ) \big ) \big ) , } \end{array}
141
+ $$
142
+
143
+ 111 for projection $\Pi _ { p }$ onto the norm ball for $\ell _ { p } < \epsilon$ , step size hyperparameter $\alpha$ , and random initialization
144
+ 112 $\delta ^ { 0 }$ . The model optimizes $\theta$ against $\delta$ to minimize the loss of its predictions on perturbed inputs. This
145
+ 113 is accomplished by augmenting the training set with adversarial inputs from PGD attack.
146
+
147
+ 14 Adversarial training is state-of-the-art, but static. Dynamic defenses offer to augment its robustness.
148
+
149
+ # 3.2 Defensive Entropy Minimization
150
+
151
+ 116 Defensive entropy minimization (dent) counters attack updates with defense updates. While adver
152
+ 117 saries optimize to cross decision boundaries, entropy minimization optimizes to distance predictions
153
+ 118 from decision boundaries, interfering with attacks. As the adversary optimizes its perturbation $\delta$ , dent
154
+ 119 optimizes its adaptation $\Delta , \Sigma$ . Figure 2 shows dent’s model $( \Delta )$ and input $\left( \Sigma \right)$ updates.
155
+
156
+ Dent is dynamic because both $\Delta , \Sigma$ depend on the testing data, whether natural $x$ or adversarial $x + \delta$ . On the contrary, static defenses depend only on training data through the model parameters $\theta$ Figure 3 contrasts static and dynamic defenses across the steps of attack optimization.
157
+
158
+ 123 Entropy Objective Test-time optimization requires an unsupervised objective. Following tent [58],
159
+ 124 we adopt entropy minimization as our adaptation objective. Specifically, our defense objective is to
160
+ 125 minimize the Shannon entropy [45] $H ( \hat { y } )$ of the model prediction during testing $\hat { y } = f ( x ; \theta )$ for the
161
+ 126 probability $\hat { y } _ { c }$ of class $c$ :
162
+
163
+ $$
164
+ H ( \hat { y } ) = - \sum _ { c \in 1 , \ldots , C } p ( \hat { y } _ { c } ) \log p ( \hat { y } _ { c } )
165
+ $$
166
+
167
+ 127 Adaptation Parameters Dent adapts the model by $\Delta$ and input by $\Sigma$ (Figure 2). For the model, dent
168
+ 128 adapts affine scale $\gamma$ and shift $\beta$ parameters by gradient updates and adapts mean $\mu$ and variance $\sigma ^ { 2 }$
169
+ 129 statistics by estimation. These are a small portion of the full model parameters $\theta$ , in only the batch
170
+ 130 normalization layers [25]. However, they are effective for conditioning a model on changes in the
171
+ 131 task [33] or data [43, 58]. For the input, dent updates Gaussian smoothing $g$ by gradient updates
172
+ 132 of the parameter $\Sigma$ , while adjusting the filter size for efficiency [48]. This controls the degree of
173
+ 133 smoothing dynamically, unlike defense by static smoothing [7].
174
+ 134 In standard models the scale $\gamma$ and shift $\beta$ parameters are shared across inputs, and so adaptation
175
+ 135 updates batch-wise. For further adaptation, dent can update sample-wise, with different affine
176
+ 136 parameters for each input. In this way, it adapts more than prior test-time adaptation methods with
177
+ 137 batch-wise parameters [58, 43].
178
+ 138 Our model and input parameters are differentiable, so end-to-end optimization coordinates them
179
+ 139 against attacks as layered defenses. This coordination is inspired by CyCADA [24], for domain
180
+ 140 adaptation, but dent differs in its purpose and its unified loss. CyCADA also optimizes input and
181
+ 141 model transformations but does so in parallel with separate losses. Our defensive optimization is
182
+ 142 joint and shares the same loss.
183
+ 143 Update Algorithm In summary, when the adversary attacks with perturbation $\delta ^ { t }$ , our dynamic
184
+ 144 defense reacts with $\Sigma ^ { t } , \Delta ^ { t }$ . The parameters of the model $f$ and smoothing $g$ are updated by
185
+ 145 $\begin{array} { r } { \operatorname * { a r g m i n } _ { \Sigma , \Delta } H ( f ( g ( x + \delta ; \Sigma ) ; \theta + \Delta ) ) } \end{array}$ through test-time optimization. At each step, dent estimates
186
+ 146 the normalization statistics $\mu$ , $\sigma$ and then updates the parameters $\gamma , \beta , \Sigma$ by the gradient of entropy
187
+ 147 minimization. Figure 3 contrasts static defenses and dynamic defenses that update like dent.
188
+
189
+ Table 1: Dent boosts the robustness of adversarial training on CIFAR-10 against AutoAttack. Adversarial training is static, but dent is dynamic, and adapts during testing. Dent adapts batch-wise, while dent+ adapts sample-wise, surpassing the state-of-the-art for static defense at robustbench.github.io.
190
+
191
+ <table><tr><td>ACCURACY(%)</td><td>NATURAL</td><td colspan="3">ADVERSARIAL</td></tr><tr><td></td><td></td><td>STATIC</td><td>DENT</td><td>DENT+</td></tr><tr><td>€ = 8/255</td><td></td><td></td><td></td><td></td></tr><tr><td>CARMON ET AL. [5]</td><td>89.6</td><td>59.5</td><td>74.7</td><td>82.3</td></tr><tr><td>SEHWAG ET AL. [44]</td><td>84.4</td><td>54.4</td><td>61.2</td><td>75.2</td></tr><tr><td>WONG ET AL. [60]</td><td>83.3</td><td>43.2</td><td>52.3</td><td>71.8</td></tr><tr><td>DING ET AL. [12]</td><td>88.0</td><td>41.4</td><td>47.6</td><td>64.4</td></tr><tr><td>€2 = 0.5</td><td></td><td></td><td></td><td></td></tr><tr><td>SEHWAG ET AL. [44]</td><td>89.5</td><td>73.4</td><td>77.8</td><td>85.7</td></tr><tr><td>RICE ET AL. [38]</td><td>88.7</td><td>67.7</td><td>69.7</td><td>81.3</td></tr><tr><td>RONY ET AL. [39]</td><td>89.1</td><td>66.4</td><td>73.4</td><td>85.3</td></tr><tr><td>DING ET AL. [12]</td><td>88.0</td><td>66.1</td><td>70.3</td><td>82.8</td></tr></table>
192
+
193
+ Dent adapts on batches rather than samples. Batch-wise adaptation stabilizes optimization for entropy minimization. The defense parameters reset between batches.
194
+
195
+ Discussion The purpose of a dynamic defense is to move when the adversary moves. When the adversary submits an attack $x + \delta ^ { t }$ , the defense counters with $\Delta ^ { t }$ . In this way, the defense has the last move, and therefore an advantage.
196
+
197
+ Our dynamic defense changes the model, and therefore its gradients, but differs from gradient obfuscation [3]. Our defense does not rely on (1) shattered gradients, as the update does not cause non-differentiability or numerical instability; (2) stochastic gradients, as the update is deterministic given the input, model, and prior updates; nor (3) exploding/vanishing gradients, as the update improves robustness with even a single step (although more steps are empirically better).
198
+
199
+ Dent forces the attack to rely on a stale gradient, as 58 $\delta ^ { t }$ follows $\Delta ^ { t - 1 }$ , while the model adapts by $\Delta ^ { t }$ .
200
+
201
+ # 9 4 Experiments
202
+
203
+ We evaluate dent against white-box, black-box, and adaptive attacks with a variety of static defenses and datasets. For attacks, we choose the AutoAttack [9] benchmark, which includes four attack types spanning white-box/gradient and black-box/query attacks. For static defenses, we choose strong and recent adversarial training methods, and we also experiment with nominally trained models. For datasets, we evaluate dent on CIFAR-10/CIFAR-100 [27], as they are popular datasets for adversarial robustness, and ImageNet [40], as it is a large-scale dataset.
204
+
205
+ 66 We ablate the choice of model/input adaptation, parameterization, and the number of updates.
206
+
207
+ # 4.1 Setup
208
+
209
+ Metrics We score natural accuracy on the regular test data $x$ and adversarial accuracy on the perturbed test data $x + \delta$ . Each is measured as percentage accuracy (higher is better). We report the worst-case adversarial accuracy across attacks.
210
+
211
+ 171 Test-time Optimization We optimize batch-wise $\Delta$ (dent) and sample-wise $\Delta$ (dent+). Dent updates
212
+ 172 by Adam [26] with learning rate 0.001. Dent+ updates by AdaMod [13] with learning rate 0.006. $\Sigma$
213
+ 173 updates use learning rate 0.25. All updates use batch size 128 and no weight decay. Dent+ regularizes
214
+ 174 updates by information maximization [16, 29]. We tuned update hyperparameters against PGD
215
+ 175 attacks. Please see the code for exact settings.
216
+
217
+ Architecture For comparison with existing defenses, we keep the architecture and training the same, and simply load the public reference models provided by RobustBench [10]. For analysis and ablation experiments, we define a residual net with 26 layers and a width multiplier of 4 (ResNet-26-4) [21, 64], following prior work on adaptation [53, 58].
218
+
219
+ # 0 4.2 Attack Types & Threat Model
220
+
221
+ We evaluate standard white-box and black-box attacks with adversarially-trained models (Section 4.3) and nominally-trained models (Section 4.4), as well as dent-specific adaptive attacks (Section 4.5).
222
+
223
+ We primarily evaluate against AutoAttack’s ensemble of:
224
+
225
+ 1. APGD-CE [30, 9], an untargeted white-box attack by cross-entropy,
226
+ 2. APGD-DLR [9], a targeted white-box attack with a shift and scale invariant loss,
227
+ 3. FAB [8], a targeted white-box attack for minimum-norm perturbation,
228
+ 4. Square Attack [2], an untargeted black-box attack with square-shaped updates.
229
+ 188 These attacks are cumulative, so a defense is only successful if it holds against each type. Following
230
+ 189 convention, we evaluate $\ell _ { \infty }$ attacks with $\epsilon _ { \infty } = 8 / 2 5 5$ and $\ell _ { 2 }$ attacks with $\epsilon _ { 2 } = 0 . 5 $ . This is the
231
+ 190 standard evaluation adopted by the popular RobustBench benchmark [10].
232
+ 191 We devise and experiment with two adaptive attacks against dent and its dynamic updates. The first
233
+ 192 interferes with adaptation by denying updates: it optimizes offline against $\theta$ without $\Delta , \Sigma$ updates.
234
+ 193 The second interferes with adaptation by mixing data: it combines adversarial data and natural data
235
+ 194 in the same batch. Both are specific to dent to complement our general evaluation by AutoAttack.
236
+
237
+ These attacks fall under the usual white-box threat model. The adversary has full access to the classifier, including its architecture and parameters, and the defense, such as dent’s adaptation parameters and statistics. With this access the adversary chooses an attack for each input, but it cannot choose the inputs (the test set is fixed).
238
+
239
+ We include one additional requirement: dent assumes access to test batches rather than individual test samples. While independent, sample-wise defense is ideal for simplicity and latency, batch processing is not impractical. For example, cloud deployments of deep learning batch inputs for throughput efficiency, and large-scale systems handle many inputs per unit time [31].
240
+
241
+ The supplementary material covers more attacks, including AutoAttack Plus and Boundary, to confirm that AutoAttack is a sufficient measure of robustness.
242
+
243
+ # 4.3 Dynamic Defense of Adversarial Training
244
+
245
+ We extend static adversarial training defenses with dynamic updates by dent. Compared to nominal training, adversarial training achieves higher adversarial accuracy but lower natural accuracy. The purpose of dent is to improve adversarial accuracy without further harming natural accuracy.
246
+
247
+ Dent improves state-of-the-art defenses. Table 1 shows state-of-the-art adversarial training defenses [5, 44, 39, 38, 60, 12] with and without dynamic defense by dent. Note that dent does not specialize to the choice of norm or bound, unlike adversarial training, but instead adapts to each attack during testing. In each case, dent significantly improves adversarial accuracy and maintains natural accuracy.
248
+
249
+ 213 Dent updates batch-wise for 30 steps. Dent+ is more robust in fewer steps by sample-wise adaptation.
250
+ 214 With sample-wise $( \gamma , \beta )$ parameters, dent+ needs only six steps to reach an adversarial accuracy
251
+ 215 within $9 0 \%$ of the natural accuracy. These experiments only include model adaptation of $\Delta$ , without
252
+ 216 input adaptation of $\Sigma$ , as we found it unnecessary when combined with adversarial training.
253
+
254
+ Table 2: AutoAttack includes four attack types, and dent improves robustness to each on CIFAR-10 against $\ell _ { \infty }$ attacks. We evaluate without dent (-) and with dent $( + )$ .
255
+
256
+ <table><tr><td>ACCURACY(%)</td><td colspan="2">APGD-CE</td><td colspan="2">APGD-DLR</td><td colspan="2">FAB</td><td colspan="2">SQUARE</td></tr><tr><td></td><td>-</td><td>+</td><td>-</td><td>+</td><td>-</td><td>+</td><td>-</td><td>+</td></tr><tr><td>WONG ET AL. [60]</td><td>45.9</td><td>57.6</td><td>43.2</td><td>52.3</td><td>43.2</td><td>52.3</td><td>43.2</td><td>52.3</td></tr><tr><td>DING ET AL. [12]]</td><td>50.1</td><td>60.2</td><td>41.6</td><td>48.0</td><td>41.5</td><td>47.7</td><td>41.4</td><td>47.6</td></tr></table>
257
+
258
+ Table 3: Ablation of model adaptation $( \Delta )$ , input adaptation $\left( \Sigma \right)$ , and steps on the accuracy of a nominally-trained model with dent.
259
+
260
+ <table><tr><td rowspan="2">△</td><td rowspan="2">£</td><td rowspan="2">STEP</td><td rowspan="2">TIME</td><td rowspan="2">NATURAL</td><td colspan="2">ADVERSARIAL</td></tr><tr><td>E 1.5 二 255</td><td>€2= 0.2</td></tr><tr><td>×</td><td>NONE</td><td>0</td><td>1.0×</td><td>95.6</td><td>8.8</td><td>9.2</td></tr><tr><td>√</td><td>NONE</td><td>1</td><td>3.6×</td><td>95.6</td><td>15.0</td><td>13.5</td></tr><tr><td>×</td><td>STAT.</td><td>0</td><td>1.0×</td><td>86.2</td><td>25.8</td><td>23.6</td></tr><tr><td>√</td><td>STAT.</td><td>1</td><td>3.6×</td><td>86.3</td><td>27.5</td><td>24.4</td></tr><tr><td>√</td><td>STAT.</td><td>10</td><td>25.9×</td><td>86.3</td><td>37.6</td><td>30.9</td></tr><tr><td>√</td><td>DYNA.</td><td>10</td><td>26.1×</td><td>92.5</td><td>45.4</td><td>36.5</td></tr></table>
261
+
262
+ Dent helps across attack types. Table 2 evaluates dent against each attack in the AutoAttack ensemble. Dent improves robustness to each attack type. We report the worst case across these types in the remainder of our experiments.
263
+
264
+ Dent helps across datasets and architectures. We experiment on ImageNet to check scalability. We evaluate the defense of Wong et al. [60], one of few defenses that scales to this dataset, against strong $\ell _ { \infty }$ -PGD attacks with 30 iterations, step size of 0.1, and five random starts. Dent improves the adversarial accuracy by 14 points against PGD at $\epsilon _ { \infty } = 4 / 2 5 5$ and natural accuracy by 23 points.
265
+
266
+ Table ?? in the supplement confirms improvement across more defenses, architectures, and datasets.
267
+
268
+ # 4.4 Dynamic Defense of Nominal Training
269
+
270
+ Dent improves the adversarial accuracy of off-the-shelf, nominally-trained models. As dent does not assume adversarial training, it can apply to various models at test time.
271
+
272
+ For nominal training, we exactly follow the CIFAR reference training in pycls [35, 36] with ResNet26-4/ResNet-32-10 architectures. Briefly, we train by stochastic gradient descent (SGD) for 200 epochs with batch size 128, learning rate 0.1 and decay 0.0005, momentum 0.9, and a half-period cosine schedule.
273
+
274
+ We evaluate against $\ell _ { \infty }$ and $\ell _ { 2 }$ AutoAttack attacks on CIFAR-10. As the nominally-trained models have no static defense, we constrain the adversaries to smaller $\epsilon$ perturbations.
275
+
276
+ Dent defends nominally-trained models. Table 3 inspects how each part of dent affects adversarial accuracy and natural accuracy. When applying dent to nominally-trained models, model adaptation through $\Delta$ is further helped by input adaptation through $\Sigma$ . In just a single step, the $\Delta$ update improves adversarial accuracy without affecting natural accuracy. from $8 . 8 \%$ to $1 5 . 0 \%$ against $\ell _ { \infty }$ attacks with just a single step. With 10 steps, and $\Sigma$ adaptation, dent improves the model’s adversarial accuracy to $4 5 . 4 \%$ against $\ell _ { \infty }$ attacks and $3 6 . 5 \%$ against $\ell _ { 2 }$ attacks. In total, dent boosts $\ell _ { \infty }$ and $\ell _ { 2 }$ adversarial accuracy by almost 40 and 30 points while only sacrificing 3 points of natural accuracy. Dent delivers this boost at test-time, without re-training.
277
+
278
+ Input adaptation helps preserve natural accuracy. Gaussian smoothing significantly improves adversarial accuracy. This agrees with prior work on denoising by optimization [20] or randomized smoothing [7]. Tuned as a fixed hyperparameter, smoothing helps adversarial accuracy but hurts natural accuracy. Optimized end-to-end, our dynamic smoothing reduces the natural accuracy gap. On natural data, the learned $\Sigma$ for the blur decreases to approximate the identity transformation.
279
+
280
+ Table 4: Adaptive attack by denying updates. We transfer attacks from static models to dent and then evaluate nominal and adversarial training [30] against $\ell _ { \infty }$ and $\ell _ { 2 }$ AutoAttack. Attacks break the static models (static-static), but fail to transfer to our dynamic defense (static-dent).
281
+
282
+ <table><tr><td>1.5</td><td colspan="2">NOMINAL</td><td colspan="2">ADVERSARIAL</td></tr><tr><td></td><td>E=255</td><td>€2=0.2</td><td>E=255 8</td><td>€2=0.5</td></tr><tr><td>STATIC-STATIC</td><td>11.6</td><td>11.0</td><td>42.0</td><td>44.1</td></tr><tr><td>STATIC-DENT</td><td>82.5</td><td>81.6</td><td>50.0</td><td>50.2</td></tr></table>
283
+
284
+ Table 5: Adaptive attack by mixing adversarial and natural data. We report the adversarial accuracy on mixed batches, from low to high amounts of adversarial data. Dent improves on adversarial training $( 4 3 . 8 \% )$ across mixing proportions within 10 steps.
285
+
286
+ <table><tr><td>μ,g</td><td>STEP</td><td>1</td><td>10%</td><td>25%</td><td>50%</td><td>75%</td><td>90%</td></tr><tr><td>×</td><td>1</td><td>-</td><td>43.4</td><td>43.2</td><td>44.0</td><td>44.2</td><td>43.8</td></tr><tr><td>×</td><td>10</td><td>62.4</td><td>51.2</td><td>49.6</td><td>48.7</td><td>48.7</td><td>47.6</td></tr><tr><td>√</td><td>1</td><td>-</td><td>41.7</td><td>41.4</td><td>43.2</td><td>44.1</td><td>44.7</td></tr><tr><td></td><td>10</td><td>54.9</td><td>47.6</td><td>47.7</td><td>49.7</td><td>50.6</td><td>50.9</td></tr></table>
287
+
288
+ # 247 4.5 Adaptive Attacks on Dent Updates
289
+
290
+ We adaptively attack dent through its use of adaptation by (1) denying updates and (2) mixing batches. To deny updates, we attack the static model offline by optimizing against $\theta$ without $\Delta , \Sigma$ updates, then submit this attack to dent. This attempts to short circuit adaptation by disrupting the first update with a sufficiently strong perturbation. To mix batches, we mix adversarial and natural data in the same batch. This attempts to prevent adaptation by aligning batch statistics with natural data.
291
+
292
+ Denying Updates The aim of this attack is to defeat adaptation on the first move, before dent can update to counter it. We optimize against the static model alone to prevent defensive optimization until adversarial optimization is complete. Under this attack, the input to dent is the final perturbation derived by adversarial attack against the static model.
293
+
294
+ We examine whether these offline perturbations can disrupt adaptation. Table 4 shows that dent can still defend against this attack. This suggests that updating, and having the last move, remains an advantage for our dynamic defense.
295
+
296
+ Mixing Batches Dent adapts batch-wise, with the underlying assumption that one shared transformation can defend the whole batch. We challenge this assumption by evaluating mixed batches of adversarial and natural data. In Table 5, we vary the ratio of adversarial and natural data in each batch and measure accuracy on the adversarial portion.
297
+
298
+ At the extreme, we consider an adaptive attack with only one adversarial input per batch. Specifically, we batch one adversarial input with 15 natural inputs randomly chosen from the test set. This adaptive attack aims to reduce adaptation by the dynamic defense, as natural inputs do not need adaptation.
299
+
300
+ Dent is generally robust to batch mixing, and improves over adversarial training in 10 steps or less.
301
+
302
+ # 4.6 Ablations & Analysis
303
+
304
+ More updates deliver more defense. The number of steps can balance defense and computation. Table 6 shows that more steps offer stronger defense for both dent and dent+. However, more steps do nevertheless require more computation: ten-step optimization takes $2 5 . 9 \times$ more operations than the static model (Table 3). As a plus, dent+ is not only more robust, but also more efficient in needing fewer steps. Note that the computational difference between dent and dent+ is negligible, as the adaptation parameters are such a small fraction of the model.
305
+
306
+ Model adaptation updates depend on the attack type. Dent adapts by adjusting normalization statistics and affine transformation parameters. Dent can fix or update the normalization statistics $( \mu , \sigma )$ by using static training statistics $( \times )$ or dynamic testing statistics $( \surd )$ ; Dent can fix or update the affine parameters $( \gamma , \beta )$ by not taking gradients $( \times )$ or applying gradient updates $( \surd )$ . Table 7 compares each combination: affine updates always help, but both updates together hurt $\ell _ { 2 }$ robustness.
307
+
308
+ Batch size We analyze dent’s sensitivity to batch size and focus on small batch sizes. Some real-world 281 tasks, such as autonomous driving, naturally provide a small batch of inputs (from consecutive video
309
+
310
+ Table 6: Dynamic defenses can trade computation and adaptation. More steps are more robust on CIFAR-10 with $\ell _ { \infty }$ AutoAttack. Dent+ reaches higher adversarial accuracy in fewer steps.
311
+
312
+ <table><tr><td></td><td colspan="4">STEPS</td></tr><tr><td>DENT</td><td>0</td><td>20</td><td>30</td><td>40</td></tr><tr><td>CARMON ET AL. [5]</td><td>59.5</td><td>68.3</td><td>74.7</td><td>76.1</td></tr><tr><td>WONG ET AL.[60]</td><td>43.2</td><td>48.2</td><td>52.3</td><td>55.1</td></tr><tr><td>DING ET AL.[12]</td><td>41.4</td><td>45.4</td><td>47.6</td><td>48.7</td></tr><tr><td>DENT+</td><td>0</td><td>1</td><td>3</td><td>6</td></tr><tr><td>DING ET AL.[12]</td><td>41.4</td><td>46.5</td><td>57.7</td><td>64.4</td></tr></table>
313
+
314
+ Table 8: Sensitivity analysis of batch size and adversarial accuracy with dent. With static batch statistics $( \times )$ , small batch sizes are better. With dynamic batch statistics $( \surd )$ , small batch sizes are worse.
315
+
316
+ Table 7: Ablation of model adaptation with and without normalization statistics $( \mu , \sigma )$ and affine parameters $( \gamma , \beta )$ updates.
317
+
318
+ <table><tr><td colspan="2">ACCURACY(%)</td><td colspan="2">NOMINAL</td><td colspan="2">ADVERSARIAL</td></tr><tr><td>μ,g</td><td>Y,B</td><td>E= 15 255</td><td>€2=0.2</td><td>E=255 8</td><td>€2=0.5</td></tr><tr><td>×</td><td>×</td><td>8.8</td><td>9.2</td><td>43.8</td><td>47.3</td></tr><tr><td>√</td><td>×</td><td>11.7</td><td>11.2</td><td>41.8</td><td>44.1</td></tr><tr><td>×</td><td>√</td><td>16.8</td><td>16.2</td><td>49.9</td><td>57.3</td></tr><tr><td>√</td><td></td><td>21.2</td><td>15.2</td><td>50.4</td><td>53.0</td></tr></table>
319
+
320
+ <table><tr><td>μ,</td><td>TYPE</td><td>1</td><td>2</td><td>4</td><td>8</td><td>16</td><td>32</td><td>64</td></tr><tr><td>×</td><td>NAT.</td><td>85.9</td><td>86.0</td><td>85.9</td><td>85.9</td><td>86.1</td><td>86.1</td><td>86.2</td></tr><tr><td>×</td><td>ADV.</td><td>70.4</td><td>69.5</td><td>67.8</td><td>65.3</td><td>61.9</td><td>58.6</td><td>55.1</td></tr><tr><td></td><td>NAT.</td><td>11.1</td><td>68.1</td><td>76.3</td><td>80.9</td><td>83.4</td><td>84.9</td><td>85.8</td></tr><tr><td>√</td><td>ADV</td><td>5.8</td><td>35.9</td><td>48.3</td><td>53.0</td><td>55.3</td><td>54.4</td><td>52.9</td></tr></table>
321
+
322
+ 282 frames or various cameras, for example), and so we confirm that dent can maintain robustness on
323
+ 283 such small batches. Table 8 varies batch sizes to check dent’s natural and adversarial accuracy.
324
+
325
+ # 5 Discussion
326
+
327
+ In advocating for dynamic defenses, we hope that test-time updates can help level the field for attacks and defenses. Our proposed defensive entropy method takes a first step by countering adversarial optimization with defensive optimization over the model and input. While more test-time computation is needed for the back-and-forth iteration of attacks and defenses, the cost of defense scales with the cost of attack, and some use cases may prefer slow and strong to fast and wrong.
328
+
329
+ Limitations Dent depends on batches to adapt, especially for fully test-time defense without adversarial training. It also relies on a particular choice of model and input parameters. A different objective could possibly lessen its dependence on batch size and reliance on constrained updates. More generally, dynamic defenses may present difficulties for certification or deployment, as they could drift. Along with how to update, improved defenses could investigate when to reset, or how to batch inputs for joint optimization.
330
+
331
+ Benchmarking Standardized benchmarking, by AutoAttack and RobustBench for example, drives progress by competition and empirical corroboration. Dent brings adversarial accuracy on their benchmark within $9 0 \%$ of natural accuracy for three of the most accurate methods tested [5, 61, 12]. This is encouraging, but more research is needed to fully characterize dynamic defenses like dent. However, RobustBench is designed for static defenses, and disqualifies dent by its rule against test-time optimization. Continued progress could depend on a new benchmark to standardize rules for how attacks and defenses alike may adapt.
332
+
333
+ 303 By fighting gradients with gradients, dent shows the potential for dynamic defenses to update and
334
+ 304 counter adversarial attacks. The next steps—by attacks and defenses—will tell.
335
+
336
+ # References
337
+
338
+ [1] Andreas, J., Rohrbach, M., Darrell, T., and Klein, D. Neural module networks. In CVPR, 2016. [2] Andriushchenko, M., Croce, F., Flammarion, N., and Hein, M. Square attack: a query-efficient black-box adversarial attack via random search. In ECCV, 2020. [3] Athalye, A., Carlini, N., and Wagner, D. Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples. In ICML, 2018. [4] Bai, S., Kolter, J. Z., and Koltun, V. Deep equilibrium models. In NeurIPS, 2020. [5] Carmon, Y., Raghunathan, A., Schmidt, L., Duchi, J. C., and Liang, P. S. Unlabeled data improves adversarial robustness. In NeurIPS, 2019. [6] Chen, R. T., Rubanova, Y., Bettencourt, J., and Duvenaud, D. Neural ordinary differential equations. In NeurIPS, 2018. [7] Cohen, J., Rosenfeld, E., and Kolter, Z. Certified adversarial robustness via randomized smoothing. In ICML, 2019. [8] Croce, F. and Hein, M. Minimally distorted adversarial examples with a fast adaptive boundary attack. In ICML, 2020. [9] Croce, F. and Hein, M. Reliable evaluation of adversarial robustness with an ensemble of diverse parameterfree attacks. In ICML, 2020. [10] Croce, F., Andriushchenko, M., Sehwag, V., Flammarion, N., Chiang, M., Mittal, P., and Hein, M. Robustbench: a standardized adversarial robustness benchmark. arXiv preprint arXiv:2010.09670, 2020. [11] Dhillon, G. S., Azizzadenesheli, K., Bernstein, J. D., Kossaifi, J., Khanna, A., Lipton, Z. C., and Anandkumar, A. Stochastic activation pruning for robust adversarial defense. In ICLR, 2018. [12] Ding, G. W., Sharma, Y., Lui, K. Y. C., and Huang, R. Mma training: Direct input space margin maximization through adversarial training. In ICLR, 2020. [13] Ding, J., Ren, X., Luo, R., and Sun, X. An adaptive and momental bound method for stochastic learning. arXiv preprint arXiv:1910.12249, 2019. [14] Evans, D., Nguyen-Tuong, A., and Knight, J. Effectiveness of moving target defenses. In Moving target defense, pp. 29–48. Springer, 2011. [15] Gilmer, J., Ford, N., Carlini, N., and Cubuk, E. Adversarial examples are a natural consequence of test error in noise. In ICML, 2019. [16] Gomes, R., Krause, A., and Perona, P. Discriminative clustering by regularized information maximization. In NeurIPS, 2010. [17] Goodfellow, I. A research agenda: Dynamic models to defend against correlated attacks. arXiv preprint arXiv:1903.06293, 2019. [18] Goodfellow, I. J., Shlens, J., and Szegedy, C. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014. [19] Graves, A. Adaptive computation time for recurrent neural networks. arXiv preprint arXiv:1603.08983, 2016.
339
+ 42 [20] Guo, C., Rana, M., Cisse, M., and van der Maaten, L. Countering adversarial images using input transformations. In ICLR, 2018.
340
+ 44 [21] He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In CVPR, 2016.
341
+ 45 [22] Hendrycks, D. and Dietterich, T. Benchmarking neural network robustness to common corruptions and perturbations. In ICLR, 2019. [23] Hill, M., Mitchell, J. C., and Zhu, S.-C. Stochastic security: Adversarial defense using long-run dynamics of energy-based models. In ICLR, 2021. URL https://openreview.net/forum?id=gwFTuzxJW0. [24] Hoffman, J., Tzeng, E., Park, T., Zhu, J.-Y., Isola, P., Saenko, K., Efros, A., and Darrell, T. Cycada: Cycle-consistent adversarial domain adaptation. In ICML, 2018.
342
+
343
+ 351 [25] Ioffe, S. and Szegedy, C. Batch normalization: Accelerating deep network training by reducing internal
344
+ 352 covariate shift. In ICML, 2015.
345
+ 353 [26] Kingma, D. and Ba, J. Adam: A method for stochastic optimization. In ICLR, 2015.
346
+ 354 [27] Krizhevsky, A. Learning multiple layers of features from tiny images. Technical report, University of
347
+ 355 Toronto, 2009.
348
+ 356 [28] Liang, J., Hu, D., and Feng, J. Do we really need to access the source data? source hypothesis transfer for
349
+ 357 unsupervised domain adaptation. In ICML, 2020.
350
+ 358 [29] Liang, J., Hu, D., Wang, Y., He, R., and Feng, J. Source data-absent unsupervised domain adaptation
351
+ 359 through hypothesis transfer and labeling transfer. arXiv preprint arXiv:2012.07297, 2020.
352
+ 360 [30] Madry, A., Makelov, A., Schmidt, L., Tsipras, D., and Vladu, A. Towards deep learning models resistant
353
+ 361 to adversarial attacks. In ICLR, 2018.
354
+ 362 [31] Olston, C., Fiedel, N., Gorovoy, K., Harmsen, J., Lao, L., Li, F., Rajashekhar, V., Ramesh, S., and Soyke, J.
355
+ 363 Tensorflow-serving: Flexible, high-performance ml serving. In NeurIPS Workshop, 2017.
356
+ 364 [32] Pang\*, T., $\mathrm { X u ^ { * } }$ , K., and Zhu, J. Mixup inference: Better exploiting mixup to defend adversarial attacks. In
357
+ 365 ICLR, 2020.
358
+ 366 [33] Perez, E., Strub, F., De Vries, H., Dumoulin, V., and Courville, A. Film: Visual reasoning with a general
359
+ 367 conditioning layer. In AAAI, 2018.
360
+ 368 [34] Quionero-Candela, J., Sugiyama, M., Schwaighofer, A., and Lawrence, N. D. Dataset shift in machine
361
+ 369 learning. The MIT Press, 2009.
362
+ 370 [35] Radosavovic, I., Johnson, J., Xie, S., Lo, W.-Y., and Dollár, P. On network design spaces for visual
363
+ 371 recognition. In ICCV, 2019.
364
+ 372 [36] Radosavovic, I., Kosaraju, R. P., Girshick, R., He, K., and Dollár, P. Designing network design spaces. In
365
+ 373 CVPR, 2020.
366
+ 374 [37] Raff, E., Sylvester, J., Forsyth, S., and McLean, M. Barrage of random transforms for adversarially robust
367
+ 375 defense. In CVPR, 2019.
368
+ 376 [38] Rice, L., Wong, E., and Kolter, Z. Overfitting in adversarially robust deep learning. In ICML, 2020.
369
+ 377 [39] Rony, J., Hafemann, L. G., Oliveira, L. S., Ayed, I. B., Sabourin, R., and Granger, E. Decoupling direction
370
+ 378 and norm for efficient gradient-based l2 adversarial attacks and defenses. In CVPR, 2019.
371
+ 379 [40] Russakovsky, O., Deng, J., Su, H., Krause, J., Satheesh, S., Ma, S., Huang, Z., Karpathy, A., Khosla, A.,
372
+ 380 Bernstein, M., et al. ImageNet large scale visual recognition challenge. IJCV, 2015.
373
+ 381 [41] Saenko, K., Kulis, B., Fritz, M., and Darrell, T. Adapting visual category models to new domains. In
374
+ 382 ECCV, 2010.
375
+ 383 [42] Samangouei, P., Kabkab, M., and Chellappa, R. Defense-GAN: Protecting classifiers against adversarial
376
+ 384 attacks using generative models. In ICLR, 2018.
377
+ 385 [43] Schneider, S., Rusak, E., Eck, L., Bringmann, O., Brendel, W., and Bethge, M. Improving robustness
378
+ 386 against common corruptions by covariate shift adaptation. In NeurIPS, 2020.
379
+ 387 [44] Sehwag, V., Mahloujifar, S., Handina, T., Dai, S., Xiang, C., Chiang, M., and Mittal, P. Improving
380
+ 388 adversarial robustness using proxy distributions. arXiv preprint arXiv:2104.09425, 2021.
381
+ 389 [45] Shannon, C. A mathematical theory of communication. Bell system technical journal, 27, 1948.
382
+ 390 [46] Sharma, Y. and Chen, P.-Y. Attacking the madry defense model with $l _ { - 1 }$ -based adversarial examples.
383
+ 391 arXiv preprint arXiv:1710.10733, 2017.
384
+ 392 [47] Shazeer, N., Mirhoseini, A., Maziarz, K., Davis, A., Le, Q., Hinton, G., and Dean, J. Outrageously large
385
+ 393 neural networks: The sparsely-gated mixture-of-experts layer. In ICLR, 2017.
386
+ 394 [48] Shelhamer, E., Wang, D., and Darrell, T. Blurring the line between structure and learning to optimize and
387
+ 395 adapt receptive fields. arXiv preprint arXiv:1904.11487, 2019.
388
+ 396 [49] Shi, C., Holtz, C., and Mishne, G. Online adversarial purification based on self-supervised learning. In
389
+ 397 ICLR, 2021. URL https://openreview.net/forum?id=_i3ASPp12WS.
390
+
391
+ [50] Song, Y., Kim, T., Nowozin, S., Ermon, S., and Kushman, N. Pixeldefend: Leveraging generative models to understand and defend against adversarial examples. In ICLR, 2018.
392
+ [51] Stutz, D., Hein, M., and Schiele, B. Disentangling adversarial robustness and generalization. In CVPR, June 2019.
393
+ [52] Su, D., Zhang, H., Chen, H., Yi, J., Chen, P.-Y., and Gao, Y. Is robustness the cost of accuracy?–a comprehensive study on the robustness of 18 deep image classification models. In ECCV, 2018.
394
+ [53] Sun, Y., Wang, X., Liu, Z., Miller, J., Efros, A. A., and Hardt, M. Test-time training for out-of-distribution generalization. In ICML, 2020.
395
+ [54] Szegedy, C., Zaremba, W., Sutskever, I., Bruna, J., Erhan, D., Goodfellow, I., and Fergus, R. Intriguing properties of neural networks. In ICLR, 2014.
396
+ [55] Tramer, F. and Boneh, D. Adversarial training and robustness for multiple perturbations. In NeurIPS, 2019.
397
+ [56] Tramer, F., Carlini, N., Brendel, W., and Madry, A. On adaptive attacks to adversarial example defenses. In NeurIPS, 2020.
398
+ [57] Veit, A. and Belongie, S. Convolutional networks with adaptive inference graphs. In ECCV, 2018.
399
+ [58] Wang, D., Shelhamer, E., Liu, S., Olshausen, B., and Darrell, T. Fully test-time adaptation by entropy minimization. In ICLR, 2021.
400
+ [59] Wang, X., Yu, F., Dou, Z.-Y., Darrell, T., and Gonzalez, J. E. Skipnet: Learning dynamic routing in convolutional networks. In ECCV, 2018.
401
+ [60] Wong, E., Rice, L., and Kolter, J. Z. Fast is better than free: Revisiting adversarial training. In ICLR, 2020.
402
+ [61] Wu, D., Xia, S.-T., and Wang, Y. Adversarial weight perturbation helps robust generalization. In NeurIPS, 2020.
403
+ [62] Yang, B., Bender, G., Le, Q. V., and Ngiam, J. Condconv: Conditionally parameterized convolutions for efficient inference. In NeurIPS, 2019.
404
+ [63] Yuan, X., He, P., Zhu, Q., and Li, X. Adversarial examples: Attacks and defenses for deep learning. TNNLS, 2019.
405
+ [64] Zagoruyko, S. and Komodakis, N. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016.
406
+ [65] Zhang, H., Yu, Y., Jiao, J., Xing, E., El Ghaoui, L., and Jordan, M. I. Theoretically principled trade-off between robustness and accuracy. In ICML, 2019.
407
+ [66] Zhang, H., Chen, H., Xiao, C., Gowal, S., Stanforth, R., Li, B., Boning, D., and Hsieh, C.-J. Towards stable and efficient training of verifiably robust neural networks. In ICLR, 2020.
408
+
409
+ # Checklist
410
+
411
+ 1. For all authors...
412
+
413
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] 1. The last move advantage is described in Section 3.2 under “Discussion”. 2. Dent is unique in its adaptation of the model parameters during testing without altering training. Section 2 explains that generative and self-supervised defenses optimize the input, but require auxiliary models, and their parameters are fixed. 3. Table 1 is our main result showing that dent improves state-of-the-art adversarial training defenses. 4. Adaptive attacks are explained and reported in Section 4.5.
414
+ (b) Did you describe the limitations of your work? [Yes] Section 4.2 describes the threat model for our work and its requirement of test batches. This is discussed more in Section 5.
415
+ (c) Did you discuss any potential negative societal impacts of your work? [No] Our project is about defense, not attack, and so it has less potential for direct negative impact.
416
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
417
+
418
+ 2. If you are including theoretical results...
419
+
420
+ (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]
421
+
422
+ 3. If you ran experiments...
423
+
424
+ (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 experiment setup (Section 4.1) and code in the supplementary material specify experiment details and reproduce our main results for dent+.
425
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Our method alters testing, not training, but its test-time optimization details are given by the above.
426
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We evaluate with the standard adversarial benchmarks or AutoAttack and RobustBench, which do not report variability in this way.
427
+ (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] Our project does not require exotic resources, but standard deep learning hardware. In particular, we use V100 and Titan Xp GPUs on local servers.
428
+
429
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
430
+
431
+ (a) If your work uses existing assets, did you cite the creators? [Yes] Libraries, datasets, and models are all cited in Experiments (Section 4.
432
+ (b) Did you mention the license of the assets? [No] The licenses are mentioned at the given references and URLs.
433
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes] Our code is included in the supplemental material.
434
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] We did not collect new data.
435
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] We did not collect new data.
436
+
437
+ 5. If you used crowdsourcing or conducted research with human subjects...
438
+
439
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
440
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
441
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]